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:
parent
4b0cc178dd
commit
f652e84187
@ -188,8 +188,15 @@ where
|
|||||||
let mut messages = Vec::new();
|
let mut messages = Vec::new();
|
||||||
|
|
||||||
for event in events {
|
for event in events {
|
||||||
if let Event::Mouse(mouse::Event::CursorMoved { x, y }) = event {
|
match event {
|
||||||
self.cursor_position = Point::new(x, y);
|
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(
|
self.root.widget.on_event(
|
||||||
|
Loading…
Reference in New Issue
Block a user