diff --git a/src/core/display/Container.js b/src/core/display/Container.js index 537c72c..3185818 100644 --- a/src/core/display/Container.js +++ b/src/core/display/Container.js @@ -422,9 +422,11 @@ continue; } - childVisible = true; - childBounds = this.children[i].getBounds(); + if (childBounds === math.Rectangle.EMPTY) { + continue; + } + childVisible = true; minX = minX < childBounds.x ? minX : childBounds.x; minY = minY < childBounds.y ? minY : childBounds.y; @@ -438,7 +440,7 @@ if (!childVisible) { - return math.Rectangle.EMPTY; + return this._currentBounds = math.Rectangle.EMPTY; } var bounds = this._bounds; diff --git a/src/core/display/Container.js b/src/core/display/Container.js index 537c72c..3185818 100644 --- a/src/core/display/Container.js +++ b/src/core/display/Container.js @@ -422,9 +422,11 @@ continue; } - childVisible = true; - childBounds = this.children[i].getBounds(); + if (childBounds === math.Rectangle.EMPTY) { + continue; + } + childVisible = true; minX = minX < childBounds.x ? minX : childBounds.x; minY = minY < childBounds.y ? minY : childBounds.y; @@ -438,7 +440,7 @@ if (!childVisible) { - return math.Rectangle.EMPTY; + return this._currentBounds = math.Rectangle.EMPTY; } var bounds = this._bounds; diff --git a/src/core/math/shapes/Rectangle.js b/src/core/math/shapes/Rectangle.js index 7c072f7..4b937ad 100644 --- a/src/core/math/shapes/Rectangle.js +++ b/src/core/math/shapes/Rectangle.js @@ -150,3 +150,15 @@ } } }; + +Rectangle.prototype.enlarge = function (rect) { + if (rect === Rectangle.EMPTY) return; + var x1 = Math.min(this.x, rect.x); + var x2 = Math.max(this.x + this.width, rect.x + rect.width); + var y1 = Math.min(this.y, rect.y); + var y2 = Math.max(this.y + this.height, rect.y + rect.height); + this.x = x1; + this.width = x2 - x1; + this.y = y1; + this.height = y2 - y1; +}; diff --git a/src/core/display/Container.js b/src/core/display/Container.js index 537c72c..3185818 100644 --- a/src/core/display/Container.js +++ b/src/core/display/Container.js @@ -422,9 +422,11 @@ continue; } - childVisible = true; - childBounds = this.children[i].getBounds(); + if (childBounds === math.Rectangle.EMPTY) { + continue; + } + childVisible = true; minX = minX < childBounds.x ? minX : childBounds.x; minY = minY < childBounds.y ? minY : childBounds.y; @@ -438,7 +440,7 @@ if (!childVisible) { - return math.Rectangle.EMPTY; + return this._currentBounds = math.Rectangle.EMPTY; } var bounds = this._bounds; diff --git a/src/core/math/shapes/Rectangle.js b/src/core/math/shapes/Rectangle.js index 7c072f7..4b937ad 100644 --- a/src/core/math/shapes/Rectangle.js +++ b/src/core/math/shapes/Rectangle.js @@ -150,3 +150,15 @@ } } }; + +Rectangle.prototype.enlarge = function (rect) { + if (rect === Rectangle.EMPTY) return; + var x1 = Math.min(this.x, rect.x); + var x2 = Math.max(this.x + this.width, rect.x + rect.width); + var y1 = Math.min(this.y, rect.y); + var y2 = Math.max(this.y + this.height, rect.y + rect.height); + this.x = x1; + this.width = x2 - x1; + this.y = y1; + this.height = y2 - y1; +}; diff --git a/src/flip/index.js b/src/flip/index.js deleted file mode 100644 index 6715850..0000000 --- a/src/flip/index.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * @file FLIP - * @author Mat Groves - * @copyright 2013-2015 GoodBoyDigital - * @license {@link https://github.com/GoodBoyDigital/pixi.js/blob/master/LICENSE|MIT License} - */ - -/** - * @namespace PIXI - */ -module.exports = { - glMat: require('gl-matrix') -};