Skip to content

Allow each edge to have different padding when fitting to bounds #1339

Closed

Description

@1ec5

Camera.prototype.fitBounds() accepts padding and offset options for adding slop area (in pixels) around the fitted bounds. In mapbox/mapbox-gl-native#1783, I’m instead allowing each side of the bounds to have a different padding amount. It would be great to have this in gl-js as well.

Independent edge padding is necessary on iOS, because it’s customary to include about 32 points of top padding to make room for a translucent top bar overlay. In gl-js, it isn’t possible to express this behavior with a combination of padding and offset: you don’t want any padding to be added in the horizontal direction.

Activity

  1. jfirebaugh commented on Dec 4, 2015

    @jfirebaugh
    Contributor

    Added in #1675.

  2. benmcginnis commented on Dec 29, 2016

    @benmcginnis

    Any chance of this happening?

  3. mohsen1 commented on Dec 31, 2016

    @mohsen1

    This is blocking us from using MapBox GL. I submitted #3876 to resolve another blocker :)

  4. mollymerp commented on Jan 3, 2017

    @mollymerp
    Contributor

    @benjamintd @mohsen1 picking this up today -- I'll see what we can do!

  5. andrewharvey commented on Feb 9, 2017

    @andrewharvey
    Collaborator

    https://www.mapbox.com/mapbox-gl-js/example/mapbox-gl-directions/ is a good example of how it could be used. So that the fitBounds for the route ensure that the route fills the space to the right of the controls/instructions.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions