Skip to content

Commit

Permalink
fix label translate
Browse files Browse the repository at this point in the history
  • Loading branch information
hpinkos committed Jul 10, 2018
1 parent 807c22b commit aa655af
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Source/Scene/LabelCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ define([
var maxGlyphDescent = Number.NEGATIVE_INFINITY;
var maxGlyphY = 0;
var numberOfLines = 1;
var glyphIndex = 0;
var glyphIndex;
var glyphLength = glyphs.length;

var backgroundBillboard = label._backgroundBillboard;
Expand Down Expand Up @@ -387,7 +387,7 @@ define([
glyph.billboard._labelHorizontalOrigin = horizontalOrigin;
}

//Compute the next x offset taking into acocunt the kerning performed
//Compute the next x offset taking into account the kerning performed
//on both the current letter as well as the next letter to be drawn
//as well as any applied scale.
if (glyphIndex < glyphLength - 1) {
Expand Down Expand Up @@ -422,13 +422,15 @@ define([
backgroundBillboard.width = totalLineWidth;
backgroundBillboard.height = totalLineHeight;
backgroundBillboard._setTranslate(glyphPixelOffset);
backgroundBillboard._labelTranslate = Cartesian2.clone(glyphPixelOffset, backgroundBillboard._labelTranslate);
}

if (label.heightReference === HeightReference.CLAMP_TO_GROUND) {
for (glyphIndex = 0; glyphIndex < glyphLength; ++glyphIndex) {
if (text.charAt(glyphIndex) !== '\n') {
glyph = glyphs[glyphIndex];
Cartesian2.clone(glyphPixelOffset, glyph._labelTranslate);
glyph = glyphs[glyphIndex];
var billboard = glyph.billboard;
if (defined(billboard)) {
billboard._labelTranslate = Cartesian2.clone(glyphPixelOffset, billboard._labelTranslate);
}
}
}
Expand Down

0 comments on commit aa655af

Please sign in to comment.