Show position in elevation diagram when hovering path on map, closes #29
This commit is contained in:
parent
83ce7ff79a
commit
42d04e52c2
2 changed files with 22 additions and 4 deletions
|
|
@ -21,10 +21,9 @@ BR.Elevation = L.Control.Elevation.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
if (track && track.getLatLngs().length > 0) {
|
if (track && track.getLatLngs().length > 0) {
|
||||||
// TODO disabled track layer mouseover, as it doesn't really work
|
this.addData(track.toGeoJSON(), layer);
|
||||||
// with line marker and indicator does not get removed (no mouseout?)
|
|
||||||
//this.addData(track.toGeoJSON(), layer);
|
layer.on("mouseout", this._hidePositionMarker.bind(this));
|
||||||
this.addData(track.toGeoJSON());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -51,6 +51,25 @@ BR.Routing = L.Routing.extend({
|
||||||
,iconSize: [16, 16]
|
,iconSize: [16, 16]
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
// Forward mousemove event to snapped feature (for Leaflet.Elevation to
|
||||||
|
// update indicator), see also L.Routing.Edit._segmentOnMousemove
|
||||||
|
this._edit._mouseMarker.on('move', L.bind(function(e) {
|
||||||
|
var latLng = e.latlng;
|
||||||
|
if (latLng._feature) {
|
||||||
|
this._mouseMarker._feature = latLng._feature;
|
||||||
|
latLng._feature.fire('mousemove', e);
|
||||||
|
}
|
||||||
|
}, this._edit));
|
||||||
|
var mouseoutHandler = function(e) {
|
||||||
|
if (this._mouseMarker._feature) {
|
||||||
|
this._mouseMarker._feature.fire('mouseout', e);
|
||||||
|
this._mouseMarker._feature = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this._edit.on('segment:mouseout', mouseoutHandler, this._edit);
|
||||||
|
this._edit._mouseMarker.on('dragstart', mouseoutHandler, this._edit);
|
||||||
|
this.on('waypoint:mouseover', mouseoutHandler, this._edit);
|
||||||
|
|
||||||
this._draw.on('enabled', function() {
|
this._draw.on('enabled', function() {
|
||||||
// crosshair cursor
|
// crosshair cursor
|
||||||
L.DomUtil.addClass(map.getContainer(), 'routing-draw-enabled');
|
L.DomUtil.addClass(map.getContainer(), 'routing-draw-enabled');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue