Skip to content

Commit

Permalink
Fixed Label.getScreenSpaceBoundingBox by using the glyph dimensions
Browse files Browse the repository at this point in the history
instead of the billboard dimensions.  Using the billboard dimensions
assumes that the text is very tightly centered in the glyph itself which
isn't always the case with the SDF generated text.  We'll look to
tighten up the glyph size so it isn't unnecessarily big, but this this
change should work in all cases so matter how much padding we have
around the glyphs.
  • Loading branch information
jasonbeverage committed Apr 26, 2019
1 parent e71d3cb commit fe52af3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Source/Scene/Label.js
Original file line number Diff line number Diff line change
Expand Up @@ -1146,8 +1146,8 @@ define([

var glyphX = screenSpacePosition.x + (billboard._translate.x / resolutionScale);
var glyphY = screenSpacePosition.y - (billboard._translate.y / resolutionScale);
var glyphWidth = billboard.width * scale;
var glyphHeight = billboard.height * scale;
var glyphWidth = glyph.dimensions.width * scale;
var glyphHeight = glyph.dimensions.height * scale;

if (label.verticalOrigin === VerticalOrigin.BOTTOM || label.verticalOrigin === VerticalOrigin.BASELINE) {
glyphY -= glyphHeight;
Expand Down

0 comments on commit fe52af3

Please sign in to comment.