Fix minor click detection bug
This commit is contained in:
parent
6377a4231f
commit
a382fad1d0
2 changed files with 8 additions and 0 deletions
|
@ -470,6 +470,10 @@ impl PointerState {
|
||||||
pub fn button_down(&self, button: PointerButton) -> bool {
|
pub fn button_down(&self, button: PointerButton) -> bool {
|
||||||
self.down[button as usize]
|
self.down[button as usize]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn could_any_button_be_click(&self) -> bool {
|
||||||
|
self.could_be_click
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl InputState {
|
impl InputState {
|
||||||
|
|
|
@ -139,6 +139,10 @@ impl Interaction {
|
||||||
self.click_interest = false;
|
self.click_interest = false;
|
||||||
self.drag_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() {
|
if !prev_input.pointer.any_down() || prev_input.pointer.latest_pos().is_none() {
|
||||||
// pointer button was not down last frame
|
// pointer button was not down last frame
|
||||||
self.click_id = None;
|
self.click_id = None;
|
||||||
|
|
Loading…
Reference in a new issue