I am trying to use the op.layout() function to effectively lay out some components I have just created with the op.create() function. I have stubbornly tried to use layout(), but caved in the end and manually set the node coordinates for each component with .nodeX and .nodeY, so this “issue” is non blocking.
Having said this, I struggle to understand the logic of the layout function. I will write a few examples below with screenshots to make myself as clear as possible.
Creating 2 TOPs and calling layout has the desired output
op(‘myContainer’).layout()
Adding a third component, in my case a container, pushes the container to the second row.
This forces me to have to tweak the layout() parameters in order to keep all the components in a straight line. I assume this is because it grid is set to 2 (even though on the docs I see that it defaults to 0) so I try and play with gridRows. However, tweaking the gridRows parameter, forces layout to use alphabetical order to layout the components, thus inverting the original order (the correct one).
op(‘myContainer’).layout(gridRows=3)
So I decide to specify the components I want layed out, assuming this will “force an order” instead of relying on the alphabetical nature of the names.
op('myContainer').layout(op("select0"), op("null0"), op("container0"), gridRows=3)
But the result is the same. As soon as I try tweaking the layout parameters, alphabetical order is forced on the layout (this happens also if I set to true horizontal or vertical).
I feel like this is a bug, but I could be missing something.


