W3C home > Mailing lists > Public > www-svg@w3.org > July 2015

New methods to support interactivity

From: Paul LeBeau <paul.lebeau@gmail.com>
Date: Wed, 22 Jul 2015 22:40:57 +1200
Message-ID: <CACfsppAGdwk5WiWL6k0nuUTnxK-qPvxb0bLJ6zx_aXXZhg=vXQ@mail.gmail.com>
To: www-svg <www-svg@w3.org>
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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:55:02 UTC