Skip to content

Commit ec4d110

Browse files
author
Nathan Mahdavi
committed
plotted lines weren't being completely removed when removeLayer was called. Fixes #2
1 parent d70aef7 commit ec4d110

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

dist/leaflet.plotter.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/leaflet.plotter.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@ L.Polyline.plotter = L.Polyline.extend({
2020
this._bindMapClick();
2121
}
2222
},
23+
onRemove: function(){
24+
for(index in this._halfwayPointMarkers){
25+
this._map.removeLayer(this._halfwayPointMarkers[index]);
26+
}
27+
for(index in this._lineMarkers){
28+
this._map.removeLayer(this._lineMarkers[index]);
29+
}
30+
this._halfwayPointMarkers = this._lineMarkers = [];
31+
this._unbindMapClick();
32+
L.Polyline.prototype.onRemove.call(this, map);
33+
},
2334
setLatLngs: function(latlngs){
2435
L.Polyline.prototype.setLatLngs.call(this, latlngs);
2536
},

0 commit comments

Comments
 (0)