Skip to content
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

Fix empty popups #1689

Merged

Conversation

antoniocarlon
Copy link
Contributor

@antoniocarlon antoniocarlon commented Sep 14, 2020

In a map with several layers CF allows us to define different behaviors for the popups of the different layer, but in the front-end the behavior of the popups is defined by map (instead of by layer).

This PR removes the popups from the entities that show empty ones. It's not the ideal fix but the perfect fix would force us to revisit the Map and Layer models (and maybe the Feature one, not sure...).

For now this PR should be harmless because it only removes completely empty popups (if the popup shows the name of the feld it won't be removed), and it works for both hover and click popups

Copy link
Member

@Jesus89 Jesus89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Note: we could check if (popupHTML) to avoid setting LngLat and HTML to the popup. But it's OK as it is.

@@ -51,7 +51,7 @@ export function updatePopup(map, popup, event, attrs) {
.setLngLat([event.coordinates.lng, event.coordinates.lat])
.setHTML(`<div class="popup-content">${popupHTML}</div>`);

if (!popup.isOpen()) {
if (popupHTML.length > 0 && !popup.isOpen()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (popupHTML should be enough. But it's OK.

@antoniocarlon antoniocarlon merged commit 8cf53f6 into develop Sep 18, 2020
@antoniocarlon antoniocarlon deleted the bug/ch100627/nikhita-stord-blank-popups-showing-for-a branch September 18, 2020 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants