From 79316114cfab7cd9d053afc3fa77957319d21d93 Mon Sep 17 00:00:00 2001 From: plainheart Date: Wed, 4 Aug 2021 14:21:15 +0800 Subject: [PATCH 1/2] fix(shadow): specify the shadow filter units as `userSpaceOnUse`, resolves apache/echarts#15467. --- src/svg/helper/ShadowManager.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/svg/helper/ShadowManager.ts b/src/svg/helper/ShadowManager.ts index 16814c0b6..2d9487474 100644 --- a/src/svg/helper/ShadowManager.ts +++ b/src/svg/helper/ShadowManager.ts @@ -118,6 +118,7 @@ export default class ShadowManager extends Definable { shadowDom.setAttribute('y', '-100%'); shadowDom.setAttribute('width', '300%'); shadowDom.setAttribute('height', '300%'); + shadowDom.setAttribute('filterUnits', 'userSpaceOnUse'); // Store dom element in shadow, to avoid creating multiple // dom instances for the same shadow element From e559d7243c09d5895e2a1c7bf6a111d5b470c6e6 Mon Sep 17 00:00:00 2001 From: Ovilia Date: Fri, 10 Sep 2021 17:19:21 +0800 Subject: [PATCH 2/2] fix(svg): svg shadow to solve apache/echarts#12614 --- src/svg/helper/ShadowManager.ts | 1 + test/svg-shadow.html | 24 +++++++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/svg/helper/ShadowManager.ts b/src/svg/helper/ShadowManager.ts index f836444fa..5e2d5da50 100644 --- a/src/svg/helper/ShadowManager.ts +++ b/src/svg/helper/ShadowManager.ts @@ -36,6 +36,7 @@ export default class ShadowManager extends Definable { if (!shadowDom) { shadowDom = this.createElement('filter') as SVGFilterElement; shadowDom.setAttribute('id', 'zr' + this._zrId + '-shadow-' + this.nextId++); + shadowDom.setAttribute('filterUnits', 'userSpaceOnUse'); const domChild = this.createElement('feDropShadow'); shadowDom.appendChild(domChild); this.addDom(shadowDom); diff --git a/test/svg-shadow.html b/test/svg-shadow.html index 695f2bf9d..e70c3c1cb 100644 --- a/test/svg-shadow.html +++ b/test/svg-shadow.html @@ -8,9 +8,11 @@ +

Canvas

+

SVG

-
+