Skip to content

Commit

Permalink
Make cursor unavailable on leave in iced_winit
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
hecrj committed Apr 11, 2020
1 parent 4b0cc17 commit f652e84
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions native/src/user_interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit f652e84

Please sign in to comment.