Add opacity support in Path#draw.

This commit is contained in:
Jonathan Puckey 2011-02-19 17:33:23 +01:00
parent c2849b3692
commit 2b1dee1bd4

View file

@ -367,6 +367,8 @@ Path = PathItem.extend({
} }
if(!compound) { if(!compound) {
this.setCtxStyles(ctx); this.setCtxStyles(ctx);
ctx.save();
ctx.globalAlpha = this.opacity;
if (this.fillColor) { if (this.fillColor) {
ctx.fillStyle = this.fillColor.getCssString(); ctx.fillStyle = this.fillColor.getCssString();
ctx.fill(); ctx.fill();
@ -375,6 +377,7 @@ Path = PathItem.extend({
ctx.strokeStyle = this.strokeColor.getCssString(); ctx.strokeStyle = this.strokeColor.getCssString();
ctx.stroke(); ctx.stroke();
} }
ctx.restore();
} }
} }
}, new function() { // inject methods that require scoped privates }, new function() { // inject methods that require scoped privates