I'm currently developing a web application that requires connecting elements with lines. I would prefer the lines to not be limited to just horizontal or vertical paths. Additionally, I need to be able to detect clicks on these lines. I've explored several alternatives so far:
Utilize CSS rotation
I can create a div or hr element with the specific length and then apply the CSS transform property in their style. There is a related solution available somewhere on this platform.
Advantages:
- Simplicity.
- Possibility to detect clicks.
Disadvantages:
- Requires browser-specific CSS.
Generate the image on the server
I could design a web page that accepts fromx, fromy, tox, and toy as GET or POST parameters and outputs the image of the line.
Advantages:
- Simplicity.
- Standardization.
Disadvantages:
- Inability to detect clicks if lines intersect (which they do).
- Necessitates server interaction.
Use multiple small divs
I could create numerous 5x5 divs and position them to create a line.
Advantages:
- Possibility to detect clicks.
- Standardized approach.
Disadvantages:
- Complexity.
Consider Giving Up
If all else fails, I may choose to use gwt-connectors. Although it only supports drawing horizontal and vertical lines, it is very easy to use and allows for moving connected objects.
Which option would you recommend? Are there any other alternatives that I may have overlooked?