From da3d8952da1b96ab1c6b782148baee456b8a440d Mon Sep 17 00:00:00 2001 From: Andreas Hocevar Date: Fri, 31 Jul 2015 10:09:16 +0200 Subject: [PATCH] Simplify icon example and show popup at clicked position By using the event's coordinate instead of the feature's, we make sure that the popup is shown where the user clicked when on a wrapped world. --- examples/icon.css | 3 --- examples/icon.js | 4 +--- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/examples/icon.css b/examples/icon.css index 3881884e22..f25b6b7d33 100644 --- a/examples/icon.css +++ b/examples/icon.css @@ -1,6 +1,3 @@ #map { position: relative; } -#popup { - padding-bottom: 45px; -} \ No newline at end of file diff --git a/examples/icon.js b/examples/icon.js index 0ec6f9baba..5ef4099a7c 100644 --- a/examples/icon.js +++ b/examples/icon.js @@ -71,9 +71,7 @@ map.on('click', function(evt) { return feature; }); if (feature) { - var geometry = feature.getGeometry(); - var coord = geometry.getCoordinates(); - popup.setPosition(coord); + popup.setPosition(evt.coordinate); $(element).popover({ 'placement': 'top', 'html': true,