How to stop classes out of a package to pull classes inside package when related?

0 votes
asked Dec 23, 2021 in Question / help by Cunami

Hi everyone, I have tried multiple approaches for my issue but could not find a solution, hope someone can help me.

The best way to explain my issue is via a "actual - expected" example. The first image is how it currently is and the second is how I would like it to be.

So here is the how it currently is:

http://www.plantuml.com/plantuml/uml/VP512iCW44Nt_nIpBaJGR4k9Ng6vWAH35qrKebsbkNib0QbjoMny-3xCX-bYidDwJYCY9t9suXZim5SEThR9p-IyOm0OHXiZzJuie3nOWHnys3jJa0ksppsZzqIUxLrHIVbbAwcA_6VR7rkrK5KBSx37oACzHXtQqkAp1D3xG49SYFI6v8KW0sWwlvg6j2oa2hM0eLEcNAYGAjIYOtVBfta3

You notice how Top "pulls" A to the right and B to the left. I would like them to stay centered in the package as in the example below where I just removed the connection.

https://www.plantuml.com/plantuml/uml/VP0n3iCW34Ltdy9pfGp0sY7X2Zs1bLeTcX24wPJcxhKOK29K_f8Ntl0_Z98fvS-wW736G2jBf9aV72bHtXA6BJ1ezFHDByPeTW3Kp0k9uBIN7qtv7d2Hfh4dQLN-jwwrnsc5lQpmdHvlUZtUTgskQ4QKJ7Z_3eFUi9Ajv00ytfIqkvAjv63ayDGd_m40

Thank you in advance.

commented Dec 23, 2021 by albert (3,180 points)
So when I interpret the images correctly you would like to have "A" and "B" be centered in "P1" and "P2" and not evenly distributed (so on 1/3-rd and 2/3-rd) of the line. And have "Top" still in the middle of the line.

1 Answer

0 votes
answered Dec 23, 2021 by Martin (8,320 points)
 
Best answer

Not a brilliant answer I'm afraid, but you can add in some dummy padding classes and then hide them:

A -left- dummyA1
A -right- dummyA2
hide dummyA1
hide dummyA2

And the same for B

(click diagram for online server)

...