Skip to content

Commit

Permalink
fix: render correctly in canvas when stroke is empty #1616
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoiver committed May 23, 2024
1 parent 7e06b54 commit d46dd14
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ export class DefaultRenderer implements StyleRenderer {
filter,
miterLimit,
} = parsedStyle;
const hasFill = !isNil(fill) && !(fill as CSSRGB).isNone;
const hasStroke =
!isNil(stroke) && !(stroke as CSSRGB).isNone && lineWidth > 0;
const hasFill = fill && !(fill as CSSRGB).isNone;
const hasStroke = stroke && !(stroke as CSSRGB).isNone && lineWidth > 0;

const isFillTransparent = (fill as CSSRGB)?.alpha === 0;
const hasFilter = !!(filter && filter.length);
const hasShadow = !isNil(shadowColor) && shadowBlur > 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -565,9 +565,9 @@ export class CanvaskitRendererPlugin implements RenderingPlugin {
canvas.rotate(rot, 0, 0);
canvas.scale(sx, sy);

const hasFill = !isNil(fill) && !(fill as CSSRGB).isNone;
const hasStroke = !isNil(stroke) && !(stroke as CSSRGB).isNone;
const hasShadow = !isNil(shadowColor) && shadowBlur > 0;
const hasFill = fill && !(fill as CSSRGB).isNone;
const hasStroke = stroke && !(stroke as CSSRGB).isNone;
const hasShadow = shadowColor && shadowBlur > 0;

let fillPaint: Paint = null;
let strokePaint: Paint = null;
Expand Down

0 comments on commit d46dd14

Please sign in to comment.