add button to clear route

This commit is contained in:
Norbert Renner 2015-04-04 14:58:02 +02:00
parent 1bd2eb0082
commit 75b771e2a9
4 changed files with 31 additions and 3 deletions

View file

@ -96,7 +96,11 @@ BR.Routing = L.Routing.extend({
}
,clear: function() {
var drawEnabled = this._draw._enabled;
var current = this._waypoints._first;
this._draw.disable();
if (current === null) { return; }
this._removeMarkerEvents(current);
while (current._routing.nextMarker) {
@ -109,6 +113,10 @@ BR.Routing = L.Routing.extend({
this._waypoints._last = null;
this._waypoints.clearLayers();
this._segments.clearLayers();
if (drawEnabled) {
this._draw.enable();
}
}
,setWaypoints: function(latLngs, cb) {