Adding javascript to SVG

+6 votes
asked Nov 12, 2019 in Wanted features by colbygk (140 points)

Support of ad hoc transforms in SVG is supported via the inclusion of javascript. If it were possible to have the following features added:

  • Naming of all SVG elements via ID, (names that map to original naming in PlantUML would be best).
  • Set those IDs to provide access to creating 'onclick' handlers.
This would allow the ability to click on individual rects that could zoom in on them and have further diagrams become apparent.  It's rects all the way down!
Or if you could suggest a path forward to submitting a PR for it.  My initial guess after thinking about it this afternoon:
  1. A snippet of transform code could be included during a pre-processing step that is boiler plate included with the PlantUML standard library
  2. This code could be added to the SVG creation step with onclick handlers added to element tags
    1. If ID tags were available, it would be possible to get a little more syntactically nice by finding the center of the object's ID

1 Answer

0 votes
answered Nov 22, 2019 by bschwarz (180 points)
I would like to see this feature as well since it would allow animated diagrams in the browser.
...