MouseOver events - interactive svg
Hi,
I have an interactive svg document that I want to convert into an interactive pdf. As I understand it there are no simple ways to add mouseover events to different areas of a pdf document based upon the content in the pdf itself. For the purposes of understanding consider a patchwork diagram where each patch has data which I want to display when the cursor moves over the corresponding area. I'm trying to replicate through code what an interactive svg can do readily.
I have been able run a simple document javascript set Interval function that gives me a mouseX and mouseY position at regular intervals. I am able to define the locations of the patches as a series of polygons realating to document vertices. I could sub-divide those polygons into triangles and test if the X and Y coordinates are within those areas using a triangle barycentric algorithm. If I have say 6000 patches I’m worried that this may all get rather slow to compute every time the setInterval function is called - currently 50 milliseconds.
I’m wondering if I’m missing some capability that I don’t know about (is there a 2d equivalent of the 3dannots object for example – or should I do this using a 3D object with a fixed camera ?) .
I could map all of the pixels to a reference number and look that up (a table with about half a million entries ...) – is that too many pixels to loop through at each setInterval call ? Is there anything in the inner workings of an image structure definition that is a useful trick ?
Many thanks for any tips !