You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While trying it inside a page with a complex layout, using canvas.offsetParent.offsetLeft (and Top) inside of onTouchMove() and onMouseMove() reported (correctly) the offsets for the closest positioned parent element.
However, its offsetTop was 0 but the event.pageY was something like 400 and that made the Y axis of the joystick unusable.
Hi @pardo-bsso, I have read the documentation you have indicated, but as reported in this link it is a Working Draft, so for now it is not definitive. For this reason, even if the code would be much cleaner, I don't think I will adopt this solution for the moment.
I have tried the code you suggested, and it work well in desktop browser, but it doesn't work on mobile device.
You have tested it on mobile?
I tried looking for information on the documentation about offsetX properties of the Touch object (reference here), but I can't find anything.
I'm experiencing the same issue (both with mouse and touch on desktop and mobile): Unless the page is scrolled all the way to the top the joystick keeps dragging to the bottom.
Adding this line to both onTouchMove and onMouseMove right before deleting the canvas works for me:
Hi @bobboteck , thanks for this library.
While trying it inside a page with a complex layout, using canvas.offsetParent.offsetLeft (and Top) inside of onTouchMove() and onMouseMove() reported (correctly) the offsets for the closest positioned parent element.
However, its offsetTop was 0 but the event.pageY was something like 400 and that made the Y axis of the joystick unusable.
Nowadays most browsers support the clientX and clientY properties on events that report the desired value (see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/offsetX and related)
We ended up patching the methods like:
and that made it work like a charm.
I don't know if you had other reason for the original code but this is related to issues like #10, #11 and #12.
Thanks
The text was updated successfully, but these errors were encountered: