Re: New methods to support interactivity

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

Interestingly, msElementsFromRect() behaves a little differently from
element(s)FromPoint.  It includes elements that have "pointer-events=none".

Paul


On 23 July 2015 at 09:41, Philip Rogers <pdr@google.com> wrote:

> 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 Thursday, 23 July 2015 02:29:38 UTC