Open Mearman opened 3 months ago
This one isn't so obvious in terms of a fix. When you paste in nodes we have to make some assumptions about their layout, specifically that they should cursor-relative. As such we have to traverse the x & y coordinates of the pasted items and then choose the left-most, we then make set that node to be where the cursor is, and finally set all other node x & y coordinates to be relative to it.
Pasting in nodes without visual metadata is akin to posting {x: 0, y: 0}, which means what we're doing is somewhat Working As Intended. For graphs generated by the API we may want to run Dagre or something as part of the serialization process, but I don't think the right approach is to have the Editor do a layout pass because that would be very unpredictable.
To clarify the last sentence, if you paste in a load of nodes then run layout, Dagre is likely to pick a "shape" for the graph you didn't necessarily anticipate. This is especially true if there are nodes already in place in the graph, and which you may not want to have moved.
When pasting this board:
Default node positioning is not used and produces this
After
Reset layout
is used