diff options
author | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2020-01-23 20:11:24 +0200 |
---|---|---|
committer | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2020-01-27 17:51:07 +0200 |
commit | 951b90c778790fe816c4c6d1d4eb2b4980f13c2b (patch) | |
tree | 1c7f867b3b8254cde79ba3b5483c3dd067fe05ef /src | |
parent | 391a5642e0b6ce1a07debfadd7619baf5bb04c9e (diff) | |
download | qtlocation-mapboxgl-951b90c778790fe816c4c6d1d4eb2b4980f13c2b.tar.gz |
[tile mode] Fix variable symbols placement
This commit allows the variable symbols to cross the tile border only
if their anchor is the first anchor from the `text-variable-anchor` list.
Diffstat (limited to 'src')
-rw-r--r-- | src/mbgl/text/placement.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/mbgl/text/placement.cpp b/src/mbgl/text/placement.cpp index 32edf679e8..8740e4b021 100644 --- a/src/mbgl/text/placement.cpp +++ b/src/mbgl/text/placement.cpp @@ -331,9 +331,6 @@ void Placement::placeBucket(const SymbolBucket& bucket, const bool doVariableIconPlacement = hasIconTextFit && !iconAllowOverlap && symbolInstance.placedIconIndex; - - bool stickToFirstAnchor = false; - const auto placeFeatureForVariableAnchors = [&](const CollisionFeature& textCollisionFeature, style::TextWritingModeType orientation, const CollisionFeature& iconCollisionFeature) { @@ -347,8 +344,6 @@ void Placement::placeBucket(const SymbolBucket& bucket, for (size_t i = 0u; i < placementAttempts; ++i) { auto anchor = variableTextAnchors[i % anchorsSize]; const bool isFirstAnchor = (anchor == variableTextAnchors.front()); - if (stickToFirstAnchor && !isFirstAnchor) continue; - const bool allowOverlap = (i >= anchorsSize); shift = calculateVariableLayoutOffset(anchor, width, @@ -360,10 +355,10 @@ void Placement::placeBucket(const SymbolBucket& bucket, state.getBearing()); textBoxes.clear(); - if (mapMode == MapMode::Tile && isFirstAnchor) { - assert(tileBorders); - stickToFirstAnchor = collisionIndex.featureIntersectsTileBorders( - textCollisionFeature, shift, posMatrix, pixelRatio, *tileBorders); + if (mapMode == MapMode::Tile && !isFirstAnchor && + collisionIndex.featureIntersectsTileBorders( + textCollisionFeature, shift, posMatrix, pixelRatio, *tileBorders)) { + continue; } placedFeature = collisionIndex.placeFeature(textCollisionFeature, |