Commit 02a4abd8 authored by rockyl's avatar rockyl

修复

parent c83815d2
......@@ -398,13 +398,13 @@ export default class Sprite extends Container {
set width(value) {
if (this._width !== value) {
if (!value && value != 0) {
this.scale.x = 1
this.scale.x = 1;
this._width = undefined;
} else {
const s = sign(this.scale.x) || 1;
const s = sign(this.scale.y) || 1;
this.scale.x = s * value / this._texture.orig.width;
this._width = value;
}
this._width = value;
this.dispatchEvent(Event.RESIZE);
}
}
......@@ -419,16 +419,15 @@ export default class Sprite extends Container {
}
set height(value) {
if (!value && value != 0) {
this._height = undefined;
} else {
if (this._height !== value) {
if (!value && value != 0) {
this.scale.y = 1
this.scale.y = 1;
this._height = undefined;
} else {
const s = sign(this.scale.y) || 1;
this.scale.y = s * value / this._texture.orig.height;
this._height = value;
}
this._height = value;
this.dispatchEvent(Event.RESIZE);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment