New methods to support interactivity

As SVG takes off more and more, I believe there is a need for better ways
to interact with documents.  At the moment interaction is pretty limited.
We only have mouse in/out events, CSS hover and Document.elementFromPoint().

Several times in recent weeks people have asked on StackOverflow for ways
to detect which elements are under the pointer.  At the moment, the only
way to do that is with elementFromPoint().  But that has limitations.

At the moment some simple interactivity tasks are impossible, or require
ugly hacks.

Another common task is to select lines/edges in a chart.  The best solution
we have at the moment is to add invisible fat lines over the top of the
real ones.

I think it would be nice to add some more methods to enable better
interactivity. For example:

elementsFromPoint
    Get all elements under a point

elementsWithinBox
    Get all elements that intersect with the given BBox.

pointInPath / pointInShape
    Return true if a point is within the fill (or stroke?) of a shape

etc.

Paul

Received on Wednesday, 22 July 2015 10:41:49 UTC