[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.
This commit is contained in:
Mikhail Pozdnyakov
2020-01-23 20:11:24 +02:00
parent 391a5642e0
commit 951b90c778
2 changed files with 4 additions and 9 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 158 KiB

After

Width:  |  Height:  |  Size: 155 KiB

View File

@@ -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,