AddNodeData

Is there alternative way to add to node on diagram? instead of using addNodeData…

What would you prefer to do?

If i use addNodeData when i drag and drop it will always place the node on the top of the screen like below

i should be able to drop the node where i want on the diagram, so how can i achieve this?

So you have implemented your own drag-and-drop handler, and the drop adds a new node to the diagram model? And you have not assigned any Diagram.layout?

If that is the case you need to compute the location of the drop in document coordinates and assign Node.location to that Point, either by setting that property on the new Node or via a Binding of that property by setting a property on the node data object. There are lots of examples of both throughout the samples and introduction pages.

The hard part is computing the drop point in document coordinates. There are a few samples that do this, such as HTML Drag and Drop, and external Clipboard pasting and HTML Drag and Drop. Look for the computation of the drop point in view coordinates and the call to Diagram.transformViewToDoc.

Thank you. i am able to add it properly now…:)