Add beeline support to distance markers
- update on beeline toggle - avoid distance markers wandering accross the map while routing many waypoints, because beelines are added immediately, by turning off updates in-between
This commit is contained in:
parent
7118cc70d7
commit
fe05081678
1 changed files with 28 additions and 5 deletions
|
|
@ -54,13 +54,36 @@ BR.Routing = L.Routing.extend({
|
||||||
|
|
||||||
this._waypoints.on('layeradd', this._setMarkerOpacity, this);
|
this._waypoints.on('layeradd', this._setMarkerOpacity, this);
|
||||||
|
|
||||||
this.on('routing:routeWaypointStart routing:rerouteAllSegmentsStart', function (evt) {
|
// flag if (re-)routing of all segments is ongoing
|
||||||
this._removeDistanceMarkers();
|
this._routingAll = false;
|
||||||
|
this.on('routing:rerouteAllSegmentsStart routing:setWaypointsStart', function (evt) {
|
||||||
|
this._routingAll = true;
|
||||||
|
});
|
||||||
|
this.on('routing:rerouteAllSegmentsEnd routing:setWaypointsEnd', function (evt) {
|
||||||
|
this._routingAll = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.on('routing:routeWaypointEnd routing:setWaypointsEnd routing:rerouteAllSegmentsEnd', function (evt) {
|
this.on(
|
||||||
|
'routing:routeWaypointStart routing:rerouteAllSegmentsStart routing:rerouteSegmentStart',
|
||||||
|
function (evt) {
|
||||||
|
if (!this._routingAll || evt.type === 'routing:rerouteAllSegmentsStart') {
|
||||||
|
this._removeDistanceMarkers();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
this.on(
|
||||||
|
'routing:routeWaypointEnd routing:setWaypointsEnd routing:rerouteAllSegmentsEnd routing:rerouteSegmentEnd',
|
||||||
|
function (evt) {
|
||||||
|
if (
|
||||||
|
!this._routingAll ||
|
||||||
|
evt.type === 'routing:rerouteAllSegmentsEnd' ||
|
||||||
|
evt.type === 'routing:setWaypointsEnd'
|
||||||
|
) {
|
||||||
this._updateDistanceMarkers(evt);
|
this._updateDistanceMarkers(evt);
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
// turn line mouse marker off while over waypoint marker
|
// turn line mouse marker off while over waypoint marker
|
||||||
this.on(
|
this.on(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue