mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Use shadowBlur instead of shadowColor to clear shadows after fills.
This commit is contained in:
parent
d1e4807c6a
commit
7969e4647c
4 changed files with 13 additions and 11 deletions
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue