More control over alignment of text

+1 vote
asked Jun 1, 2015 in Wanted features by Fuhrmanator (1,700 points)

There's already a question related to State Diagrams, and you've added some feature to globally control text alignment with a skinparam. http://plantuml.sourceforge.net/qa/?qa=3015/left-aligning-transition-text-in-state-diagrams

However, in some cases, namely Sequence Diagrams, I'd like to control how text is aligned on a per-text basis.

For example, in sequence diagrams, the text of messages is always left-aligned. This might be OK for narrow-ish diagrams, but maybe we'd like it to be aligned with the start of the arrow. If a message goes from right to left, then the message text should be right-aligned.

a -> b : Hello world this is a very long message
b -> a : return()

Maybe some syntax that's creole-like, e.g. [[left-aligned[[ or ]]right-aligned]], mabye (( or )) can be used? For instance:

b -> a : ]]return()]]

As usual, thanks for all the quick improvements!!!

1 Answer

+1 vote
answered Jun 1, 2015 by plantuml (294,960 points)
selected Apr 24, 2017 by Fuhrmanator
 
Best answer

It's not exactly what you are expecting, but today there is yet another undocumented feature:
 
@startuml
skinparam sequenceMessageAlign right
a -> b : Hello world this is a very long message
b -> a : return()
@enduml


Maybe we could add a setting "arrowStart" for sequenceMessageAlign

@startuml
skinparam sequenceMessageAlign arrowStart
a -> b : Hello world this is a very long message
b -> a : return()
@enduml

(not working yet)

So that text message would be aligned with the start of the arrow?
I am wondering if a new creole syntax would be too cryptic.

The drawback of our suggestion is that the setting would apply to the whole diagram.
 

commented Jun 1, 2015 by Fuhrmanator (1,700 points)
I like the answer of a "skinparam sequenceMessageAling arrowStart" for this context. However, I feel the text alignment problem will appear elsewhere (e.g., notes, legends, etc.) One syntax to rule them all? Wookie markup uses ">" "^" and "<" to specify table cell alignment. http://meta.wikimedia.org/wiki/Wiki_markup_tables#Wookee_syntax MultiMarkdown uses a ":" to specify alignment ":left aligned text" "right-aligned text:" ":centred text:" -- it could be another character. If ever you consider it, you can remember this comment :)
...