diff options
author | 2019-11-11 20:29:58 -0800 | |
---|---|---|
committer | 2020-03-18 11:26:53 -0700 | |
commit | e19a07d40049f40f36d879a498fab4ce63778b27 (patch) | |
tree | 6ecdcb5345f6c00c2b53ee4d93afd8585c1dda2e /native/src/user_interface.rs | |
parent | 9da6ce474c2cd178ca5365d46760ba0882ce7121 (diff) | |
download | iced-e19a07d40049f40f36d879a498fab4ce63778b27.tar.gz iced-e19a07d40049f40f36d879a498fab4ce63778b27.tar.bz2 iced-e19a07d40049f40f36d879a498fab4ce63778b27.zip |
Added initial touch events to support iOS
Diffstat (limited to '')
-rw-r--r-- | native/src/user_interface.rs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/native/src/user_interface.rs b/native/src/user_interface.rs index 08914bed..751b2652 100644 --- a/native/src/user_interface.rs +++ b/native/src/user_interface.rs @@ -1,5 +1,6 @@ use crate::{ - input::mouse, layout, Clipboard, Element, Event, Layout, Point, Size, + input::{mouse, touch}, + layout, Clipboard, Element, Event, Layout, Point, Size, }; use std::hash::Hasher; @@ -181,8 +182,15 @@ where let mut messages = Vec::new(); for event in events { - if let Event::Mouse(mouse::Event::CursorMoved { x, y }) = event { - self.cursor_position = Point::new(x, y); + match event { + Event::Mouse(mouse::Event::CursorMoved { x, y }) + | Event::Touch(touch::Touch::Started { x, y }) + | Event::Touch(touch::Touch::Ended { x, y }) + | Event::Touch(touch::Touch::Moved { x, y }) + | Event::Touch(touch::Touch::Cancelled { x, y }) => { + self.cursor_position = Point::new(x, y); + } + _ => {} } self.root.widget.on_event( |