Skip to content

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

@waissbluth

Description

@waissbluth

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions