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

bug working in transform #52

Open
seeintea opened this issue Aug 12, 2024 · 0 comments
Open

bug working in transform #52

seeintea opened this issue Aug 12, 2024 · 0 comments

Comments

@seeintea
Copy link

Thanks for the lib!

It's looks like a special case bug.

If the parent container has a transform attribute and there is a big gap between the width and height of the image, can't move left or right after zooming.

Reproduction link: https://codesandbox.io/p/sandbox/vanilla-js-wheel-zoom-bug-report-68kzp7

In general, zooming in a bit along the top left corner will reproduce the problem.
image

Reading through the code, I found that when binding the dragScrollableObserver, it checks to see if it's within the maximum allowable movement area. but after scaling, the value of content.currentLeft has exceeded maxAvailableLeft, making it impossible to move left and right.

The way I'm handling it now is that when I rescale, I check to see when maxAvailableLeft has been exceeded, and if it has, I set the value of content.currentLeft to maxAvailableLeft.

I'm not sure if this problem occurs in other cases, I tested it without transform and it's normal.

Finally, thank you for your work!

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