Skip to content

Introduce padding for Popup #5978

@maciejmatu

Description

@maciejmatu

User Story

As a user I can pass popupPadding config to Popup so that I can limit it's positioning with custom bounds

Rationale

There was a similar feature request made in mapbox in the past, and I require such a feature in my application. Implementing something like that using current maplibre popups requires overriding default behaviour, and using internal functions. I managed to make it somehow work, but the code feels hacky and relies on copying the existing maplibre popup position calculations, so adding it internally would be much nicer.

Here is an example of how this functionality would work:
Current behaviour:

popup-without-padding.mov

Desired behaviour:

popup-with-padding.mov

Impact

If implemented as an additional parameter e.g. options.popupPadding strictly related to popups it does not have any impact. It would be an extension that users can use as needed. Otherwise, if we rely on existing map padding, it might change the behaviour for existing applications (which I would rather avoid)

Implementation

I'm open and happy to add this feature myself, but would like to get your opinion on that first, and if it's a wanted feature, discuss the implementation approach.

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