Clean-up previous commit.

This commit is contained in:
Jürg Lehni 2016-02-12 21:23:47 +01:00
parent c6bcf4351a
commit 0a196daa21

View file

@ -3919,41 +3919,39 @@ new function() { // // Scope to inject various item event handlers
// We can access internal properties since we're only using this on // We can access internal properties since we're only using this on
// items without children, where styles would be merged. // items without children, where styles would be merged.
var style = this._style; var style = this._style;
if (style.hasFill()) if (style.hasFill()) {
ctx.fillStyle = style.getFillColor().toCanvasStyle(ctx); ctx.fillStyle = style.getFillColor().toCanvasStyle(ctx);
}
if (style.hasStroke()) { if (style.hasStroke()) {
var strokeWidth = style.getStrokeWidth(); ctx.strokeStyle = style.getStrokeColor().toCanvasStyle(ctx);
if (strokeWidth > 0) { ctx.lineWidth = style.getStrokeWidth();
ctx.strokeStyle = style.getStrokeColor().toCanvasStyle(ctx); var strokeJoin = style.getStrokeJoin(),
ctx.lineWidth = strokeWidth; strokeCap = style.getStrokeCap(),
var strokeJoin = style.getStrokeJoin(), miterLimit = style.getMiterLimit();
strokeCap = style.getStrokeCap(), if (strokeJoin)
miterLimit = style.getMiterLimit(); ctx.lineJoin = strokeJoin;
if (strokeJoin) if (strokeCap)
ctx.lineJoin = strokeJoin; ctx.lineCap = strokeCap;
if (strokeCap) if (miterLimit)
ctx.lineCap = strokeCap; ctx.miterLimit = miterLimit;
if (miterLimit) if (paper.support.nativeDash) {
ctx.miterLimit = miterLimit; var dashArray = style.getDashArray(),
if (paper.support.nativeDash) { dashOffset = style.getDashOffset();
var dashArray = style.getDashArray(), if (dashArray && dashArray.length) {
dashOffset = style.getDashOffset(); if ('setLineDash' in ctx) {
if (dashArray && dashArray.length) { ctx.setLineDash(dashArray);
if ('setLineDash' in ctx) { ctx.lineDashOffset = dashOffset;
ctx.setLineDash(dashArray); } else {
ctx.lineDashOffset = dashOffset; ctx.mozDash = dashArray;
} else { ctx.mozDashOffset = dashOffset;
ctx.mozDash = dashArray;
ctx.mozDashOffset = dashOffset;
}
} }
} }
} }
} }
if (style.hasShadow()) { if (style.hasShadow()) {
var offset = this.getShadowOffset();
ctx.shadowColor = style.getShadowColor().toCanvasStyle(ctx); ctx.shadowColor = style.getShadowColor().toCanvasStyle(ctx);
ctx.shadowBlur = style.getShadowBlur(); ctx.shadowBlur = style.getShadowBlur();
var offset = this.getShadowOffset();
ctx.shadowOffsetX = offset.x; ctx.shadowOffsetX = offset.x;
ctx.shadowOffsetY = offset.y; ctx.shadowOffsetY = offset.y;
} }