From 2e99efa794206e0918225ac53ab3b28d1245f59c Mon Sep 17 00:00:00 2001 From: Grant Skinner Date: Wed, 24 Sep 2014 19:44:30 -0600 Subject: [PATCH] Fixed issues with Graphics failing to commit strokes / fills in certain situations. Signed-off-by: Grant Skinner --- src/easeljs/display/Graphics.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/easeljs/display/Graphics.js b/src/easeljs/display/Graphics.js index 3911b1b78..4fcd3c574 100644 --- a/src/easeljs/display/Graphics.js +++ b/src/easeljs/display/Graphics.js @@ -1203,16 +1203,18 @@ var G = Graphics; **/ p._updateInstructions = function(commit) { var instr = this._instructions, active = this._activeInstructions, commitIndex = this._commitIndex; - if (!this._dirty || !active.length) { return; } - this._dirty = false; - instr.length = commitIndex; - instr.push(Graphics.beginCmd); - instr.push.apply(instr, active); - - if (this._fill) { instr.push(this._fill); } - if (this._stroke && this._strokeStyle) { instr.push(this._strokeStyle); } - if (this._stroke) { instr.push(this._stroke); } + if (this._dirty && active.length) { + instr.length = commitIndex; // remove old, uncommitted commands + instr.push(Graphics.beginCmd); + instr.push.apply(instr, active); + + if (this._fill) { instr.push(this._fill); } + if (this._stroke && this._strokeStyle) { instr.push(this._strokeStyle); } + if (this._stroke) { instr.push(this._stroke); } + + this._dirty = false; + } if (commit) { active.length = 0;