Skip to content

Commit

Permalink
fix: fix issue where set zindex doesn't take effect
Browse files Browse the repository at this point in the history
  • Loading branch information
neuqzxy committed Oct 11, 2024
1 parent f8135a1 commit 9eb21e7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/vstory/demo/src/demos/API.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ export const API = () => {

chart.setConfig({ zIndex: 100 });

setTimeout(() => {
rect.setConfig({ zIndex: -100 });
}, 1000);

// 设置character
// 添加character
// 更新character
Expand Down
5 changes: 4 additions & 1 deletion packages/vstory/src/story/character/component/character.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IBoundsLike } from '@visactor/vutils';
import { isValid, type IBoundsLike } from '@visactor/vutils';
import type { IGroup } from '@visactor/vrender';
import { GraphicBaseText } from './graphic/graphic-base-text';
import type { ICharacterConfig, IComponentCharacterConfig } from '../dsl-interface';
Expand Down Expand Up @@ -65,6 +65,9 @@ export abstract class CharacterComponent extends CharacterBase implements IChara
if (config.position) {
this.group.setAttributes(config.position);
}
if (isValid(config.zIndex)) {
this.group.setAttributes({ zIndex: config.zIndex });
}
}

protected abstract _createGraphic(): Graphic;
Expand Down

0 comments on commit 9eb21e7

Please sign in to comment.