From b1154d8239000ea2593285e9ead9b7920653289d Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <Jacek@jacekk.info>
Date: Fri, 14 Apr 2017 18:23:22 +0000
Subject: [PATCH] Remove popup when removing associated element from map

---
 map.html |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/map.html b/map.html
index adee5e9..4970c5e 100644
--- a/map.html
+++ b/map.html
@@ -140,11 +140,9 @@
 
 	// change mouse cursor when over marker
 	map.on('pointermove', function(e) {
-		var pixel = map.getEventPixel(e.originalEvent);
-		var hit = map.hasFeatureAtPixel(pixel);
-		var target = map.getTarget();
-		if(target.style)
-			target.style.cursor = hit ? 'pointer' : '';
+		var hit = map.hasFeatureAtPixel(e.pixel);
+		var target = map.getTargetElement();
+		target.style.cursor = hit ? 'pointer' : '';
 	});
 }
 
@@ -167,6 +165,9 @@
 			if(vehicle.isDeleted) {
 				if(vehicle_feature) {
 					vehicles_source.removeFeature(vehicle_feature);
+					if(popup_feature_id == vehicle.id) {
+						popupHide();
+					}
 				}
 				continue;
 			}

--
Gitblit v1.9.1