antvis/G6

When an edge occurs, no event is triggered before or after. #5794

RackweLLizm posted onGitHub

Describe the bug

graph.on(GraphEvent.BEFORE_ELEMENT_CREATE, (e: any) => { }) This event is not triggered when Edge is created. So I Couldn't Find Any Event Triggered When Before or After Edge is Created. I also looked at the EdgeEvent class.

It is triggered when the node is created, no problem.

Your Example Website or App

notFound

Steps to Reproduce the Bug or Issue

notFound

Expected behavior

notFound

Screenshots or Videos

notFound

Platform

Windows Chrome 124 "@antv/g6": "^5.0.0-beta.37",

Additional context

No response


@Aarebecca Is there any progress on this issue? In beta 40, the event is still not triggered when the edge is created.

posted by RackweLLizm 11 months ago
  this.graphInstance.updateBehavior({
                key: 'create-edge',
                enable: true,
                onFinish: this.onFinishEdge
            });

I solved my problem with the onFinish method when creating an edge. The method returns source and target properly. The targetSource mock id will be in the event data you receive with BEFORE_ELEMENT_CREATE. You can get the source and target correctly with the onFinish method.

posted by RackweLLizm 10 months ago

Fund this Issue

$0.00
Funded

Pull requests