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

fix: release input when mouse event is canceled #201

Merged
merged 4 commits into from
Aug 25, 2022

Conversation

malangfox
Copy link
Contributor

@malangfox malangfox commented Aug 25, 2022

Issue

naver/egjs-flicking#721

Details

This fixes the invalid behavior of "mouse" inputType at PanInput.

Currently, the "mouse" inputType was not detecting the conditions similar as the "pointercancel" event occurs. Such as a situation that an image inside an element is being dragged.
We can track the situation that mouse input event is canceled, similar to the situation in which "pointercancel" occurs, by checking the which in "mousemove" event.

This change keeps the same behavior as in hammerjs used in the past version of Axes.

@@ -45,8 +45,8 @@ export class MouseEventInput extends EventInput {
return;
}

public getTouches(): number {
return 0;
public getTouches(event: InputEventType): number {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you think of dragging with the right mouse button and dragging with the wheel button?

Copy link
Contributor Author

@malangfox malangfox Aug 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You pointed out a good point I was missing.
To avoid other unexpected exceptions, this statement should check if event.which is included in the list of inputButton.

Copy link
Member

@daybrush daybrush left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@WoodNeck WoodNeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@malangfox malangfox merged commit 18b3070 into naver:master Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants