-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce padding for popup #12708
base: main
Are you sure you want to change the base?
Introduce padding for popup #12708
Conversation
Hey @mourner, is there a chance that this PR will be reviewed by someone from mapbox? |
Nice, thanks for the contribution @sienki-jenki! 👏 🙇 This seems reasonable to me. Just checking, how do you think this compares to modifying popups to respect global map padding (which affects the map vanishing point) instead of adding separate padding for the popup specifically? The advantage of your approach is maximum configurability; the advantage of the alternative is to improve popup behavior even for people who don't specifically opt-in and also falls gently on the side of avoiding an ever-growing list of parameters where they can be avoided. Does this assumption seem reasonable, that necessary behavior wouldn't be lost if global padding and popup padding avoidance were one and the same? Just to be certain, I double checked and it seems this does not currently nudge the popup to avoid padding: map.once('load', () => {
map.jumpTo({padding: {top: 100, right: 100, left: 100, bottom: 100}})
map.showPadding = true
}) |
Hey @rreusser, thanks for suggestion. Yes that makes sense, I've applied changes regarding padding - but I also noticed one flaw in current logic that I patched up, to be exact I'm talking about behaviour of anchor when popup is on either side of the screen. Even when anchor was Before: before.movAfter: after.mov |
@rreusser Actually in such way that |
Hey, In my app there are HTML elements overlayed on top of map container -
Popup
of course does not respect them and hides below them.In this PR I introduced optional padding for
Popup
class so popup anchor is not calculated only based on map container dimensions but also takes given padding into consideration.Before:
popup-without-padding.mov
After:
popup-with-padding.mov
@mapbox
Launch Checklist
@mapbox/map-design-team
@mapbox/static-apis
if this PR includes style spec API or visual changes@mapbox/gl-native
if this PR includes shader changes or needs a native portmapbox-gl-js
changelog:<changelog>Introduce padding to Popup</changelog>