SVG sprites work in a node text, but not in an edge text

+1 vote
asked Apr 28, 2025 in Bug by Marcelo

Hi there,
I'm using a SVG sprite to represent an InterruptFlow.
I've seen text-based sprites, but they get distorted when scaling.

I was able to use the SVG sprite in the node text, but not in the edge text.
Am I doing something wrong? If so, what would it be?

Any help is very much appreciated.

@startuml

' Part of this diagram is based on https://github.com/plantuml/plantuml/issues/1665

' === InterruptibleActivityRegion (thunder symbol) ===

' SVG
' adapted from https://www.svgrepo.com/svg/130890/thunder-bolt-arrow
sprite zigzagSvg <svg viewBox="0 0 32 32" xml:space="preserve">
<path d="m18.156 0-6.5688 11.016 17.952.0408-2.04-2.6724c-.204-.2652-.1632-.6528.1224-.8568.2652-.204.6528-.1632.8568.1224l3.2844 4.3044-7.956 4.0596c-.2856.1632-.6732.0408-.816-.2652-.1632-.306-.0408-.6732.2652-.816l0 0 5.202-2.652-18.9924-.0408 6.5688-11.016-15.4224-.0204c-.3264 0-.612-.2652-.612-.5916 0-.3264.2652-.612.5916-.612z"/>
</svg>

' ASCII
sprite $zigzagAscii {
    0000000FFFFFFF00
    000000000000F000
    00000000000F0000
    0000000000F00000
    000000000F000F00
    00000000F00000F0
    0000000FFFFFFFFF
    00000000000000F0
    0000000000000F00
}

rectangle nodes {
  :SVG sprite inline (no scale) <$zigzagSvg{scale=1}>;
  kill
  :SVG sprite inline with scale <$zigzagSvg{scale=0.6}>;
  kill
  :ASCII sprite (no scale) <$zigzagAscii{scale=1}>;
  kill
  : ASCII sprite with scale (gets distorted) <$zigzagAscii{scale=3}>;
  kill
}

rectangle edges {
  :A random node\n(didn't draw as input deliberately);
  ->ASCII sprite <$zigzagAscii> works;
  :The previous transition must contain a ASCII sprite;
  kill
  :A random node\n(didn't draw as input deliberately);
  ->SVG sprite <$zigzagSvg> does not work;
  :The previous transition must contain a SVG sprite;
}

@enduml

1 Answer

0 votes
answered Apr 28, 2025 by The-Lu (86,940 points)

Hello M.,

Yes, you have right: I have already notice that there are some issues on SVG sprite...

Here is a simple workaround, with adding `fill="black"` on the SVG sprite definition:

sprite zigzagSvg <svg viewBox="0 0 32 32" xml:space="preserve">
<path fill="black" d="m18.156 0-6.5688 11.016 17.952.0408-2.04-2.6724c-.204-.2652-.1632-.6528.1224-.8568.2652-.204.6528-.1632.8568.1224l3.2844 4.3044-7.956 4.0596c-.2856.1632-.6732.0408-.816-.2652-.1632-.306-.0408-.6732.2652-.816l0 0 5.202-2.652-18.9924-.0408 6.5688-11.016-15.4224-.0204c-.3264 0-.612-.2652-.612-.5916 0-.3264.2652-.612.5916-.612z"/>
</svg>

Here is the result:

Enjoy,
Regards,
Th.

commented Apr 30, 2025 by Marcelo
Oh, perfect! Works like a charm! Thank you so much! :-))
commented Apr 30, 2025 by Marcelo
By the way, for reference when implementing it officially (also in strictuml): the UML 2.5.1 specification describes the ExceptionHandler notation it in FIgure 15.63, Section 15.5.4 - Notation.
It is also described on https://github.com/plantuml/plantuml/issues/1665.
commented May 3, 2025 by The-Lu (86,940 points)

[Just for the record]

FYI: I just open this case, issue, wanted feature here:

...