Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pointer released events do not trigger for drags #2094

Closed
Baezon opened this issue Sep 30, 2022 · 1 comment · Fixed by #2507
Closed

Pointer released events do not trigger for drags #2094

Baezon opened this issue Sep 30, 2022 · 1 comment · Fixed by #2507
Labels
bug Something is broken

Comments

@Baezon
Copy link

Baezon commented Sep 30, 2022

I.e. the click was only held briefly. This seems to be by design? PointerEvent only has Option<Click> meaning that if the click is held too long and does not count as a click, the event merely has None and has no idea what button was released, and therefore cannot trigger primary_released(), secondary_released(), etc.

Either way, very confusing that button_released() does not actually always trigger when the button releases.

@Baezon Baezon added the bug Something is broken label Sep 30, 2022
@jiftoo
Copy link

jiftoo commented Dec 18, 2022

+1

It seems that PointerState::button_released() check if a button was released only within a click, unlike PointerState::any_released(). This doesn't seem intentional.

/// Was any pointer button released (`down -> !down`) this frame?
pub fn any_released(&self) -> bool {
    self.pointer_events.iter().any(|event| event.is_release())
}
/// Was the button given released this frame?
pub fn button_released(&self, button: PointerButton) -> bool {
    self.pointer_events
        .iter()
        .any(|event| matches!(event, &PointerEvent::Released(Some(Click{button: b, ..})) if button == b))
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants