Skip to content

Commit 43f47db

Browse files
authored
Merge pull request #320 from geostarters/remove-alternatives
Remove alternatives from map when control is removed.
2 parents 35a4a9e + 666d493 commit 43f47db

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/L.Routing.Control.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@
9292
map.removeLayer(this._line);
9393
}
9494
map.removeLayer(this._plan);
95+
if (this._alternatives && this._alternatives.length > 0) {
96+
for (var i = 0, len = this._alternatives.length; i < len; i++) {
97+
map.removeLayer(this._alternatives[i]);
98+
}
99+
}
95100
return L.Routing.Itinerary.prototype.onRemove.call(this, map);
96101
},
97102

0 commit comments

Comments
 (0)