From 7969e4647cfcedfd32717748ae0de2c01b7cf4fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Thu, 7 Jan 2016 22:06:10 +0100 Subject: [PATCH] Use shadowBlur instead of shadowColor to clear shadows after fills. --- src/item/Shape.js | 2 +- src/path/CompoundPath.js | 2 +- src/path/Path.js | 2 +- src/text/PointText.js | 18 ++++++++++-------- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/item/Shape.js b/src/item/Shape.js index 675cf375..f92fc56e 100644 --- a/src/item/Shape.js +++ b/src/item/Shape.js @@ -258,7 +258,7 @@ var Shape = Item.extend(/** @lends Shape# */{ this._setStyles(ctx); if (hasFill) { ctx.fill(style.getFillRule()); - ctx.shadowColor = 'rgba(0,0,0,0)'; + ctx.shadowBlur = 0; } if (hasStroke) ctx.stroke(); diff --git a/src/path/CompoundPath.js b/src/path/CompoundPath.js index 440b4000..fe5c1e73 100644 --- a/src/path/CompoundPath.js +++ b/src/path/CompoundPath.js @@ -298,7 +298,7 @@ var CompoundPath = PathItem.extend(/** @lends CompoundPath# */{ var style = this._style; if (style.hasFill()) { ctx.fill(style.getFillRule()); - ctx.shadowColor = 'rgba(0,0,0,0)'; + ctx.shadowBlur = 0; } if (style.hasStroke()) ctx.stroke(); diff --git a/src/path/Path.js b/src/path/Path.js index d41f3084..2bf39b61 100644 --- a/src/path/Path.js +++ b/src/path/Path.js @@ -2218,7 +2218,7 @@ new function() { // Scope for drawing // If shadowColor is defined, clear it after fill, so it // won't be applied to both fill and stroke. If the path is // only stroked, we don't have to clear it. - ctx.shadowColor = 'rgba(0,0,0,0)'; + ctx.shadowBlur = 0; } if (hasStroke) { if (dashLength) { diff --git a/src/text/PointText.js b/src/text/PointText.js index 3e7c2689..741485dc 100644 --- a/src/text/PointText.js +++ b/src/text/PointText.js @@ -80,21 +80,23 @@ var PointText = TextItem.extend(/** @lends PointText# */{ if (!this._content) return; this._setStyles(ctx); - var style = this._style, - lines = this._lines, + var lines = this._lines, + style = this._style, + hasFill = style.hasFill(), + hasStroke = style.hasStroke(), leading = style.getLeading(), - shadowColor = ctx.shadowColor; + shadowBlur = ctx.shadowBlur; ctx.font = style.getFontStyle(); ctx.textAlign = style.getJustification(); for (var i = 0, l = lines.length; i < l; i++) { - // See Path._draw() for explanation about ctx.shadowColor - ctx.shadowColor = shadowColor; + // See Path._draw() for explanation about ctx.shadowBlur + ctx.shadowBlur = shadowBlur; var line = lines[i]; - if (style.hasFill()) { + if (hasFill) { ctx.fillText(line, 0, 0); - ctx.shadowColor = 'rgba(0,0,0,0)'; + ctx.shadowBlur = 0; } - if (style.hasStroke()) + if (hasStroke) ctx.strokeText(line, 0, 0); ctx.translate(0, leading); }