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

Touch support stopped working #406

Open
jesben opened this issue Jul 7, 2024 · 1 comment
Open

Touch support stopped working #406

jesben opened this issue Jul 7, 2024 · 1 comment

Comments

@jesben
Copy link

jesben commented Jul 7, 2024

Thanks for a great lib to all those who contributed!

When this library switched to mousedown, mousemove and mouseup from drag "onmove, onstart and onstop" for bar events, touch support stopped working (Tested on iOS). Tried to implement it with touchstart, touchmove and touchend, but scrollbar from container messes it up and dragging bar doesn't run smoothly. Anyone have a solution for this?

Both mouse and touch works in the demo! The demo runs with a very old version. Version 0.0.7 is the last version that uses onmove, onstart and onstop.

To get offsetX and offsetY, I have tried with
touchstart:

const rect = e.target.getBoundingClientRect();
x_on_start = e.targetTouches[0].clientX - rect.x;
y_on_start = e.targetTouches[0].clientY - rect.y;

touchend:

const rect = e.target.getBoundingClientRect();
let offsetX = e.targetTouches[0].clientX - rect.x;
let offsetY = e.targetTouches[0].clientY - rect.y;
@jesben
Copy link
Author

jesben commented Jul 8, 2024

x_on_start = e.touches[0].clientX;
y_on_start = e.touches[0].clientY;
let offsetX = e.touches[0].clientX;
let offsetY = e.touches[0].clientY;

Is working :)

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

No branches or pull requests

1 participant