Skip to content

Commit

Permalink
feat(ring-progress): 将环形进度条的z-index进行调整,默认置顶 shape0 (#2344)
Browse files Browse the repository at this point in the history
  • Loading branch information
visiky authored Feb 24, 2021
1 parent 674d51f commit d6438e8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
20 changes: 20 additions & 0 deletions __tests__/unit/plots/ring-progress/index-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
});
3 changes: 3 additions & 0 deletions src/plots/progress/adaptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ export function geometry(params: Params<ProgressOptions>): Params<ProgressOption
style: progressStyle,
color: isString(color) ? [color, DEFAULT_COLOR[1]] : color,
},
args: {
zIndexReversed: true,
},
},
});

Expand Down

0 comments on commit d6438e8

Please sign in to comment.