How to get some space beween participants - which source module ist best?

0 votes
asked Feb 16, 2017 by anonymous

This great tool cares to get the participants as close together, their distance is determined by the max. message length between them. Right idea !

To get some optical freedom I would like to specify a "padding" between the participant definitions e.g.

box "1st"
participant "Alice Bloom" as Alice
end box

padding 10px | 1mm | 1in

box "2nd"
participant "Bob Meyer" as Bob
end box

This would give some freedom. I have downloaded the source and I will surely find the place where it is best to add this feature and if the 'master' likes it ... of course I will contribute.

Yet to accelarate the process - my question ... where is it best to put such feature in? If there are any good hints ... I would appreciate saving the time to explore it all by myself.

Thanks for caring ... Helmut Scherzer

1 Answer

0 votes
answered Feb 16, 2017 by plantuml (144,190 points)

Thanks for the suggestion.

We like the idea of adding padding option, so here is a new beta:

This beta works with the following diagram:

skinparam ParticipantPadding 20
Alice -> Bob : hello

This kind of modification is quite easy to do (when you are used to PlantUML code...), so we did it directly.
The setting can be set in pixel only (which is consistent other values).

Other padding settings may be implemented on demand, so please ask!


commented Feb 17, 2017 by anonymous
edited Feb 17, 2017
Hello "plantUML Team",

Thanks VERY MUCH for your kind answer and your positive attitude towards improvements - that is not quite normal, typically you receive an argument why ideas won't be implemented.
You went beyond that and made an immediate implementation - Wow ! That's impressive.

Yesterday I played a bit with the code after I got it debugged in Eclipse. It didn't take long to find the right point

final ParticipantBox box = new ParticipantBox(head, line, tail, delayLine, this.freeX + 50, // HSX +50 = distance between boxes
        skinParam.maxAsciiMessageLength() > 0 ? 1 : 5); // HSX 5 = participant's box width

As you made a very good coding (!) the padding could be faked in the source simply by adding an amount to the startX parameter.

Another I found was to make the boxes itself larger by changing the outMargin (here 5) parameter, but I don't think that this is a real improvement, whereas the box-padding certainly is.

The new version is working. However, my idea of the padding compiles to adding space to "startingX" parameter whereas you interpreted it as adding to the "outMargin" parameter.

If users like both versions then the syntax

skinparam ParticipantPadding 20,50  // <addWidth>,<addOffset>

could be implemented which would allow users full control.
If this is overdoing - I would prefer the current syntax to be applied to the "startingX" parameter to see some space between the boxes rather than having more space within the boxes.

As all of that is likely easy to I will be waiting for your completion rather than changing the code myself - always good if it comes from the 'master'.

Thanks again and Cheers … Helmut
commented Feb 20, 2017 by anonymous
The final solution works perfectly !
Cheers ... Helmut
commented Feb 20, 2017 by plantuml (144,190 points)
Finally, the following skinparameters have been implemented:
skinparam ParticipantPadding 20
skinparam BoxPadding 10