Skip to content

Commit

Permalink
Make vertical labels slightly more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
Arindam Bose authored and kkaefer committed Sep 20, 2019
1 parent 282b427 commit 1dac2c8
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/render/draw_symbol.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,9 @@ function updateVariableAnchorsForBucket(bucket, rotateWithMap, pitchWithMap, var
for (let g = 0; g < symbol.numGlyphs; g++) {
addDynamicAttributes(dynamicTextLayoutVertexArray, shiftedAnchor, angle);
}
//Only offset horizontal text icons
if (updateTextFitIcon && symbol.associatedIconIndex >= 0) {
placedTextShifts[symbol.associatedIconIndex] = shiftedAnchor;
placedTextShifts[symbol.associatedIconIndex] = {shiftedAnchor, angle};
}
}
}
Expand All @@ -189,15 +190,15 @@ function updateVariableAnchorsForBucket(bucket, rotateWithMap, pitchWithMap, var
const placedIcons = bucket.icon.placedSymbolArray;
for (let i = 0; i < placedIcons.length; i++) {
const placedIcon = placedIcons.get(i);
if (placedIcon.hidden || (!placedIcon.placedOrientation && bucket.allowVerticalPlacement)) {
if (placedIcon.hidden) {
symbolProjection.hideGlyphs(placedIcon.numGlyphs, dynamicIconLayoutVertexArray);
} else {
const shiftedAnchor = placedTextShifts[i];
if (!shiftedAnchor) {
const shift = placedTextShifts[i];
if (!shift) {
symbolProjection.hideGlyphs(placedIcon.numGlyphs, dynamicIconLayoutVertexArray);
} else {
for (let g = 0; g < placedIcon.numGlyphs; g++) {
addDynamicAttributes(dynamicIconLayoutVertexArray, shiftedAnchor, 0);
addDynamicAttributes(dynamicIconLayoutVertexArray, shift.shiftedAnchor, shift.angle);
}
}
}
Expand Down

0 comments on commit 1dac2c8

Please sign in to comment.