summaryrefslogtreecommitdiffstats
path: root/native
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2020-04-13 04:33:39 +0200
committerLibravatar GitHub <noreply@github.com>2020-04-13 04:33:39 +0200
commitbc70ba12f1573599a53c7e21f34f4dc6422c56e0 (patch)
treea63bbdffb2062954b5e00c5066c04dada053a4e9 /native
parente941eab4ab58da4473dd4473215bc4f36684dafb (diff)
parentf652e84187336c8bdd9bee32c0afeda7b14796b3 (diff)
downloadiced-bc70ba12f1573599a53c7e21f34f4dc6422c56e0.tar.gz
iced-bc70ba12f1573599a53c7e21f34f4dc6422c56e0.tar.bz2
iced-bc70ba12f1573599a53c7e21f34f4dc6422c56e0.zip
Merge pull request #289 from hecrj/fix/cursor-events
Produce and handle `CursorEntered` and `CursorLeft`
Diffstat (limited to 'native')
-rw-r--r--native/src/user_interface.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/native/src/user_interface.rs b/native/src/user_interface.rs
index 5d9221e9..88ffd6d6 100644
--- a/native/src/user_interface.rs
+++ b/native/src/user_interface.rs
@@ -188,8 +188,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 }) => {
+ self.cursor_position = Point::new(x, y);
+ }
+ Event::Mouse(mouse::Event::CursorLeft) => {
+ // TODO: Encode cursor availability
+ self.cursor_position = Point::new(-1.0, -1.0);
+ }
+ _ => {}
}
self.root.widget.on_event(