Treat Event::PointerGone as PointerEvent::Released (#4419)

* Closes #4406
* Closes #4418 

If `Event::PointerGone` occurs, it is treated as
`PointerEvent::Released`.
This commit is contained in:
rustbasic
2024-05-11 13:17:58 +02:00
committed by GitHub
parent 11fa9cc7ee
commit 66d2b3ffe4
4 changed files with 12 additions and 8 deletions
+1 -1
View File
@@ -1875,8 +1875,8 @@ impl Context {
drag_started: _,
dragged,
drag_stopped: _,
contains_pointer,
hovered,
contains_pointer,
} = interact_widgets;
if true {
+4
View File
@@ -800,6 +800,10 @@ impl PointerState {
}
Event::PointerGone => {
self.latest_pos = None;
self.pointer_events.push(PointerEvent::Released {
click: None,
button: PointerButton::Primary,
});
// NOTE: we do NOT clear `self.interact_pos` here. It will be cleared next frame.
}
Event::MouseMoved(delta) => *self.motion.get_or_insert(Vec2::ZERO) += *delta,
+1 -1
View File
@@ -283,7 +283,7 @@ pub(crate) fn interact(
drag_started,
dragged,
drag_stopped,
contains_pointer,
hovered,
contains_pointer,
}
}