HandyImage icon indicating copy to clipboard operation
HandyImage copied to clipboard

[Help Wanted] - Proper zoom focus function on mouse click for scrollTo()

Open Owyn opened this issue 3 years ago • 0 comments

https://github.com/Owyn/HandyImage/blob/master/HandyImage.user.js#L2954

Basically we can get new image scale by dividing old image height by new image height and then multiply mouse click coordinates with it but then we have to subtract something (divided by 2?) to have correct coordinates for window.scrollTo() so it'd keep our focus on now resized image when:

  • you left \ middle click on a smaller than window image - to zoom in
  • you left \ middle click on a much bigger than window image - to zoom out
  • you left on a much bigger than window image previously middle clicked to fill the screen - to zoom out etc

if you know - help with a PR, would be very appreciated

Owyn avatar Dec 13 '21 15:12 Owyn