fix icon example to anchor popup to feature location
This commit is contained in:
@@ -59,7 +59,8 @@ var element = document.getElementById('popup');
|
|||||||
var popup = new ol.Overlay({
|
var popup = new ol.Overlay({
|
||||||
element: element,
|
element: element,
|
||||||
positioning: 'bottom-center',
|
positioning: 'bottom-center',
|
||||||
stopEvent: false
|
stopEvent: false,
|
||||||
|
offset: [0, -50]
|
||||||
});
|
});
|
||||||
map.addOverlay(popup);
|
map.addOverlay(popup);
|
||||||
|
|
||||||
@@ -70,7 +71,8 @@ map.on('click', function(evt) {
|
|||||||
return feature;
|
return feature;
|
||||||
});
|
});
|
||||||
if (feature) {
|
if (feature) {
|
||||||
popup.setPosition(evt.coordinate);
|
var coordinates = feature.getGeometry().getCoordinates();
|
||||||
|
popup.setPosition(coordinates);
|
||||||
$(element).popover({
|
$(element).popover({
|
||||||
'placement': 'top',
|
'placement': 'top',
|
||||||
'html': true,
|
'html': true,
|
||||||
|
|||||||
Reference in New Issue
Block a user