mirror of
https://github.com/photonstorm/phaser
synced 2024-11-24 05:33:35 +00:00
Merge pull request #4427 from rexrainbow/master
Fix bug about counting height of text object
This commit is contained in:
commit
d13e79a8db
2 changed files with 11 additions and 3 deletions
|
@ -58,9 +58,9 @@ var GetTextSize = function (text, size, lines)
|
|||
var lineSpacing = text.lineSpacing;
|
||||
|
||||
// Adjust for line spacing
|
||||
if (lines.length > 1)
|
||||
if (drawnLines > 1)
|
||||
{
|
||||
height += lineSpacing * (lines.length - 1);
|
||||
height += lineSpacing * (drawnLines - 1);
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
@ -532,7 +532,7 @@ var Text = new Class({
|
|||
}
|
||||
|
||||
result += words[j] + ' ';
|
||||
spaceLeft = wordWrapWidth - wordWidth;
|
||||
spaceLeft = wordWrapWidth - wordWidthWithSpace;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1125,11 +1125,19 @@ var Text = new Class({
|
|||
{
|
||||
this.width = w;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.width = style.fixedWidth;
|
||||
}
|
||||
|
||||
if (style.fixedHeight === 0)
|
||||
{
|
||||
this.height = h;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.height = style.fixedHeight;
|
||||
}
|
||||
|
||||
this.updateDisplayOrigin();
|
||||
|
||||
|
|
Loading…
Reference in a new issue