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

boxZoom with padding #9056

Closed
kukiel opened this issue Dec 3, 2019 · 8 comments
Closed

boxZoom with padding #9056

kukiel opened this issue Dec 3, 2019 · 8 comments

Comments

@kukiel
Copy link

kukiel commented Dec 3, 2019

Motivation

I have a map that is conditionally covered by some other DOM elements depending on the current elements toggle state. I like to use boxZoom but then if some element is covering 30% of the map on the bottom it's not considered by default and the part that I zoomed in is covered by the DOM element at the bottom.

Implementation

Map object option like zoomBoxOptions (similar to fitBoundsOptions) with setter and getter that would be later considered when boxZooming would be perfect.

Edit: I was checking for any other way on how to implement that, looked like intercepting boxzoomstart/end events could be an answer, but there is no boxZoomBounds anymore to fit map to adjusted bounds. If you have other suggestions that's could potentially work that's also great.

@kkaefer
Copy link
Contributor

kkaefer commented Dec 3, 2019

This sounds like a good addition. It looks like the underlying call to Map#fitScreenCoordinates already accepts an object that includes padding. I could see two ways of implementing this:

  • Add a padding parameter to the BoxZoomHandler's options object and a boxZoomOptions parameter to the Map object that passes the options on to the constructor, similar to how we have a fitBoundsOptions object.
  • Add a generic padding property to the Map object that gets respected for all camera operations that don't have an explicit padding property set.

Do you want to take a first stab at it?

@asheemmamoowala
Copy link
Contributor

Some portion of this will overlap with changes pending in #8638.

cc @arindam1993

@kukiel
Copy link
Author

kukiel commented Dec 3, 2019

@kkaefer I could try with first option as it seems less conflicting with other work and simpler to implement - are you ok with that?

@kkaefer
Copy link
Contributor

kkaefer commented Dec 4, 2019

Hm, @arindam1993's work in #8638 seems to enable what you're looking for as well. @arindam1993, what's the status of this PR?

@ryanhamley
Copy link
Contributor

Quick update: #8638 was unblocked recently so we may get some movement there in the near future

@andrewharvey
Copy link
Collaborator

Add a generic padding property to the Map object that gets respected for all camera operations that don't have an explicit padding property set.

I prefer this option, set it globally so you don't need to pass it for each camera operation. Then #9265 and #10169 would naturally be solved as all bounds are now for the inner view.

@andrewharvey
Copy link
Collaborator

#10386 should solve your original issue as described, although the implementation is different. With #10386 if you set a global padding, then the box zoom interaction will correctly fit to the inset bounds.

@andrewharvey
Copy link
Collaborator

I'll close this because I think it's fixed by #10386 but if I've misunderstood the issue here, just let me know.

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

5 participants