Skip to content

support fitBounds options when setting the initial map bounds #7553

Closed

Description

@andrewharvey

Support for initial bounds as map constructor option was added in #5518, internally it uses fitBounds but it doesn't expose the fitBounds options padding, offset, maxZoom.

We could add a bounds_options option, but that just feels too complicated so I'm against it.

I think the best solution here will come out of #2801, which will likely open up a simpler approach to passing the initial camera state for the Map as a single object.

Activity

  1. andrewharvey commented on Nov 4, 2018

    @andrewharvey
    CollaboratorAuthor

    One possible workaround is to set the bounds without additional fitBounds options as a Map option to get it close enough at initialisation, and then immediately call map.fitBounds with the same bounds but with additional options.

    This does seem to happen fast enough that no tile requests are actually made for the original bounds with no options, only tile requests for the fitBounds with options. Given this, I'd say this issue is low priority since it would really only help to reduce roadblocks for developers who face similar issues.

  2. pathmapper commented on Nov 17, 2018

    @pathmapper
    Contributor

    Such a bounds padding option was requested in this stackoverflow comment.

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