Re: New methods to support interactivity

Paul LeBeau <[email protected]>
Newsgroups gmane.comp.web.svg
Message-ID <CACfsppCGgUOnSnY7z0QXn5GfWG+BnVHfGjeP8pfXTrntmzx2HA@mail.gmail.com>
> 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 <[email protected]> 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 <
> [email protected]> 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 <[email protected]> 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 <[email protected]> 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
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.