Skip to content

Commit

Permalink
Merge pull request #754 from VisActor/fix/shadow-bounds-dpr
Browse files Browse the repository at this point in the history
fix: fix shadow bounds issue with dpr
  • Loading branch information
neuqzxy authored Dec 5, 2023
2 parents 0b889db + eb0960f commit 7977859
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1483,8 +1483,9 @@ export class DefaultGraphicService implements IGraphicService {
}
if (shadowBlur) {
const { shadowOffsetX = theme.shadowOffsetX, shadowOffsetY = theme.shadowOffsetY } = attribute;
const shadowBlurWidth = (shadowBlur / Math.abs(scaleX + scaleY)) * 2 + Math.max(shadowOffsetX, shadowOffsetY);
boundStroke(tb1, shadowBlurWidth, miter, strokeBoundsBuffer + 1);
const shadowBlurWidth = (shadowBlur / Math.abs(scaleX + scaleY)) * 2;
boundStroke(tb1, shadowBlurWidth, false, strokeBoundsBuffer + 1);
tb1.translate(shadowOffsetX, shadowOffsetY);
aabbBounds.union(tb1);
// tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1050,10 +1050,11 @@ export class BrowserContext2d implements IContext2d {
return;
}
if (shadowBlur || shadowOffsetX || shadowOffsetY) {
_context.shadowBlur = shadowBlur;
// canvas的shadow不支持dpr,这里手动设置
_context.shadowBlur = shadowBlur * this.dpr;
_context.shadowColor = shadowColor;
_context.shadowOffsetX = shadowOffsetX;
_context.shadowOffsetY = shadowOffsetY;
_context.shadowOffsetX = shadowOffsetX * this.dpr;
_context.shadowOffsetY = shadowOffsetY * this.dpr;
this._clearShadowStyle = true;
// todo 小程序
} else if (this._clearShadowStyle) {
Expand Down

0 comments on commit 7977859

Please sign in to comment.