-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
queryRenderedSymbols does not sort features #6184
Comments
@ansis Do you know the origins of that documentation? I'm not sure what it means by "topmost rendered feature" -- it looks like the sorting is based on the order in which items are inserted into the But the recent divergence of symbol behavior from non-symbol behavior is because of the sorting here: mapbox-gl-js/src/data/bucket/symbol_bucket.js Line 635 in 859d4a9
I think we'll need to do something like store the sort indices generated there and use them for sorting the |
@ChrisLoer yep, you're right about it being similar but not always right. The tile boundary bug might have existed when it was added, or we might have changed how querying works at tile boundaries (do we index points outside of tile edges or do we do padded queries across tile boundaries). Your suggested fix sounds right |
I think I can build a good fix for this on top of PR #6497... |
Fixed in #6497. |
mapbox-gl-js version:
Steps to Trigger Behavior
on('click', layer, ...
to invokequeryRenderedFeatures
on the symbol layerExpected Behavior
e.features[0]
is the topmost rendered featured (and subsequent features are sorted in z order) permapbox-gl-js/src/ui/map.js
Lines 747 to 748 in 38c7250
Actual Behavior
e.features[0]
is not always the topmost featurelooks like we sort non-symbol features, but don't sort symbol features:
mapbox-gl-js/src/data/feature_index.js
Lines 118 to 126 in 38c7250
The text was updated successfully, but these errors were encountered: