mapbox-gl-directions
mapbox-gl-directions copied to clipboard
.setOrigin() and .setDestination() only works when you set both
.setOrigin() and .setDestination() only works when you set both.
Example of it working: https://jsfiddle.net/0u0zfku4/
Doesn't plot when only setting one location: Commented out setOrigin on line 67 https://jsfiddle.net/0u0zfku4/1/
Thanks for reporting your issue @Targun and for providing a minimal test case. Can you update to the most recent version (3.1.1) to ensure this is still an issue? Thanks!
Thanks for the follow up @mollymerp
I updated the fiddle with v3.1.1, and still seeing the same problem: https://jsfiddle.net/0u0zfku4/2/
Hope this helps. No rush for a fix on my end
If map.addControl(mapDirections, 'top-left');
is moved outside the callback function it works:
https://jsfiddle.net/0u0zfku4/28/