diff --git a/packages/g-plugin-canvas-renderer/src/shapes/styles/Default.ts b/packages/g-plugin-canvas-renderer/src/shapes/styles/Default.ts index 7d5898c3a..243cbc193 100644 --- a/packages/g-plugin-canvas-renderer/src/shapes/styles/Default.ts +++ b/packages/g-plugin-canvas-renderer/src/shapes/styles/Default.ts @@ -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; diff --git a/packages/g-plugin-canvaskit-renderer/src/CanvaskitRendererPlugin.ts b/packages/g-plugin-canvaskit-renderer/src/CanvaskitRendererPlugin.ts index f37618251..695665bc0 100644 --- a/packages/g-plugin-canvaskit-renderer/src/CanvaskitRendererPlugin.ts +++ b/packages/g-plugin-canvaskit-renderer/src/CanvaskitRendererPlugin.ts @@ -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;