I have a need to make images of electric circuits that am creating more interactive.
My plan is to draw the circuit using a standard EDA tool and store it as a SVG file. The file stored as SVG can then be opened by any modern browser.
What I would like to do now is to add a bit of JavaScript code into the SVG. When users hover mouse over certain sections of the circuit, the script must pop up tooltips describing those sections. As an example, when user places mouse on top of an IC, description of that IC is to pop up immediately.
The circuit is reasonably annotated in the SVG XML.
From what I have inferred so far, there is no automatic way of the JavaScript finding out what box/wire is the mouse currently hovering over. Of course it would find out if there was a look up table which mapped image coordinates with circuit annotations.
What this means is that every time the circuit changed, the look up table would also need to be updated.
Is there an easier way of finding out (without lookup tables) the annotated box/wire/component which the mouse is hovering over?