summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2020-04-07 14:35:40 +0300
committerMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2020-04-08 11:19:37 +0300
commitfd218daa00f3643522c58ec1bc29a81860e0d157 (patch)
tree48c324006c727a849909e69d6ce525a700e6ca4a
parent88337c23f7abd71a8a12401b2e24312f32846634 (diff)
downloadqtlocation-mapboxgl-fd218daa00f3643522c58ec1bc29a81860e0d157.tar.gz
[core][tile mode] Fix placement mismatch for the labels with same geomerty
-rw-r--r--src/mbgl/text/placement.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/mbgl/text/placement.cpp b/src/mbgl/text/placement.cpp
index fa7436cfcc..f33c6885d9 100644
--- a/src/mbgl/text/placement.cpp
+++ b/src/mbgl/text/placement.cpp
@@ -1303,8 +1303,15 @@ void TilePlacement::placeLayers(const RenderLayerReferences& layers) {
if (a.status.minSectionLength != b.status.minSectionLength) {
return a.status.minSectionLength > b.status.minSectionLength;
}
- // Finally, look at Y position.
- return a.symbol.get().anchor.point.y < b.symbol.get().anchor.point.y;
+ // Look at the anchor coordinates
+ if (a.symbol.get().anchor.point.y != b.symbol.get().anchor.point.y) {
+ return a.symbol.get().anchor.point.y < b.symbol.get().anchor.point.y;
+ }
+ if (a.symbol.get().anchor.point.x != b.symbol.get().anchor.point.x) {
+ return a.symbol.get().anchor.point.x < b.symbol.get().anchor.point.x;
+ }
+ // Finally, looking at the key hashes.
+ return std::hash<std::u16string>()(a.symbol.get().key) < std::hash<std::u16string>()(b.symbol.get().key);
});
// Place intersections.
for (const auto& intersection : intersections) {