Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic multi touch support (issue #279) #306

Merged
merged 36 commits into from
May 6, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
3cae7c5
translate touch events from glium to egui
quadruple-output Apr 9, 2021
9dbda04
translate touch events from web_sys to egui
quadruple-output Apr 10, 2021
7c1c01a
introduce `TouchState` and `Gesture`
quadruple-output Apr 11, 2021
69dafcc
add method InputState::zoom()
quadruple-output Apr 11, 2021
7d30aa1
manage one `TouchState` per individual device
quadruple-output Apr 11, 2021
2d8406b
implement control loop for gesture detection
quadruple-output Apr 11, 2021
c2908ab
streamline `Gesture` trait, simplifying impl's
quadruple-output Apr 12, 2021
a5da37d
implement first version of Zoom gesture
quadruple-output Apr 12, 2021
45e59e7
fix failing doctest
quadruple-output Apr 13, 2021
c348c6c
Merge remote-tracking branch 'upstream/master' into issue-279-touch-g…
quadruple-output Apr 17, 2021
9e841d5
get rid of `Gesture`s
quadruple-output Apr 17, 2021
dfc4f20
Provide a Zoom/Rotate window in the demo app
quadruple-output Apr 18, 2021
286e4d5
fix comments and non-idiomatic code
quadruple-output Apr 18, 2021
39d93e1
update touch state *each frame*
quadruple-output Apr 18, 2021
99176c3
Merge remote-tracking branch 'upstream/master' into issue-279-touch-g…
quadruple-output Apr 18, 2021
de4b4cd
Merge remote-tracking branch 'upstream/master' into issue-279-touch-g…
quadruple-output Apr 21, 2021
211972e
change egui_demo to use *relative* touch data
quadruple-output Apr 22, 2021
ca846e5
support more than two fingers
quadruple-output Apr 23, 2021
0882300
Merge remote-tracking branch 'upstream/master' into issue-279-touch-g…
quadruple-output Apr 23, 2021
0d7d20a
Merge remote-tracking branch 'upstream/master' into issue-279-touch-g…
quadruple-output Apr 26, 2021
bd5b909
cleanup code and comments for review
quadruple-output Apr 26, 2021
cc054b8
minor code simplifications
quadruple-output Apr 28, 2021
fee8ed8
oops – forgot the changelog
quadruple-output Apr 28, 2021
0687b82
Merge remote-tracking branch 'upstream/master' into issue-279-touch-g…
quadruple-output Apr 29, 2021
ce8f3a8
resolve comment https://github.com/emilk/egui/pull/306/files/fee8ed83…
quadruple-output Apr 29, 2021
9c6c6b1
accept suggestion https://github.com/emilk/egui/pull/306#discussion_r…
quadruple-output Apr 29, 2021
5c27120
fix syntax error (dough!)
quadruple-output Apr 29, 2021
612069a
remove `dbg!` (why didnt clippy see this?)
quadruple-output Apr 29, 2021
e3cc56e
apply suggested diffs from review
quadruple-output Apr 29, 2021
e4c9a65
fix conversion of physical location to Pos2
quadruple-output Apr 29, 2021
67b5a88
Merge remote-tracking branch 'upstream/master' into issue-279-touch-g…
quadruple-output May 1, 2021
3918653
remove redundanct type `TouchAverages`
quadruple-output May 1, 2021
9161b12
Merge remote-tracking branch 'upstream' into issue-279-touch-gesture-…
quadruple-output May 3, 2021
b38e225
remove trailing space
quadruple-output May 3, 2021
acbefda
avoid initial translation jump in plot demo
quadruple-output May 3, 2021
755ca30
extend the demo so it shows off translation
quadruple-output May 5, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
support more than two fingers
This commit includes an improved Demo Window for egui_demo, and a complete
re-write of the gesture detection.  The PR should be ready for review, soon.
  • Loading branch information
quadruple-output committed Apr 23, 2021
commit ca846e5e02d0bfc3b30e856e72096941a02bb5b6
11 changes: 6 additions & 5 deletions egui/src/input_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::{emath::*, util::History};
use std::collections::{BTreeMap, HashSet};

pub use crate::data::input::Key;
pub use touch_state::TouchInfo;
pub use touch_state::MultiTouchInfo;
use touch_state::TouchState;

/// If the pointer moves more than this, it is no longer a click (but maybe a drag)
Expand Down Expand Up @@ -95,7 +95,7 @@ impl InputState {
});
self.create_touch_states_for_new_devices(&new.events);
for touch_state in self.touch_states.values_mut() {
touch_state.begin_frame(time, &new);
touch_state.begin_frame(time, &new, self.pointer.interact_pos);
}
let pointer = self.pointer.begin_frame(time, &new);
let mut keys_down = self.keys_down;
Expand Down Expand Up @@ -194,9 +194,10 @@ impl InputState {
self.physical_pixel_size()
}

pub fn touches(&self) -> Option<TouchInfo> {
// In case of multiple touch devices simply pick the touch_state for the first touch device
// with an ongoing gesture:
/// Details about the currently ongoing multi-touch gesture, if any. See [`MultiTouchInfo`].
pub fn multi_touch(&self) -> Option<MultiTouchInfo> {
// In case of multiple touch devices simply pick the touch_state for the first active
// device
if let Some(touch_state) = self.touch_states.values().find(|t| t.is_active()) {
touch_state.info()
} else {
Expand Down
Loading