I am currently working with a GoJS canvas where users can create nodes as they please, and the application needs to process these nodes in a specific sequence.
The GoJS documentation provides a method called gojsNodeObject.findTreeLevel()
, which gives the level of a node in the diagram. This method has been functioning well for me, but recently I encountered an issue.
You can view my diagram on fiddle at http://jsfiddle.net/2pqretgu/1/
According to the current logic, the sequence being returned is
["s1", "s2", "s3", "s4", "i1", "i2", "i3", "j1", "j2", "j3", "i4", "j4"]
However, I would like the sequence to follow these rules:
- i1 should come before j1
- j1 should come before i2 and i3
- i2 and i3 should come before j2 and j3
- j4 should be last
In essence, I am trying to execute the nodes based on layers created by the layered layout without relying solely on the layout due to the possibility of user changes.
If anyone could provide assistance or guidance on this matter, it would be greatly appreciated.