From f97d593c84f9af889ac6ab141997b8c697833472 Mon Sep 17 00:00:00 2001 From: Nathan Muir Date: Thu, 11 Jul 2013 12:16:34 +1000 Subject: [PATCH] Fixed issue with fabric.Line when browser doesn't support 'setLineDash' (firefox & IE 10). Example at http://jsfiddle.net/taRvU/1/ --- src/shapes/line.class.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/shapes/line.class.js b/src/shapes/line.class.js index e6ccf340..1ad676a4 100644 --- a/src/shapes/line.class.js +++ b/src/shapes/line.class.js @@ -120,8 +120,11 @@ * @param {CanvasRenderingContext2D} ctx Context to render on */ _renderDashedStroke: function(ctx) { - var x = this.width === 1 ? 0 : -this.width / 2, - y = this.height === 1 ? 0 : -this.height / 2; + var + xMult = this.x1 <= this.x2 ? -1 : 1, + yMult = this.y1 <= this.y2 ? -1 : 1, + x = this.width === 1 ? 0 : xMult * this.width / 2, + y = this.height === 1 ? 0 : yMult * this.height / 2; ctx.beginPath(); fabric.util.drawDashedLine(ctx, x, y, -x, -y, this.strokeDashArray);