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.
This commit is contained in:
Andreas Hocevar
2015-07-31 10:09:16 +02:00
parent d4d3555a88
commit da3d8952da
2 changed files with 1 additions and 6 deletions

View File

@@ -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,