diff --git a/src/core/display/Container.js b/src/core/display/Container.js index df4d0f6..bee05d5 100644 --- a/src/core/display/Container.js +++ b/src/core/display/Container.js @@ -399,6 +399,8 @@ return this._currentBounds; }; +Container.prototype.containerGetBounds = Container.prototype.getBounds; + /** * Retrieves the non-global local bounds of the Container as a rectangle. * The calculation takes all visible children into consideration. diff --git a/src/core/display/Container.js b/src/core/display/Container.js index df4d0f6..bee05d5 100644 --- a/src/core/display/Container.js +++ b/src/core/display/Container.js @@ -399,6 +399,8 @@ return this._currentBounds; }; +Container.prototype.containerGetBounds = Container.prototype.getBounds; + /** * Retrieves the non-global local bounds of the Container as a rectangle. * The calculation takes all visible children into consideration. diff --git a/src/core/sprites/Sprite.js b/src/core/sprites/Sprite.js index eee00ae..3463f48 100644 --- a/src/core/sprites/Sprite.js +++ b/src/core/sprites/Sprite.js @@ -237,6 +237,7 @@ minY, maxY; + if (b === 0 && c === 0) { // scale may be negative! @@ -292,6 +293,23 @@ maxY = y4 > maxY ? y4 : maxY; } + // check for children + if(this.children.length) + { + var childBounds = this.containerGetBounds(); + + w0 = childBounds.x; + w1 = childBounds.x + childBounds.width; + h0 = childBounds.y; + h1 = childBounds.y + childBounds.height; + + minX = (minX < w0) ? minX : w0; + minY = (minY < h0) ? minY : h0; + + maxX = (maxX > w1) ? maxX : w1; + maxY = (maxY > h1) ? maxY : h1; + } + var bounds = this._bounds; bounds.x = minX;