Close popup when map is moved
This commit is contained in:
+4
-4
@@ -79,11 +79,11 @@ map.on('click', function (evt) {
|
|||||||
|
|
||||||
// change mouse cursor when over marker
|
// change mouse cursor when over marker
|
||||||
map.on('pointermove', function (e) {
|
map.on('pointermove', function (e) {
|
||||||
if (e.dragging) {
|
|
||||||
$(element).popover('dispose');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const pixel = map.getEventPixel(e.originalEvent);
|
const pixel = map.getEventPixel(e.originalEvent);
|
||||||
const hit = map.hasFeatureAtPixel(pixel);
|
const hit = map.hasFeatureAtPixel(pixel);
|
||||||
map.getTarget().style.cursor = hit ? 'pointer' : '';
|
map.getTarget().style.cursor = hit ? 'pointer' : '';
|
||||||
});
|
});
|
||||||
|
// Close the popup when the map is moved
|
||||||
|
map.on('movestart', function () {
|
||||||
|
$(element).popover('dispose');
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user