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

Add ability to specify location to zoom into on the zoom module's in() function #7307

Open
4 tasks done
broox opened this issue Feb 10, 2024 · 2 comments
Open
4 tasks done

Comments

@broox
Copy link
Contributor

broox commented Feb 10, 2024

Clear and concise description of the problem

Currently, the zoom module's in() function allows a ratio parameter to be passed. It would be nice if we could also specify a position to zoom into. This would allow developers to implement custom functionality to be able to zoom in to a specific point of the image, rather than just the center.

Suggested solution

In the zoom module, add an optional position parameter to the in() function. This parameter could be a set of pixel coordinates on the image to zoom toward.

For example, we could call slider.in(2, [100,100]) to zoom an image by 2x and target the center to be on or around 100px from the left and 100px from the top of the image.

Alternative

No response

Additional context

No response

Validations

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

Would you like to open a PR for this feature?

  • I'm willing to open a PR
@jgoldfuss
Copy link

Agreed. Mine is not always zooming round the center of the image but I can not determine what it is using for the zoom center. It seems to vary but I haven't yet figure out what its' using to make the determination of center

@broox
Copy link
Contributor Author

broox commented Dec 22, 2024

In case it's helpful to anyone else, you can pass a mouse event into the zoom.in() function and it will zoom to where you clicked on the image. Not quite the same as what's requested here, but also helpful.

With the way the current zoomIn() function is implemented, it would probably be best to have a new function to support the issue request. Otherwise, the changes will likely be breaking and/or confusing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants