From b778e864eab7f687a3348cc48e7f52ad93a8286b Mon Sep 17 00:00:00 2001 From: Alexander Vakrilov Date: Mon, 16 Jan 2017 15:03:23 +0200 Subject: [PATCH] Remove markers from internal cache resolves #71 --- mapbox.ios.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mapbox.ios.js b/mapbox.ios.js index 31bf9e4..7b5e6fa 100755 --- a/mapbox.ios.js +++ b/mapbox.ios.js @@ -218,6 +218,12 @@ mapbox.removeMarkers = function (ids, nativeMap) { markersToRemove.push(marker.ios); } } + + // remove markers from cache + mapbox._markers = mapbox._markers.filter(function (marker) { + return ids.indexOf(marker.id) < 0; + }) + if (markersToRemove.length > 0) { theMap.removeAnnotations(markersToRemove); } @@ -873,4 +879,4 @@ var MGLMapViewDelegateImpl = (function (_super) { return MGLMapViewDelegateImpl; })(NSObject); -module.exports = mapbox; \ No newline at end of file +module.exports = mapbox;