diff options
author | Chris Loer <chris.loer@gmail.com> | 2018-06-26 15:05:37 -0700 |
---|---|---|
committer | Chris Loer <chris.loer@mapbox.com> | 2018-07-03 15:28:00 -0700 |
commit | d734f670e8127c7600beb6dad7b7f08b1401e7c0 (patch) | |
tree | 0f37564d1c5034639bfdfb259e3f9c3a1f51be52 /src/mbgl/renderer/buckets/symbol_bucket.cpp | |
parent | cfd436c287f4209d0d994042452ccbb552a6bd28 (diff) | |
download | qtlocation-mapboxgl-d734f670e8127c7600beb6dad7b7f08b1401e7c0.tar.gz |
[core] Fix sort order for queryRenderedFeatures when features are filtered.
Fixes issue #12104.
Diffstat (limited to 'src/mbgl/renderer/buckets/symbol_bucket.cpp')
-rw-r--r-- | src/mbgl/renderer/buckets/symbol_bucket.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mbgl/renderer/buckets/symbol_bucket.cpp b/src/mbgl/renderer/buckets/symbol_bucket.cpp index 4fe03eb453..51fcd2437c 100644 --- a/src/mbgl/renderer/buckets/symbol_bucket.cpp +++ b/src/mbgl/renderer/buckets/symbol_bucket.cpp @@ -192,11 +192,11 @@ void SymbolBucket::sortFeatures(const float angle) { std::sort(symbolInstanceIndexes.begin(), symbolInstanceIndexes.end(), [sin, cos, this](size_t &aIndex, size_t &bIndex) { const SymbolInstance& a = symbolInstances[aIndex]; const SymbolInstance& b = symbolInstances[bIndex]; - const int32_t aRotated = sin * a.anchor.point.x + cos * a.anchor.point.y; - const int32_t bRotated = sin * b.anchor.point.x + cos * b.anchor.point.y; + const int32_t aRotated = static_cast<int32_t>(std::lround(sin * a.anchor.point.x + cos * a.anchor.point.y)); + const int32_t bRotated = static_cast<int32_t>(std::lround(sin * b.anchor.point.x + cos * b.anchor.point.y)); return aRotated != bRotated ? aRotated < bRotated : - a.index > b.index; + a.dataFeatureIndex > b.dataFeatureIndex; }); text.triangles.clear(); @@ -207,7 +207,7 @@ void SymbolBucket::sortFeatures(const float angle) { for (auto i : symbolInstanceIndexes) { const SymbolInstance& symbolInstance = symbolInstances[i]; - featureSortOrder->push_back(symbolInstance.featureIndex); + featureSortOrder->push_back(symbolInstance.dataFeatureIndex); if (symbolInstance.placedTextIndex) { addPlacedSymbol(text.triangles, text.placedSymbols[*symbolInstance.placedTextIndex]); |