Walter I am trying to get the objects within objects. Let me explain. Now there are 4 nodes initially. When we drag and drop a fifth node comes up, I am able to get the model data using node counts and knowing which node came newly.
Case 1: Now what i am trying to find is - a object within first node is there. I don’t know what kind of object that is or how to get it and get the co ordinates. This is small object which when clicked gives context menu to clear or add other objects.
Similarly case 2,. when newly added object is dragged into node 1, it creates node 2. Similarly though i can get the new node , how to get the smaller objects within the node ?
Like what could they be called ? inports and out ports ? But the inports and outports dont have the location x and y details. So using the model.nodedataarray and object value that it provides is useless.
how to get every single object/diagram within a dragged diagram inside canvas pls?
You can iterate over all of the Nodes in a Diagram via Diagram.nodes. Similarly for Links, use Diagram.links.
Once you have a Node or a Link, you can traverse its visual tree. If the object is a Panel, you can iterate over its Panel.elements.
If you care about specific ports on a Node, you can iterate over the node’s Node.ports. But if there is only one logical port per node, use the methods on the Node class to navigate through the diagram’s graph.
Now I made some progress , I see that they made a template like below.
Sub panel Shapes ?
For every new node it has click object … So if there are 5 nodes, then there are 5 templates like this added. This has this below code. Now thing is this one is below the nodes ? Now the Panel does not come under according to gojs, panel is on top of node. so i cant find a node and find these panels below them can I ?. How to find these objects ?
If the template had given that “Circle” Shape a GraphObject.name, say “CIRCLE”, then you could have found it at run-time by calling node.findObject("CIRCLE")
But it doesn’t have a GraphObject.name, so you need to traverse the visual tree of the node and find that shape. If you always know exactly how to get there from the node, you could hard-code it by calling Panel.elt. But that does make it susceptible to changes in the node template in future versions of your software.