Skip to content

Commit

Permalink
fix 动态标记图层 remove error
Browse files Browse the repository at this point in the history
  • Loading branch information
xilanhuaweidapao committed Nov 9, 2023
1 parent 88ca07b commit 518b1c6
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,13 @@ export default class AnimateMarkerLayerViewModel extends mapboxgl.Evented {
}

public removed() {
if(this.map && this.map.getLayer(this.layerId)) {
this.map.removeLayer(this.layerId);
this.map.removeSource(this.layerId);
if (this.map) {
if(this.map.getLayer(this.layerId)) {
this.map.removeLayer(this.layerId);
this.map.removeSource(this.layerId);
}
this.map.off('styledata', this.updateLayerFn);
}
this.map.off('styledata', this.updateLayerFn);
this.markers.length > 0 &&
this.markers.forEach(marker => {
marker && marker.remove();
Expand Down

0 comments on commit 518b1c6

Please sign in to comment.