Popup works again.
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Sat, 2 Jan 2021 14:21:33 +0000 (15:21 +0100)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Sat, 2 Jan 2021 14:21:33 +0000 (15:21 +0100)
wrmap.js

index 72d48ad1b9bb1403efb5c7b16b8b24598d62aa80..878b70982faa1cec46f186d855b6d901e2ca8a63 100644 (file)
--- a/wrmap.js
+++ b/wrmap.js
@@ -384,8 +384,12 @@ function init_wrmap(i, jq_map) {
        });
        map.addInteraction(select_click);
        select_click.on('select', function(event) {
-               popup_content.innerHTML = '<p>You clicked</p>';
-               popup_overlay.setPosition(event.coordinate);
+               if (event.selected.length > 0) {
+                       let feature = event.selected[0];
+                       let coordinates = feature.getGeometry().getCoordinates();
+                       popup_content.innerHTML = '<p>You clicked</p>';
+                       popup_overlay.setPosition(coordinates);
+               }
        });
 
        /*