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

Re: New methods to support interactivity

From: Philip Rogers <pdr@google.com>
Date: Wed, 22 Jul 2015 14:41:23 -0700
Message-ID: <CAJgFLLuRun_CCNv1k99doBsJFY1X=g1jyx53C06sWTY9PwzQOg@mail.gmail.com>
To: Amelia Bellamy-Royds <amelia.bellamy.royds@gmail.com>
Cc: Paul LeBeau <paul.lebeau@gmail.com>, www-svg <www-svg@w3.org>
Both Chrome and IE/Edge support elementsFromPoint() on SVG elements, as
it's defined on Document.

Microsoft has msElementsFromRect that will hopefully be implemented more
widely because it's quite useful.

On Wed, Jul 22, 2015 at 2:35 PM, Amelia Bellamy-Royds <
amelia.bellamy.royds@gmail.com> wrote:

> Perhaps we need a reply from the Firefox team explaining why the existing
> methods to do this (enclosure/intersection)[1][2] were never implemented?
>
> Can the spec be made more clear? Are there simpler solutions which would
> address the problem without performance issues or implementation
> difficulties?
>
> I think the other browsers all have implementations, but I've never used
> the methods enough (because of the lack of Firefox support) to know whether
> they are buggy or not.
>
> ~ABR
>
> [1]: http://www.w3.org/TR/SVG11/struct.html#InterfaceSVGSVGElement
> [2]: https://svgwg.org/svg2-draft/struct.html#InterfaceSVGSVGElement
>
>
> On 22 July 2015 at 14:28, Paul LeBeau <paul.lebeau@gmail.com> wrote:
>
>> Sorry. Forget I said anything. I forgot about the enclosure and
>> intersection calls on SVGSVGElement.
>>
>> Paul
>>
>>
>> On 22 July 2015 at 22:40, Paul LeBeau <paul.lebeau@gmail.com> wrote:
>>
>>> 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 21:42:12 UTC

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