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

Use pointermove instead of mousemove to allow touch interactions to work #70

Merged
merged 2 commits into from
Nov 16, 2024

Conversation

nedredmond
Copy link
Contributor

Just swaps out mousemove in favor of pointermove, which encapsulates mouse, touch, and pen events. Since PointerEvent inherits from MouseEvent, there is no other change needed for this to work. See the MDN page for PointerEvent.

The other bound event, click, already handles touch events, so nothing else is needed to make this plugin compatible with touch events.

Should fix #66 (as far as touchmove -- the other two are fixed by using pointer events to cover all interactions)

@Fuzzyma
Copy link
Member

Fuzzyma commented Nov 16, 2024

@nedredmond are there any mouse events you didnt cover?
Asking because if this:

the other two are fixed by using pointer events to cover all interactions

@nedredmond
Copy link
Contributor Author

nedredmond commented Nov 16, 2024

@nedredmond are there any mouse events you didnt cover?
Asking because if this:

the other two are fixed by using pointer events to cover all interactions

I meant those two "other two" (touchstart and touchend) are handled by the consumer, and it works if they use pointer events instead, as in drawArea.pointerdown((e) => drawing.draw()) and drawArea.pointerup((e) => drawing.draw("stop")) (not sure I'm getting the syntax right, on my phone -- but you get it) which cover mouse, touch, and stylus events.

I think the user that reported the issue was seeing that the draw between touch start and touch end didn't work. With pointermove, it will.

@Fuzzyma
Copy link
Member

Fuzzyma commented Nov 16, 2024

Ah OK. I see. Thanks :)

@Fuzzyma Fuzzyma merged commit 03204a1 into svgdotjs:master Nov 16, 2024
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.

How to deal with touchstart - touchmove - touchend ?
2 participants