From d734f670e8127c7600beb6dad7b7f08b1401e7c0 Mon Sep 17 00:00:00 2001 From: Chris Loer Date: Tue, 26 Jun 2018 15:05:37 -0700 Subject: [core] Fix sort order for queryRenderedFeatures when features are filtered. Fixes issue #12104. --- src/mbgl/renderer/buckets/symbol_bucket.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/mbgl/renderer/buckets') 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(std::lround(sin * a.anchor.point.x + cos * a.anchor.point.y)); + const int32_t bRotated = static_cast(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]); -- cgit v1.2.1