PlantUml component relative posithion strange behaviour

37 Views Asked by At

Here is my simplified component diagram:

@startuml
component TopLeft
component TopRight
component BottomStretch {
    'portin port_test
}
TopLeft -[hidden]r- TopRight
TopLeft -[hidden]d- BottomStretch
TopRight -[hidden]d- BottomStretch
@enduml

, and as long as BottomStretch is empty, every component is allocated as expected.

PlantUML image

But if we put something inside the BottomStretch component (removing comment in this example), this springs to the top right:

enter image description here

Is there some way to control component relative location?

And one additional question: is it possible to stretch the bottom component so that its left coincides with left of TopLeft, and right - with right of TopRight?

Thank in advance for all comments and suggestions

1

There are 1 best solutions below

3
Fuhrmanator On BEST ANSWER

If you un-hide the links that try to force the layout, you can see that the connections are going to the left side of the BottomStretch component. I think this is because port_test is now the top element in that group.

Using that hypothesis as a clue, I changed just one of the links to link to the (new) top element (port_test):

@startuml
component TopLeft
component TopRight
component BottomStretch {
    portin port_test
}
TopLeft -r- TopRight
TopLeft -d- BottomStretch
TopRight -d- port_test
@enduml

Here's the result:

enter image description here

Hiding the links ([hidden]) and making both vertical ones go to port_test should give you the result you expect (click the image to see the code):

enter image description here