mapbox / mapbox-directions.js

Leaflet plugin for the Mapbox Directions API
https://www.mapbox.com/mapbox.js/example/v1.0.0/mapbox-directions/
ISC License
60 stars 23 forks source link

Dragging a route not working anymore #112

Open mheigl opened 7 years ago

mheigl commented 7 years ago

Hi!

I noticed that dragging a route throws a JS error as in layer.js in line 291 this._routePolyline()._originalPoints; is undefined.

It seems that _originalPoints is not available anymore in newer Leaflet versions. I was able to fix it by converting the latlngs:

var positions = this._routePolyline()._latlngs;

for (var j = 0; j < positions.length; j++) {
    positions[j] = this._map.latLngToLayerPoint(positions[j]);
}

Best regards, Michael