Component arrows starting on wrong side if component has sub-components

+1 vote
asked Nov 20, 2019 in Question / help by BungledB (180 points)

I cannot figure out how (or if it is possible) to get the arrows connected to components which have components inside them to behave the same as for an empty component.

Here is an example of what I mean. What I want to happen is that arrows coming from the node and the cloud with comoponents inside them does exactly the same as the empty nodes / clouds.

@startuml
cloud "EmptyCloud1" {
}
cloud "EmptyCloud2"{
}
cloud "CloudWithComponents"{
  [Component1]
  [Component2]
}
cloud "EmptyCloud3"{
}
node "EmptyNode1" {
}
node "EmptyNode2" {
}
node "NodeWithComponents1" {
[Component3]
[Component4]
}

EmptyNode1 -d-> EmptyCloud1
EmptyNode2 -d-> EmptyCloud1
NodeWithComponents1 -u-> EmptyCloud1
EmptyCloud1 <-r-> EmptyCloud2
EmptyCloud2 <-r-> CloudWithComponents
CloudWithComponents <-r-> EmptyCloud3
@enduml

It doesn't make any difference which direction the arrow is going nor whether I used -r-> or -l->, for example. Is this deliberate, is it a bug, or have I just not understood how to do it?

Thanks.

commented Nov 21, 2019 by albert (3,520 points)

I'm not clear what you want, do you want to have a line between e.g.:

Component1 and EmptyCloud3

for this did you try e.g. Component1 <-r-> EmptyCloud3


commented Nov 21, 2019 by BungledB (180 points)
Sorry, I should have explained better. :-) I don't want an arrow from Component1 to EmptyCloud3, I want one from CloudWithComponent to EmptyCloud3, which goes from the right of CloudWithCompoents to the left of EmptyCloud3.

Arrows connected to empty components (for example EmptyCloud2) join the component on the side of the object which is closest to the thing they are joining to (in this case CloudWithComponents).

However I move things around, all the arrows connected to a non-empty component join that component on the left side.

When I put an arrow from CloudWithComponents to EmptyCloud3, it leaves CloudWithComponents in the top left corner and curves around, rather than leaving the component on the same side as the thing it's connected to.

Similary, NodeWithComponents1 has the arrow connected to the top-left corner rather than the top-centre.

Essentially, I want all the arrows to be straight and take the shortest path they can.

1 Answer

0 votes
answered Jun 12, 2020 by The-Lu (63,920 points)
edited Jun 12, 2020 by The-Lu

Hello B.,

A possible workaround is to use embedded diagram or sub-diagram with use of '{{' and '}}':

But pay attention to the fact: what you gain with, you also lose with (because it is an independent sub-diagram [without any link with the hosted diagram]) ; Also You can not use after Component1 or Component2, there are only accessible on the sub-diagram. 

See more details:

Then with this feature:

cloud CloudWithComponents #white [
== CloudWithComponents
..
{{
  [Component1]
  [Component2]
}}
]


[Click to see on the PlantUML online server]

We observe also one issue with the order of the element between the sub-diagram and the title of component (a dummy dotted line (with "..") above is necessary to achieve the expected result.): see also this defect /10967.

If that can help,
Regards,
Th.

...