Track cursor_position in Runtime

This commit is contained in:
Héctor Ramón Jiménez 2019-07-23 10:53:19 +02:00
parent e55ac637a9
commit f6f7505b9d

View File

@ -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);
}