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

Calling map.easeTo() after map.fitBounds() with a padding does not preserve the padding #9643

Closed
waissbluth opened this issue Apr 29, 2020 · 1 comment

Comments

@waissbluth
Copy link

Hello,

As I was trying to work around issue #9641 by using map.easeTo() instead of map.fitBounds(), I encountered that easeTo applies an additional padding if fitBounds was already called with a padding from the same side. I was expecting easeTo to respect the original padding that was passed to fitBounds, but that does not seem to be the case.

mapbox-gl-js version: v.10.0

browser: Chome for Mac 81.0.4044.113

Steps to Trigger Behavior

  1. call map.fitBounds(bbox, {padding: {top: 100})
  2. call map.easeTo({padding: {top: 100, left: 100})

Link to Demonstration

https://jsfiddle.net/xqc2br59/

Expected Behavior

To have the bounding box be centered on the screen with 100px at the top.

Actual Behavior

The bounding box has a 200px padding at the top.

@arindam1993
Copy link
Contributor

arindam1993 commented Apr 29, 2020

Hi @waissbluth , I agree that this is confusing, but FWIW its actually intended behaviour and a sideffect of introducing two different concepts with the same name. Theres a lot more context in
#4268 and #8638 but I'll provide short summary here.

PaddingOptions

In your case the first call to fitBounds is updating the zoom and center to account for padding, and then you add additional fov based padding on top with the call to easeTo.

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