It seems to work but I do not understand what the edges: is the node that is entered.
I see the problem you're facing. Indeed, the syntax of Mondrian is a bit unintuitive. I recently introduced edgesFromAssociations: that makes it simpler to define edges. Consider the script: -=-=-=-=-=-=-=-= view nodes: (1 to: 5). view edgesFromAssociations: {1 -> 3 . 1 -> 5} -=-=-=-=-=-=-=-=
I could never succeed to find that. For me the API is bogus. I'm totally confused. Can you explain to me why the edges is the starting node?
The reason of "edges: nodes from: b1 to: b2" is to produce as much edges as there are nodes. For each node, an edge is created by evaluating b1 and b2 against the node.
Now when I do that the original shapes (squares inside squares) that I have turn into a single one and I do not understand why.
The interaction in Mondrian works well, but I agree this is a bit rough to use. The following: -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= view interaction whenEnteringUpdateNode: [:node | view edges: {node} from: #yourself toAll: #sureReferencingClasses.]. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= means that when you enter the node, you replace everything under the node with some edges. You therefore discard the classes in it.
I propose two versions of your code. A long (and ugly one), and a much nicer one, but which does a slightly different thing:
The script draw edges between a packages and classes. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= view interaction whenEnteringUpdateNode: [:node | view shape rectangle fillColor: Color orange; height: 7; width: 7. view nodes: node classes. view gridLayout gapSize: 2. view edges: {node} from: #yourself toAll: #sureReferencingClasses ] whenLeavingUpdateNode: [:node | view shape rectangle fillColor: Color orange; height: 7; width: 7. view nodes: node classes. view gridLayout gapSize: 2 ] withLayoutUpdate: true. view nodes: model allPackages forEach: [:pack | view shape rectangle fillColor: Color orange; height: 7; width: 7. view nodes: pack classes. view gridLayout gapSize: 2. ].
view gridLayout. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
This version draws edges between classes -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= view nodes: model allPackages forEach: [:pack | view shape rectangle fillColor: Color orange; height: 7; width: 7. view interaction whenEnteringUpdateNode: [:node | view edges: {node} from: #yourself toAll: #sureReferencingClasses ]. view nodes: pack classes. view gridLayout gapSize: 2. ].
view gridLayout. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=