Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[tile mode] Fix variable symbols placement #16141

Merged
merged 1 commit into from
Jan 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 4 additions & 9 deletions src/mbgl/text/placement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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,
Expand All @@ -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,
Expand Down