From 345d2af37b55d2e81d4974d744335455b5840efb Mon Sep 17 00:00:00 2001 From: visiky <736929286@qq.com> Date: Wed, 24 Feb 2021 08:25:11 +0800 Subject: [PATCH] =?UTF-8?q?feat(ring-progress):=20=E5=B0=86=E7=8E=AF?= =?UTF-8?q?=E5=BD=A2=E8=BF=9B=E5=BA=A6=E6=9D=A1=E7=9A=84z-index=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E8=B0=83=E6=95=B4,=E9=BB=98=E8=AE=A4=E7=BD=AE?= =?UTF-8?q?=E9=A1=B6=20shape0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../unit/plots/ring-progress/index-spec.ts | 20 +++++++++++++++++++ src/plots/progress/adaptor.ts | 3 +++ 2 files changed, 23 insertions(+) diff --git a/__tests__/unit/plots/ring-progress/index-spec.ts b/__tests__/unit/plots/ring-progress/index-spec.ts index b827471dbb..2c28e1c76d 100644 --- a/__tests__/unit/plots/ring-progress/index-spec.ts +++ b/__tests__/unit/plots/ring-progress/index-spec.ts @@ -327,4 +327,24 @@ describe('ring-progress', () => { it('defaultOptions 保持从 constants 中获取', () => { expect(RingProgress.getDefaultOptions()).toEqual(DEFAULT_OPTIONS); }); + + it('z-index', () => { + const ringProgress = new RingProgress(createDiv(), { + radius: 1, + innerRadius: 0.5, + width: 200, + height: 100, + percent: 0.6, + autoFit: false, + }); + + ringProgress.render(); + let elements = ringProgress.chart.geometries[0].elements; + expect(elements[0].shape.get('zIndex')).toBeGreaterThan(elements[1].shape.get('zIndex')); + ringProgress.changeData(0.7); + elements = ringProgress.chart.geometries[0].elements; + expect(elements[0].shape.get('zIndex')).toBeGreaterThan(elements[1].shape.get('zIndex')); + + ringProgress.destroy(); + }); }); diff --git a/src/plots/progress/adaptor.ts b/src/plots/progress/adaptor.ts index 837de3a00f..7ee393ec1a 100644 --- a/src/plots/progress/adaptor.ts +++ b/src/plots/progress/adaptor.ts @@ -28,6 +28,9 @@ export function geometry(params: Params): Params