diff --git a/src/pixi/primitives/Graphics.js b/src/pixi/primitives/Graphics.js index 6dbf644..0e57832 100644 --- a/src/pixi/primitives/Graphics.js +++ b/src/pixi/primitives/Graphics.js @@ -101,6 +101,8 @@ */ this.boundsPadding = 0; + this._localBounds = new PIXI.Rectangle(0,0,1,1); + /** * Used to detect if the graphics object has changed. If this is set to true then the graphics object will be recalculated. * @@ -804,13 +806,13 @@ if(this.dirty) { - this.updateBounds(); + this.updateLocalBounds(); this.webGLDirty = true; this.cachedSpriteDirty = true; this.dirty = false; } - var bounds = this._bounds; + var bounds = this._localBounds; var w0 = bounds.x; var w1 = bounds.width + bounds.x; @@ -861,21 +863,21 @@ maxY = y3 > maxY ? y3 : maxY; maxY = y4 > maxY ? y4 : maxY; - bounds.x = minX; - bounds.width = maxX - minX; + this._bounds.x = minX; + this._bounds.width = maxX - minX; - bounds.y = minY; - bounds.height = maxY - minY; + this._bounds.y = minY; + this._bounds.height = maxY - minY; - return bounds; + return this._bounds; }; /** * Update the bounds of the object * - * @method updateBounds + * @method updateLocalBounds */ -PIXI.Graphics.prototype.updateBounds = function() +PIXI.Graphics.prototype.updateLocalBounds = function() { var minX = Infinity; var maxX = -Infinity; @@ -961,13 +963,12 @@ } var padding = this.boundsPadding; - var bounds = this._bounds; - bounds.x = minX - padding; - bounds.width = (maxX - minX) + padding * 2; + this._localBounds.x = minX - padding; + this._localBounds.width = (maxX - minX) + padding * 2; - bounds.y = minY - padding; - bounds.height = (maxY - minY) + padding * 2; + this._localBounds.y = minY - padding; + this._localBounds.height = (maxY - minY) + padding * 2; }; /**