From afe768cf4bdf2c1acc0f760833cef15bb359f29f Mon Sep 17 00:00:00 2001 From: plainheart Date: Wed, 1 Sep 2021 15:14:47 +0800 Subject: [PATCH] fix(svg): 1) fix illegal value for `stroke-dasharray` attribute. 2) use `opacity` attribute instead of CSS style property to enhance the compatibility. --- src/svg/graphic.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/svg/graphic.ts b/src/svg/graphic.ts index 709b0a544..f7bbdfb22 100644 --- a/src/svg/graphic.ts +++ b/src/svg/graphic.ts @@ -87,7 +87,7 @@ function bindStyle(svgEl: SVGElement, style: AllStyleOption, el?: Path | TSpan | // only set opacity. stroke and fill cannot be applied to svg image if (el instanceof ZRImage) { - svgEl.style.opacity = opacity + ''; + attr(svgEl, 'opacity', opacity + ''); return; } @@ -137,7 +137,7 @@ function bindStyle(svgEl: SVGElement, style: AllStyleOption, el?: Path | TSpan | attr(svgEl, 'stroke-dashoffset', (lineDashOffset || 0) + ''); } else { - attr(svgEl, 'stroke-dasharray', ''); + attr(svgEl, 'stroke-dasharray', NONE); } // PENDING