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

Stable mousewheel scrolling, one wheel up then one wheel down should go back to same zoom #1131

Merged
merged 1 commit into from
Aug 24, 2021

Conversation

adamburgess
Copy link
Contributor

@adamburgess adamburgess commented Aug 23, 2021

I like to zoom in and out on the images, but I've noticed that zooming out after zooming in doesn't go back to where you came from.
i.e., one click of the wheel to zoom in, then one click to zoom out should be the same zoom, yet it isn't.

This is because currently zooming in scales by 0.66666 and zooming out scales by 1.33333 (depends on mouse/OS settings I presume, but for me that's what it is, 100 pixels).

Current behaviour:
100% -> zoom in -> 133% -> zoom out -> 89% 😬 -> zoom in -> 119% 😬

One method to fix this would be to have one multiplier for zooming in and use the inverse (1/multiplier) for zooming out.
I do that in this PR.

This PR's behaviour:
100% -> zoom in -> 133% -> zoom out -> 100% 👌 -> zoom in 133% etc

Another method would be to have more fixed increments instead of relying on a multiplier, for example:
100, 125, 150, 200, 300, 400, 600, 800, 1000 (... not sure what comes next)
100, 75, 66, 50, 33, 25, 10, 5, 2
Those values sound sensible to me.
At the end of the day, as long as I can zoom in 3 times, then zoom out 3 times, and end back where I started, I'm happy :)

@google-cla google-cla bot added the CLA: Yes label Aug 23, 2021
Copy link
Collaborator

@jakearchibald jakearchibald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thank you

@jakearchibald jakearchibald merged commit b74788e into GoogleChromeLabs:dev Aug 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants