Skip to content

Commit

Permalink
Remove markers from internal cache #72
Browse files Browse the repository at this point in the history
  • Loading branch information
EddyVerbruggen committed Jan 18, 2017
1 parent 90e6c2d commit e645bf7
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions mapbox.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,16 @@ 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 (ids) {
mapbox._markers = mapbox._markers.filter(function (marker) {
return ids.indexOf(marker.id) < 0;
});
} else {
mapbox._markers = [];
}

if (markersToRemove.length > 0) {
theMap.removeAnnotations(markersToRemove);
}
Expand Down

0 comments on commit e645bf7

Please sign in to comment.