React-diagrams: How to add listener on new Link created

Created on 15 Aug 2019  路  3Comments  路  Source: projectstorm/react-diagrams

How to add a listener on new Link created.

    this.engine = new DiagramEngine();
    this.engine.registerNodeFactory(new DefaultNodeFactory());
    this.engine.registerLinkFactory(new DefaultLinkFactory());
    this.engine.getDiagramModel().addListener({
 nodesUpdated: function(e){
   // Do something here
  // alert("dd");
 },
 zoomUpdated: function(e){
  // Do something here
  //alert("Zoom");
 },
  linksUpdated: function(event){
      console.log("events done:")
             //// Want an on new link event

}
});
I tried this code but it's not working

invalid

All 3 comments

Works on my side when I add the event to the DiagramModel

model.registerListener({
        eventDidFire: action('model eventDidFire')
    });

@dylanvorster My code is working fine. But, I don't know how to detect new Link created.

linksUpdated: function(event){
console.log("events done:") // all events are fired here , but I want specific event with their props.
//// Want an on new link event
}

@naveenraj006 could you solve your problem?

I have the same problem.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

CarlousF picture CarlousF  路  3Comments

quangas picture quangas  路  3Comments

jardg picture jardg  路  3Comments

shortwavedave picture shortwavedave  路  3Comments

affanshahid picture affanshahid  路  3Comments