Make cursor unavailable on leave in iced_winit

For now, we just set the cursor position to some negative coordinates.
This is a temporary hack until we are able to encode cursor
availability. Layers and/or multi-window support will make this
apparent.
This commit is contained in:
Héctor Ramón Jiménez 2020-04-12 00:38:18 +02:00
parent 4b0cc178dd
commit f652e84187

View File

@ -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(