mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -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);
|
this._setStyles(ctx);
|
||||||
if (hasFill) {
|
if (hasFill) {
|
||||||
ctx.fill(style.getFillRule());
|
ctx.fill(style.getFillRule());
|
||||||
ctx.shadowColor = 'rgba(0,0,0,0)';
|
ctx.shadowBlur = 0;
|
||||||
}
|
}
|
||||||
if (hasStroke)
|
if (hasStroke)
|
||||||
ctx.stroke();
|
ctx.stroke();
|
||||||
|
|
|
@ -298,7 +298,7 @@ var CompoundPath = PathItem.extend(/** @lends CompoundPath# */{
|
||||||
var style = this._style;
|
var style = this._style;
|
||||||
if (style.hasFill()) {
|
if (style.hasFill()) {
|
||||||
ctx.fill(style.getFillRule());
|
ctx.fill(style.getFillRule());
|
||||||
ctx.shadowColor = 'rgba(0,0,0,0)';
|
ctx.shadowBlur = 0;
|
||||||
}
|
}
|
||||||
if (style.hasStroke())
|
if (style.hasStroke())
|
||||||
ctx.stroke();
|
ctx.stroke();
|
||||||
|
|
|
@ -2218,7 +2218,7 @@ new function() { // Scope for drawing
|
||||||
// If shadowColor is defined, clear it after fill, so it
|
// If shadowColor is defined, clear it after fill, so it
|
||||||
// won't be applied to both fill and stroke. If the path is
|
// won't be applied to both fill and stroke. If the path is
|
||||||
// only stroked, we don't have to clear it.
|
// only stroked, we don't have to clear it.
|
||||||
ctx.shadowColor = 'rgba(0,0,0,0)';
|
ctx.shadowBlur = 0;
|
||||||
}
|
}
|
||||||
if (hasStroke) {
|
if (hasStroke) {
|
||||||
if (dashLength) {
|
if (dashLength) {
|
||||||
|
|
|
@ -80,21 +80,23 @@ var PointText = TextItem.extend(/** @lends PointText# */{
|
||||||
if (!this._content)
|
if (!this._content)
|
||||||
return;
|
return;
|
||||||
this._setStyles(ctx);
|
this._setStyles(ctx);
|
||||||
var style = this._style,
|
var lines = this._lines,
|
||||||
lines = this._lines,
|
style = this._style,
|
||||||
|
hasFill = style.hasFill(),
|
||||||
|
hasStroke = style.hasStroke(),
|
||||||
leading = style.getLeading(),
|
leading = style.getLeading(),
|
||||||
shadowColor = ctx.shadowColor;
|
shadowBlur = ctx.shadowBlur;
|
||||||
ctx.font = style.getFontStyle();
|
ctx.font = style.getFontStyle();
|
||||||
ctx.textAlign = style.getJustification();
|
ctx.textAlign = style.getJustification();
|
||||||
for (var i = 0, l = lines.length; i < l; i++) {
|
for (var i = 0, l = lines.length; i < l; i++) {
|
||||||
// See Path._draw() for explanation about ctx.shadowColor
|
// See Path._draw() for explanation about ctx.shadowBlur
|
||||||
ctx.shadowColor = shadowColor;
|
ctx.shadowBlur = shadowBlur;
|
||||||
var line = lines[i];
|
var line = lines[i];
|
||||||
if (style.hasFill()) {
|
if (hasFill) {
|
||||||
ctx.fillText(line, 0, 0);
|
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.strokeText(line, 0, 0);
|
||||||
ctx.translate(0, leading);
|
ctx.translate(0, leading);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue