Commit 6b7aed0f authored by rockyl's avatar rockyl

修复

parent f4456b7c
......@@ -726,7 +726,8 @@ export default class Container extends DisplayObject {
* @member {number}
*/
get width(): number {
return this._width || this.scale.x * this.getLocalBounds().width;
let value = this._width;
return !value && value != 0 ? this.scale.x * this.getLocalBounds().width : value;
}
set width(value: number) {
......@@ -755,7 +756,8 @@ export default class Container extends DisplayObject {
* @member {number}
*/
get height(): number {
return this._height || this.scale.y * this.getLocalBounds().height;
let value = this._height;
return !value && value != 0 ? this.scale.y * this.getLocalBounds().height : value;
}
set height(value: number) {
......
......@@ -391,7 +391,8 @@ export default class Sprite extends Container {
* @member {number}
*/
get width() {
return this._width || Math.abs(this.scale.x) * this._texture.orig.width;
let value = this._width;
return !value && value != 0 ? Math.abs(this.scale.x) * this._texture.orig.width : value;
}
set width(value) {
......@@ -413,7 +414,8 @@ export default class Sprite extends Container {
* @member {number}
*/
get height() {
return this._height || Math.abs(this.scale.y) * this._texture.orig.height;
let value = this._height;
return !value && value != 0 ? Math.abs(this.scale.y) * this._texture.orig.height : value;
}
set height(value) {
......
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