Skip to content

Commit

Permalink
feat: 元素状态统一成常量
Browse files Browse the repository at this point in the history
  • Loading branch information
zengyue committed Apr 12, 2021
1 parent 9d1652b commit 73adbfa
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/components/src/chart/animation/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Timeline from './timelime';
import Animator from './animator';
import { ElementStatus } from '@ali/f2-jsx';

// 遍历全部节点
function eachElement(element, fn) {
Expand Down Expand Up @@ -29,10 +30,10 @@ class Animation {
let maxDuration = 0;
// 遍历整个树,找到全部需要动画的元素
eachElement(container, (element) => {
// TODO: flag 需要提取状态
const { animation, flag } = element._attrs;
// TODO: status 需要提取状态
const { animation, status } = element._attrs;
if (!animation) {
if (flag === 'delete') {
if (status === ElementStatus.ELEMENT_DELETE) {
element.remove(true);
}
return;
Expand All @@ -59,7 +60,7 @@ class Animation {
for (let i = 0, len = animators.length; i < len; i++) {
const animator = animators[i];
const { element } = animator;
if(element._attrs.flag === 'delete') {
if(element._attrs.status === ElementStatus.ELEMENT_DELETE) {
element.remove(true);
}
}
Expand Down

0 comments on commit 73adbfa

Please sign in to comment.