-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Rel_Left/Right/Up/Down are not followed when using LAYOUT_LEFT_RIGHT. #174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @oliv3r, this is known PlantUML behavior which we cannot directly influence. We could only introduce a new @startuml
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Context.puml
' possible (incomplete) extension start >>>>>>>>>>>>>>>>>>
!global $right_rotated=%false()
!procedure LAYOUT_LEFT_RIGHT_KEEP_DIRECTIONS()
!global $right_rotated=%true()
left to right direction
!endprocedure
!unquoted procedure Rel_D($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
!if ($right_rotated)
$getRel("-RIGHT->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
!else
$getRel("-DOWN->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
!endif
!endprocedure
!unquoted procedure Rel_Down($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
!if ($right_rotated)
$getRel("-RIGHT->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
!else
$getRel("-DOWN->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
!endif
!endprocedure
!unquoted procedure Rel_U($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
!if ($right_rotated)
$getRel("-LEFT->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
!else
$getRel("-UP->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
!endif
!endprocedure
!unquoted procedure Rel_Up($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
!if ($right_rotated)
$getRel("-LEFT->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
!else
$getRel("-UP->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
!endif
!endprocedure
!unquoted procedure Rel_L($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
!if ($right_rotated)
$getRel("-UP->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
!else
$getRel("-LEFT->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
!endif
!endprocedure
!unquoted procedure Rel_Left($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
!if ($right_rotated)
$getRel("-UP->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
!else
$getRel("-LEFT->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
!endif
!endprocedure
!unquoted procedure Rel_R($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
!if ($right_rotated)
$getRel("-DOWN->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
!else
$getRel("-RIGHT->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
!endif
!endprocedure
!unquoted procedure Rel_Right($from, $to, $label, $techn="", $descr="", $sprite="", $tags="", $link="")
!if ($right_rotated)
$getRel("-DOWN->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
!else
$getRel("-RIGHT->>", $from, $to, $label, $techn, $descr, $sprite, $tags, $link)
!endif
!endprocedure
' possible extension end <<<<<<<<<<<<<<<<<<
' now it can be activated or not
LAYOUT_LEFT_RIGHT_KEEP_DIRECTIONS()
System(sysA, "System A")
System(sysB, "System B")
System(sysC, "System C")
Rel(sysA, sysB, "Rel")
Rel(sysB, sysC, "Rel")
Person(P,"P")
Person(PU,"P Up")
Person(PD,"P Down")
Person(PL,"P Left")
Person(PR,"P Right")
Rel_Up(P, PU, "Up")
Rel_Down(P, PD, "Down")
Rel_Left(P, PL, "Left")
Rel_Right(P, PR, "Right")
@enduml Without commented With called @Potherca: should we add an extension like this, or are our macros complex enough? What do you think? Best regards |
@kirchsth I figured ;) but as a user of C4; I would expect this to 'just work'. So if this can be hidden in a macro, that sounds like a big pro to me? |
With a simple graph like

The behavior changes significantly (left becomes up) when using LAYOUT_LEFT_RIGHT.

And so to get the design right, one has to quirkingly use Up/Down to mean Left/Right.

The text was updated successfully, but these errors were encountered: