From 3317ddca3bb09495bc8c759a1cc136156bde74d4 Mon Sep 17 00:00:00 2001 From: Zach Kinstner Date: Thu, 7 Aug 2014 13:55:06 -0400 Subject: [PATCH] Implemented likely fix for "strokeScaleEnabled" issue (ericdrowell/KineticJS#530). This fix involves copying some logic from Kinetic.SceneContext._stroke() to Kinetic.HitContext._stroke(). This fix resolves the immediate issues I'm having today -- I haven't tested other scenarios. --- src/Context.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Context.js b/src/Context.js index 5347f9e3..721bcb8a 100644 --- a/src/Context.js +++ b/src/Context.js @@ -580,10 +580,21 @@ }, _stroke: function(shape) { if(shape.hasStroke()) { + var strokeScaleEnabled = shape.getStrokeScaleEnabled(); + + if (!strokeScaleEnabled) { + this.save(); + this.setTransform(1, 0, 0, 1, 0, 0); + } + this._applyLineCap(shape); this.setAttr('lineWidth', shape.strokeWidth()); this.setAttr('strokeStyle', shape.colorKey); shape._strokeFuncHit(this); + + if (!strokeScaleEnabled) { + this.restore(); + } } } };