Only show popups if they are not empty.
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Sat, 2 Jan 2021 16:34:28 +0000 (17:34 +0100)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Sat, 2 Jan 2021 16:34:28 +0000 (17:34 +0100)
wrmap.js

index 40c5773a18b9167fc923fdfaa4948ee0140db1f0..af6f13656a903617fb33bbcc9169ceeb140a6331 100644 (file)
--- a/wrmap.js
+++ b/wrmap.js
@@ -376,8 +376,10 @@ function init_wrmap(i, jq_map) {
                        let feature = event.selected[0];
                        let coordinates = feature.getGeometry().getCoordinates();
                        let popup_dom = create_popup_dom(feature);
                        let feature = event.selected[0];
                        let coordinates = feature.getGeometry().getCoordinates();
                        let popup_dom = create_popup_dom(feature);
-                       $(popup_content).empty().append(popup_dom);
-                       popup_overlay.setPosition(coordinates);
+                       if (popup_dom.children().length > 0) {
+                               $(popup_content).empty().append(popup_dom);
+                               popup_overlay.setPosition(coordinates);
+                       }
                }
        });
 }
                }
        });
 }