Skip to content
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

Return 3d features first from queryRenderedFeatures #7926

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/style/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,7 @@ class Style extends Evented {
}

_flattenAndSortRenderedFeatures(sourceResults: Array<any>) {
const result = [];
const features = [];
const features3D = [];
for (let l = this._order.length - 1; l >= 0; l--) {
Expand All @@ -966,10 +967,14 @@ class Style extends Evented {
});

for (const featureWrapper of features3D) {
features.push(featureWrapper.feature);
result.push(featureWrapper.feature);
}

return features;
for (const feature of features) {
result.push(feature);
}

return result;
}

queryRenderedFeatures(queryGeometry: any, params: any, transform: Transform) {
Expand Down
4 changes: 2 additions & 2 deletions src/ui/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -825,8 +825,8 @@ class Map extends Camera {
* contribution to the rendered result; for example, because the layer's opacity or color alpha component is set to
* 0.
*
* The topmost rendered feature appears first in the returned array, and subsequent features are sorted by
* descending z-order. Features that are rendered multiple times (due to wrapping across the antimeridian at low
* `fill-extrusion` features will appear first in the returned array, sorted by depth. Subsequent features are sorted by
* descending layer order. Features that are rendered multiple times (due to wrapping across the antimeridian at low
* zoom levels) are returned only once (though subject to the following caveat).
*
* Because features come from tiled vector data or GeoJSON data that is converted to tiles internally, feature
Expand Down