Merge pull request #740 from nathan-muir/kangax-master

Fix issue with `fabric.Line` in browsers that don't support 'setLineDash'
This commit is contained in:
Juriy Zaytsev 2013-07-13 02:09:00 -07:00
commit d741b647bc

View file

@ -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);