mapbox / mapbox/mapbox-gl-directions
Origin and Destination input boxes stay opened when setOrigin/setDestination are called twice.
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 255
- Forks
- 130
- PR merge metrics
- No merged PRs in 30d
Description
Hi.
When setOrigin or setDestination are called 2 or more times input boxes stay opened, suggesting to select a location. I would like to behave as if it was initially set.
Example is here:
https://jsfiddle.net/etfg3d46/2/
Screenshot:
```
map.on('load', function() {
map.addControl(directionsControl, 'top-left');
directionsControl.setDestination("Philadelphia");
directionsControl.setOrigin("New York");
setTimeout(() => {
directionsControl.setDestination("Chicago, Illinois, United States");
}, 2500);
setTimeout(() => {
directionsControl.setOrigin("Washington");
}, 5000);
});
```
It doesn't happen when I pass coordinates, but I would like to see place names instead of numbers in input boxes.
Any workarounds to keep it closed?
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 by reproducing the issue with the linked JSFiddle and then inspect the setOrigin and setDestination entry points in the directions control. Verify repeated geocoded calls and coordinate calls separately; done means the input boxes close after repeated calls while retaining the place names.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100