@JP wrote:
Hi,
I am trying to add node to the another node(especially at port "T") when it's dropped from the palette.ExternalObjectsDropped
myDiagram.addDiagramListener("ExternalObjectsDropped", function (e) { var selectedNode = e.diagram.selection.first(); e.diagram.startTransaction("Add Node"); var selectnewNode= {name: "newNode",figure: "Circle",loc:selectedNode.location}; e.diagram.model.addNodeData(selectnewNode); // adding Node e.diagram.commitTransaction("Add Node"); var selectnewNode = e.diagram.findNodeForData(selectnewNode) e.diagram.startTransaction("Add Link"); var linkData = { to: selectedNode.data.key, from: selectnewNode.data.key, fromPort: "B", toPort: "T"}; e.diagram.model.addLinkData(linkData); // Adding Link e.diagram.commitTransaction("Add Link"); var selectLink = e.diagram.findLinkForData(linkData)
}
I have written some logic to move the newly node position to another node(which is dropped from palette) position
I am expecting output like this
But I am getting output like this:
And also that after dropping node and If I clicked button 'MakeNodeOnTop" which will give same output as I expected.
ExternalObejctDropped & MakeNodeOnTop() logic are same but expected output is not coming in ExternalObejctDropped. Can you tell me why?
I have add some example on this:
http://codepen.io/jothipandiyanjp/pen/pROyrb?editors=1000
Posts: 4
Participants: 2