Fix minor click detection bug

This commit is contained in:
Emil Ernerfeldt
2021-02-07 17:04:03 +01:00
parent 6377a4231f
commit a382fad1d0
2 changed files with 8 additions and 0 deletions
+4
View File
@@ -470,6 +470,10 @@ impl PointerState {
pub fn button_down(&self, button: PointerButton) -> bool {
self.down[button as usize]
}
pub(crate) fn could_any_button_be_click(&self) -> bool {
self.could_be_click
}
}
impl InputState {
+4
View File
@@ -139,6 +139,10 @@ impl Interaction {
self.click_interest = false;
self.drag_interest = false;
if !prev_input.pointer.could_any_button_be_click() {
self.click_id = None;
}
if !prev_input.pointer.any_down() || prev_input.pointer.latest_pos().is_none() {
// pointer button was not down last frame
self.click_id = None;