-
-
Notifications
You must be signed in to change notification settings - Fork 727
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
Allow setting opacity of popup when behind surface #5079
Comments
Thanks for taking the time to report this. |
The current logic for both terrain and globe view is that the marker get the relevant opacity and the popup that is assigned to it gets closed in case of occlusion. So I think that in case you would like to have something react to the globe you should you a marker instead of a popup, will this solve your issue? |
BTW, as a work around, you can do the following (this uses internal knowledge of how things are build, so this shouldn't be used as is if you don't want it to break in the future): map.on('move', () => {
if (map.transform.isLocationOccluded(popup.getLngLat())) {
popup._container.style.opacity = "0.2";
} else {
popup._container.style.opacity = "1";
}
}); |
Thanks for the workaround! I've never used marker before so I'm not exactly sure what's the difference, marker is an icon on map that will react to click and spawn new popup anchored to it? Where popup is just a standalone HTML container? Nevertheless, wouldn't hiding popup behind the globe be nice addition to popup logic? (maybe allow to opt out of such logic if for whatever reason someone would like to render popup when it's behind the globe) WDYT |
A marker can be any HTML element you might need. |
maplibre-gl-js version: 5.0.0-pre.6
browser: Google chrome Version 130.0.6723.117 (Official Build) (arm64)
Steps to Trigger Behaviour
Link to Demonstration
https://jsbin.com/xihuyikuxo/3/edit?html,css,output
Expected Behaviour
Popup is hidden when its behind the globe (?) Maybe it's a conscious decision that it shouldn't be hidden, but maybe adding some boolean value to popup config indicating if popup should respect globe (should hide) would be nice addition?
The text was updated successfully, but these errors were encountered: