mirror of
https://github.com/photonstorm/phaser
synced 2025-02-17 06:28:30 +00:00
Set canvas size equal to text object size
Canvas size might less than text object size, when `fixedWidth` and `fixedHeight` is set.
This commit is contained in:
parent
8e4632fb51
commit
97b60efa21
1 changed files with 4 additions and 14 deletions
|
@ -1118,12 +1118,9 @@ var Text = new Class({
|
|||
|
||||
var padding = this.padding;
|
||||
|
||||
var w = textSize.width + padding.left + padding.right;
|
||||
var h = textSize.height + padding.top + padding.bottom;
|
||||
|
||||
if (style.fixedWidth === 0)
|
||||
{
|
||||
this.width = w;
|
||||
this.width = textSize.width + padding.left + padding.right;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1132,22 +1129,15 @@ var Text = new Class({
|
|||
|
||||
if (style.fixedHeight === 0)
|
||||
{
|
||||
this.height = h;
|
||||
this.height = textSize.height + padding.top + padding.bottom;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.height = style.fixedHeight;
|
||||
}
|
||||
|
||||
if (w > this.width)
|
||||
{
|
||||
w = this.width;
|
||||
}
|
||||
|
||||
if (h > this.height)
|
||||
{
|
||||
h = this.height;
|
||||
}
|
||||
var w = this.width;
|
||||
var h = this.height;
|
||||
|
||||
this.updateDisplayOrigin();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue