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

Feature Request: Add functions for centering and zooming on elements #413

Open
ajdubovoy opened this issue Jan 12, 2022 · 1 comment
Open

Comments

@ajdubovoy
Copy link

Hi folks, I really love this package, so thanks for your awesome work! It's been particularly useful for implementing SVG maps.

Two functions I've needed have been something like:

  1. centerOn({ x, y }) pans to center the map on a certain point. Basically the same thing as the existing pan function but centering that point in the viewport, instead of locating it at the top left.
  2. zoomToEl(el) zoom to fit and center an element in the viewport, via its bounding box

I've been able to implement this on my own perfectly fine. But it'd, of course, be more elegant as part of the API on a panzoom instance.

I was wondering, if these functions are relevant for others, if it makes sense to add to the API? I'd be potentially able to help with that.

Thanks so much!

@ajdubovoy ajdubovoy changed the title Add functions for centering and zooming on elements Feature Request: Add functions for centering and zooming on elements Jan 12, 2022
@Iftahh
Copy link

Iftahh commented Jan 20, 2022

See this: #381

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

2 participants