bobboteck / JoyStick

A simple JoyStick that use HTML5, Canvas and Vanilla JavaScript, for touch and mouse interfaces (no JQuery required), preview at:
https://bobboteck.github.io/joy/joy.html
MIT License
365 stars 98 forks source link

Issue with multiple joysticks #32

Open Xamyrz opened 2 years ago

Xamyrz commented 2 years ago

Describe the bug the "touchend" event should be listening to "canvas" rather than "document", as in my webapp, when i want to have 2 joysticks, and I let go of one of them, the "touchend" event gets fired on both of the joysticks.

To Reproduce Steps to reproduce the behavior:

  1. add 2 joysticks
  2. touch 2 at the same time
  3. let go of one
  4. "touchend" will be fired for both joysticks, rather than just the one.

Expected behavior touchend fired on the joystick that actually initialised it, rather than both

Screenshots ezgif-5-5020b8eb2b

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context None