Skip to content

Commit a704aec

Browse files
committed
fix: fix onAfterConnect event
1 parent b2b4672 commit a704aec

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/common/constants/index.ts

-2
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,6 @@ export enum GraphCustomEvent {
260260
onBeforeLayout = 'beforelayout',
261261
/** 布局完成后触发。调用 render 时会进行布局,因此 render 时布局完成后会触发。或用户主动调用图的 layout 时布局完成后触发 */
262262
onAfterLayout = 'afterlayout',
263-
/** 连线完成之前触发 */
264-
onBeforeConnect = 'beforeconnect',
265263
/** 连线完成之后触发 */
266264
onAfterConnect = 'afterconnect',
267265
}

src/components/Flow/behavior/dragAddEdge.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import isPlainObject from 'lodash/isPlainObject';
22
import { guid } from '@/utils';
3-
import { ItemType, ItemState, GraphType, AnchorPointState } from '@/common/constants';
3+
import { ItemType, ItemState, GraphType, AnchorPointState, GraphCustomEvent } from '@/common/constants';
44
import { Node, Edge, Behavior, GraphEvent, EdgeModel, AnchorPoint } from '@/common/interfaces';
55
import behaviorManager from '@/common/behaviorManager';
66

@@ -203,6 +203,10 @@ const dragAddEdgeBehavior: DragAddEdgeBehavior & ThisType<DragAddEdgeBehavior &
203203
graph.removeItem(this.edge);
204204
}
205205

206+
graph.emit(GraphCustomEvent.onAfterConnect, {
207+
edge: this.edge,
208+
});
209+
206210
this.edge = null;
207211

208212
graph.getNodes().forEach(node => {

0 commit comments

Comments
 (0)