Skip to content

Commit

Permalink
Fix "labelMinScale" logic in getGlyphQuads:
Browse files Browse the repository at this point in the history
No glyph should be able to show if any one of the glyphs in the label
can't show.
  • Loading branch information
ChrisLoer committed Apr 13, 2017
1 parent 7997605 commit 08fdd72
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/symbol/quads.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ function getGlyphQuads(anchor, shaping, boxScale, line, layer, alongLine, global
const positionedGlyphs = shaping.positionedGlyphs;
const quads = [];

let labelMinScale = minScale;

for (let k = 0; k < positionedGlyphs.length; k++) {
const positionedGlyph = positionedGlyphs[k];
const glyph = positionedGlyph.glyph;
Expand All @@ -161,12 +163,11 @@ function getGlyphQuads(anchor, shaping, boxScale, line, layer, alongLine, global
const centerX = (positionedGlyph.x + glyph.advance / 2) * boxScale;

let glyphInstances;
let labelMinScale = minScale;
if (alongLine) {
glyphInstances = [];
labelMinScale = getLineGlyphs(glyphInstances, anchor, centerX, line, anchor.segment, false);
labelMinScale = Math.max(labelMinScale, getLineGlyphs(glyphInstances, anchor, centerX, line, anchor.segment, false));
if (keepUpright) {
labelMinScale = Math.min(labelMinScale, getLineGlyphs(glyphInstances, anchor, centerX, line, anchor.segment, true));
labelMinScale = Math.max(labelMinScale, getLineGlyphs(glyphInstances, anchor, centerX, line, anchor.segment, true));
}

} else {
Expand Down

0 comments on commit 08fdd72

Please sign in to comment.