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:
Hua 2019-05-23 16:54:32 +08:00
parent 8e4632fb51
commit 97b60efa21

View file

@ -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();