Skip to content

dynamic popup anchor with a non bottom preference #6965

@andrewharvey

Description

@andrewharvey

The Popup anchor option is documented as

A string indicating the part of the Popup that should be positioned closest to the coordinate set via Popup#setLngLat . Options are 'center' , 'top' , 'bottom' , 'left' , 'right' , 'top-left' , 'top-right' , 'bottom-left' , and 'bottom-right' . If unset the anchor will be dynamically set to ensure the popup falls within the map container with a preference for 'bottom' .

I'd like to retain the dynamic feature to ensure the popup doesn't fall off the map, while setting a preference other than bottom.

I think the best solution is to change the definition of the anchor option to be the preferred anchor and introduce a new fixedAnchor option to tell if you want it to avoid falling of the map or not.

This is a backwards incompatible change, but I think any change made in a backwards compatible way would introduce to much complexity to the API (for example leaving anchor as is and adding a new anchorPreference option).

I don't mind trying to do a PR, but what do people think about this breaking change?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions