Improve route interactivity by using canvas
This commit is contained in:
parent
2cd233f70d
commit
47f3a06be6
3 changed files with 16 additions and 1 deletions
|
|
@ -63,6 +63,16 @@ BR.Heightgraph = function (map, layersControl, routing, pois) {
|
|||
},
|
||||
},
|
||||
|
||||
onAdd(map) {
|
||||
// As we're using canvas, initialize an `svg` root that is needed for map marker,
|
||||
// see `Heightgraph._showMapMarker`
|
||||
if (!document.querySelector('.leaflet-overlay-pane svg')) {
|
||||
L.svg().addTo(map);
|
||||
}
|
||||
|
||||
return L.Control.Heightgraph.prototype.onAdd.call(this, map);
|
||||
},
|
||||
|
||||
addBelow: function (map) {
|
||||
// waiting for https://github.com/MrMufflon/Leaflet.Elevation/pull/66
|
||||
// this.width($('#map').outerWidth());
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ BR.Routing = L.Routing.extend({
|
|||
_addSegmentCasing: function (e) {
|
||||
// extend layer style to inherit beeline dashArray
|
||||
const casingStyle = Object.assign({}, e.layer.options, this.options.styles.trackCasing);
|
||||
const casing = L.polyline(e.layer.getLatLngs(), casingStyle);
|
||||
const casing = L.polyline(e.layer.getLatLngs(), Object.assign({}, casingStyle, { interactive: false }));
|
||||
this._segmentsCasing.addLayer(casing);
|
||||
e.layer._casing = casing;
|
||||
this._segments.bringToFront();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue