diff options
author | 2019-07-23 10:53:19 +0200 | |
---|---|---|
committer | 2019-07-23 10:53:19 +0200 | |
commit | f6f7505b9d5f4c562cb856dea388d08745be27a9 (patch) | |
tree | 33f0a5ed6b409f1acfbe1233895b337e89df0066 /src | |
parent | e55ac637a9c4422b2fccfcc56c25449160e56e02 (diff) | |
download | iced-f6f7505b9d5f4c562cb856dea388d08745be27a9.tar.gz iced-f6f7505b9d5f4c562cb856dea388d08745be27a9.tar.bz2 iced-f6f7505b9d5f4c562cb856dea388d08745be27a9.zip |
Track `cursor_position` in `Runtime`
Diffstat (limited to 'src')
-rw-r--r-- | src/runtime.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/runtime.rs b/src/runtime.rs index f8a5aaa3..1b9dcca9 100644 --- a/src/runtime.rs +++ b/src/runtime.rs @@ -1,4 +1,4 @@ -use crate::{Column, Element, Event, Layout, MouseCursor, Point}; +use crate::{input::mouse, Column, Element, Event, Layout, MouseCursor, Point}; use std::hash::Hasher; use stretch::result; @@ -30,6 +30,13 @@ impl Runtime { } pub fn on_event(&mut self, event: Event) { + match event { + Event::Mouse(mouse::Event::CursorMoved { x, y }) => { + self.cursor_position = Point::new(x, y); + } + _ => {} + } + self.events.push(event); } |