mapbox / mapbox/mapbox-directions.js
Dragging a route not working anymore
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 58
- Forks
- 21
- PR merge metrics
- No merged PRs in 30d
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in layer.js at line 291 and inspect how the route polyline is used during dragging. Compare the unavailable _originalPoints access with the route polyline's _latlngs and verify that dragging a route no longer throws the reported JavaScript error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100