I am implementing a patch-cord based system for connecting boxes. I would like to know what my best options are for rendering the patch-cords, here is a screen shot, the cable is a mock-up in Gimp:
The patcher background now is a <div>
, so are the boxes and so are the "ports" (the blueish little squares inside the boxes that are the terminals of the cables).
Should I go straight to making the background a canvas or dynamically updated SVG? Or is it better to use an HTML element for each cord. I could see these advantage over canvas:
- perhaps the CSS can be massaged to make the coords automatically move when the boxes move
- I'm given a spatial partitioning for free, i.e. I will have an easier job detecting clicks on the coords.
- I could use
z-index
to solve the layering on top of the boxes
The disadvantages of layered HTML elements might be
- performance when there are many cords?
- what happens when cords overlap. Any problems with transparent backgrounds?
Edit: In terms of interactivity, I am concluding that inline SVG would be the best approach. However, I am worried about the performance. For example, this simple demo where you can drag some SVG components around is ridiculously slow on a modern computer. Is it just bad programming or an inherent problem of SVG?