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;
|
var lineSpacing = text.lineSpacing;
|
||||||
|
|
||||||
// Adjust for line spacing
|
// Adjust for line spacing
|
||||||
if (lines.length > 1)
|
if (drawnLines > 1)
|
||||||
{
|
{
|
||||||
height += lineSpacing * (lines.length - 1);
|
height += lineSpacing * (drawnLines - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -532,7 +532,7 @@ var Text = new Class({
|
||||||
}
|
}
|
||||||
|
|
||||||
result += words[j] + ' ';
|
result += words[j] + ' ';
|
||||||
spaceLeft = wordWrapWidth - wordWidth;
|
spaceLeft = wordWrapWidth - wordWidthWithSpace;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1125,11 +1125,19 @@ var Text = new Class({
|
||||||
{
|
{
|
||||||
this.width = w;
|
this.width = w;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.width = style.fixedWidth;
|
||||||
|
}
|
||||||
|
|
||||||
if (style.fixedHeight === 0)
|
if (style.fixedHeight === 0)
|
||||||
{
|
{
|
||||||
this.height = h;
|
this.height = h;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.height = style.fixedHeight;
|
||||||
|
}
|
||||||
|
|
||||||
this.updateDisplayOrigin();
|
this.updateDisplayOrigin();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue