Skip to content

Commit

Permalink
feat(graphin):fix graphin-cricle animate
Browse files Browse the repository at this point in the history
  • Loading branch information
pomelo-nwu committed Jan 14, 2021
1 parent 8abf16b commit 5ce31cf
Showing 1 changed file with 23 additions and 20 deletions.
43 changes: 23 additions & 20 deletions packages/graphin/src/shape/graphin-circle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,8 @@ export default () => {
g6Shape.attr(otherAttrs);
g6Shape.cfg.visible = visible !== false;
if (animate) {
const { attrs, duration, easing, callback, delay } = animate;
g6Shape.animate(attrs, duration, easing, callback, delay);
const { attrs, ...animateOptions } = animate;
g6Shape.animate(attrs, animateOptions);
}
}
});
Expand All @@ -425,8 +425,8 @@ export default () => {
g6Shape.attr(otherAttrs);
g6Shape.cfg.visible = visible !== false;
if (animate) {
const { attrs, duration, easing, callback, delay } = animate;
g6Shape.animate(attrs, duration, easing, callback, delay);
const { attrs, ...animateOptions } = animate;
g6Shape.animate(attrs, animateOptions);
}
}
});
Expand Down Expand Up @@ -510,24 +510,27 @@ export default () => {
},
update(cfg: IUserNode, item: INode) {
if (!cfg.style) return;
debugger;
const style = getStyles(cfg._initialStyle, cfg.style) as NodeStyle;
cfg._initialStyle = { ...style };
const shapes = item.getContainer().get('children'); // 顺序根据 draw 时确定
try {
const style = getStyles(cfg._initialStyle, cfg.style) as NodeStyle;
cfg._initialStyle = { ...style };
const shapes = item.getContainer().get('children'); // 顺序根据 draw 时确定

shapes.forEach((g6Shape: any) => {
const itemShapeName = g6Shape.cfg.name as 'icon' | 'keyshape' | 'halo' | 'label' | 'badges';
const customAttrs = style[itemShapeName];
if (customAttrs) {
const { animate, visible, ...otherAttrs } = paserAttr(customAttrs as any, itemShapeName);
g6Shape.attr(otherAttrs);
g6Shape.cfg.visible = visible !== false;
if (animate) {
const { attrs, duration, easing, callback, delay } = animate;
g6Shape.animate(attrs, duration, easing, callback, delay);
shapes.forEach((g6Shape: any) => {
const itemShapeName = g6Shape.cfg.name as 'icon' | 'keyshape' | 'halo' | 'label' | 'badges';
const customAttrs = style[itemShapeName];
if (customAttrs) {
const { animate, visible, ...otherAttrs } = paserAttr(customAttrs as any, itemShapeName);
g6Shape.attr(otherAttrs);
g6Shape.cfg.visible = visible !== false;
if (animate) {
const { attrs, ...animateOptions } = animate;
g6Shape.animate(attrs, animateOptions);
}
}
}
});
});
} catch (error) {
console.error('error');
}
},
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} as any);
Expand Down

0 comments on commit 5ce31cf

Please sign in to comment.