diff --git a/src/core/graphics/Graphics.js b/src/core/graphics/Graphics.js index 6f0a417..9149284 100644 --- a/src/core/graphics/Graphics.js +++ b/src/core/graphics/Graphics.js @@ -833,7 +833,6 @@ this.boundsDirty = this.dirty; this.updateLocalBounds(); - this.dirty++; this.cachedSpriteDirty = true; } diff --git a/src/core/graphics/Graphics.js b/src/core/graphics/Graphics.js index 6f0a417..9149284 100644 --- a/src/core/graphics/Graphics.js +++ b/src/core/graphics/Graphics.js @@ -833,7 +833,6 @@ this.boundsDirty = this.dirty; this.updateLocalBounds(); - this.dirty++; this.cachedSpriteDirty = true; } diff --git a/test/core/Graphics.js b/test/core/Graphics.js index 0622cfc..50f775b 100644 --- a/test/core/Graphics.js +++ b/test/core/Graphics.js @@ -191,4 +191,21 @@ expect(graphics.currentPath).to.be.null; }); }); + + describe('_calculateBounds', () => + { + it('should only call updateLocalBounds once', () => + { + const graphics = new PIXI.Graphics(); + const spy = sinon.spy(graphics, 'updateLocalBounds'); + + graphics._calculateBounds(); + + expect(spy).to.have.been.calledOnce; + + graphics._calculateBounds(); + + expect(spy).to.have.been.calledOnce; + }); + }); });