diff --git a/src/core/graphics/Graphics.js b/src/core/graphics/Graphics.js index ed6fa1e..deba490 100644 --- a/src/core/graphics/Graphics.js +++ b/src/core/graphics/Graphics.js @@ -668,12 +668,15 @@ */ clear() { - this.lineWidth = 0; - this.filling = false; + if (this.lineWidth || this.filling || this.graphicsData.length > 0) + { + this.lineWidth = 0; + this.filling = false; - this.dirty++; - this.clearDirty++; - this.graphicsData = []; + this.dirty++; + this.clearDirty++; + this.graphicsData.length = 0; + } return this; } diff --git a/src/core/graphics/Graphics.js b/src/core/graphics/Graphics.js index ed6fa1e..deba490 100644 --- a/src/core/graphics/Graphics.js +++ b/src/core/graphics/Graphics.js @@ -668,12 +668,15 @@ */ clear() { - this.lineWidth = 0; - this.filling = false; + if (this.lineWidth || this.filling || this.graphicsData.length > 0) + { + this.lineWidth = 0; + this.filling = false; - this.dirty++; - this.clearDirty++; - this.graphicsData = []; + this.dirty++; + this.clearDirty++; + this.graphicsData.length = 0; + } return this; } diff --git a/src/core/graphics/webgl/GraphicsRenderer.js b/src/core/graphics/webgl/GraphicsRenderer.js index aef998f..913caa3 100644 --- a/src/core/graphics/webgl/GraphicsRenderer.js +++ b/src/core/graphics/webgl/GraphicsRenderer.js @@ -143,7 +143,7 @@ } // clear the array and reset the index.. - webGL.data = []; + webGL.data.length = 0; webGL.lastIndex = 0; }