diff --git a/packages/core/src/item/edge.ts b/packages/core/src/item/edge.ts index df8cbbcc77..a5c9bdda38 100644 --- a/packages/core/src/item/edge.ts +++ b/packages/core/src/item/edge.ts @@ -34,8 +34,8 @@ export default class Edge extends Item implements IEdge { // 如果设置成具体的点,则清理节点 this.set(pointName, value); this.set(itemName, null); - } else { - value!.addEdge(this); + } else if (value) { + value.addEdge(this); this.set(itemName, value); this.set(pointName, null); } diff --git a/packages/core/src/util/math.ts b/packages/core/src/util/math.ts index d790f02098..73c62bdc7d 100644 --- a/packages/core/src/util/math.ts +++ b/packages/core/src/util/math.ts @@ -357,7 +357,7 @@ export const translate = (group: IGroup, vec: Point) => { * @param group Group 实例 * @param point 移动到的坐标点 */ -export const move = (group: IGroup, point: Point, animate?: boolean, animateCfg?: GraphAnimateConfig = {}) => { +export const move = (group: IGroup, point: Point, animate?: boolean, animateCfg?: GraphAnimateConfig = { duration: 500 }) => { let matrix: Matrix = group.getMatrix(); if (!matrix) { matrix = [1, 0, 0, 0, 1, 0, 0, 0, 1];