-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Geocoder search highlight race condition #63
Comments
To replicate this issue:
When first going to France, geocoder result Going back to France, geocoder result |
Part of the problem comes from the call There is an event |
Alright, apparently
From the docs of
|
Add a callback to the fitbounds function that subscribes to a 'moveend' event so that after the animation move has occurred we then update the highlighting. Also using the bounding box for searching to get more returned features, and then looking to match the geocoded result name to the feature name to properly highlight. This was an initial fix to the problem that might not be necessary anymore. We could probably go back to using the center location of the geocoding result to get the proper feature to highlight.
It looks like using the There's also this interest about returning promises for all async map functions: mapbox/mapbox-gl-js#3964 |
Also using the bounding box for searching to get more returned features, and then looking to match the geocoded result name to the feature name to properly highlight. This was an initial fix to the problem that might not be necessary anymore. We could probably go back to using the center location of the geocoding result to get the proper feature to highlight. |
Is #36 a duplicate of this issue? |
This should be fixed. |
In prep for a demo @lmandle discovered a bug where the geocoder focus doesn’t highlight boundaries correctly all the time. This is because
map.project()
can return different pixel coordinates depending on the center of the map.See mapbox github issue for more details:
mapbox/mapbox-gl-js#10138
Could a possible solution be to query the bounding box and then check the name against the layers queried?
T.E. 1-3 days
The text was updated successfully, but these errors were encountered: