mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-04-23 15:24:43 +00:00
Merge pull request #2173 from asturur/object-restore
Avoid restoring properties manually that are handled by canvas save stack
This commit is contained in:
commit
04722f976d
3 changed files with 9 additions and 23 deletions
|
|
@ -979,8 +979,6 @@
|
|||
this.clipTo && fabric.util.clipContext(this, ctx);
|
||||
this._render(ctx, noTransform);
|
||||
this.clipTo && ctx.restore();
|
||||
this._removeShadow(ctx);
|
||||
this._restoreCompositeOperation(ctx);
|
||||
|
||||
ctx.restore();
|
||||
},
|
||||
|
|
@ -1102,9 +1100,6 @@
|
|||
ctx.fill();
|
||||
}
|
||||
ctx.restore();
|
||||
if (this.shadow && !this.shadow.affectStroke) {
|
||||
this._removeShadow(ctx);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
@ -1116,7 +1111,12 @@
|
|||
return;
|
||||
}
|
||||
|
||||
if (!this.shadow.affectStroke) {
|
||||
this._removeShadow(ctx);
|
||||
}
|
||||
|
||||
ctx.save();
|
||||
|
||||
if (this.strokeDashArray) {
|
||||
// Spec requires the concatenation of two copies the dash list when the number of elements is odd
|
||||
if (1 & this.strokeDashArray.length) {
|
||||
|
|
@ -1138,7 +1138,6 @@
|
|||
}
|
||||
this._stroke ? this._stroke(ctx) : ctx.stroke();
|
||||
}
|
||||
this._removeShadow(ctx);
|
||||
ctx.restore();
|
||||
},
|
||||
|
||||
|
|
@ -1476,19 +1475,8 @@
|
|||
*/
|
||||
_setupCompositeOperation: function (ctx) {
|
||||
if (this.globalCompositeOperation) {
|
||||
this._prevGlobalCompositeOperation = ctx.globalCompositeOperation;
|
||||
ctx.globalCompositeOperation = this.globalCompositeOperation;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Restores previously saved canvas globalCompositeOperation after obeject rendering
|
||||
* @param {CanvasRenderingContext2D} ctx Rendering canvas context
|
||||
*/
|
||||
_restoreCompositeOperation: function (ctx) {
|
||||
if (this.globalCompositeOperation && this._prevGlobalCompositeOperation) {
|
||||
ctx.globalCompositeOperation = this._prevGlobalCompositeOperation;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -115,7 +115,6 @@
|
|||
this.paths[i].render(ctx, true);
|
||||
}
|
||||
this.clipTo && ctx.restore();
|
||||
this._removeShadow(ctx);
|
||||
ctx.restore();
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -374,8 +374,6 @@
|
|||
this._setupCompositeOperation(ctx);
|
||||
this._renderTextFill(ctx);
|
||||
this._renderTextStroke(ctx);
|
||||
this._restoreCompositeOperation(ctx);
|
||||
this._removeShadow(ctx);
|
||||
ctx.restore();
|
||||
},
|
||||
|
||||
|
|
@ -529,9 +527,6 @@
|
|||
);
|
||||
lineHeights += heightOfLine;
|
||||
}
|
||||
if (this.shadow && !this.shadow.affectStroke) {
|
||||
this._removeShadow(ctx);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
@ -545,6 +540,10 @@
|
|||
|
||||
var lineHeights = 0;
|
||||
|
||||
if (!this.shadow.affectStroke) {
|
||||
this._removeShadow(ctx);
|
||||
}
|
||||
|
||||
ctx.save();
|
||||
|
||||
if (this.strokeDashArray) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue