Re: Event handling in clipping conditions

Hi, Helder-

The SVG WG has resolved on an erratum [1] which we believe will clarify
this issue:

[[
14.3.6 Clipping paths and geometry

A clipping path is conceptually equivalent to a custom viewport for the
referencing element. Thus, it affects the rendering of an element, but
not the element's inherent geometry. The bounding box of a clipped
element (that is, an element which references a 'clipPath' element via a
'clip-path' property) must remain the same as if it were not clipped.

With regards to pointer-events, while the visible parts of a clipped
element receive pointer events normally, parts of a clipped element
which are outside the extent of the clipping path must be treated as if
they have a 'visibility' property value of 'hidden'. Therefore, an
element which has 'pointer-events' property values which depend upon the
visibility of the element (i.e. 'visiblePainted', 'visibleFill',
'visibleStroke', 'visible') will not receive pointer events for the
occluded parts of the element. For example, a circle with a radius of 10
which is clipped to a circle with a radius of 5 will not receive 'click'
events outside the smaller radius if it has the default 'pointer-events'
property value of 'visiblePainted', but will if has the property value
of 'all'.
]]

We believe that this is the most consistent and predictable behavior,
and that it should be relatively simple to implement.  Note that,
because this was not previously specified, there is currently a lack of
interoperability between implementations, so all the implementations
will have a bit of work to do to match this behavior.  I will put
together a few tests to make sure that it's interoperable.

The tests will include:
 * testing to make sure the bounding box of a clipped shape is correct
 * testing that the visible part of the shape receives pointer events
 * testing that the occluded part of the shape doesn't receive pointer
events with the default pointer-event value of 'visiblePainted', or
other 'visible...' values
 * testing that the occluded part of the shape does receive pointer
events with other pointer-event values

Can anyone think of other useful tests?

[1]
http://dev.w3.org/SVG/profiles/1.1F2/errata/errata.xml#clippath-pointer-events

Regards-
-Doug

Helder Magalhães wrote (on 11/26/08 1:43 PM):
> Hello SVG-WG! :-)
> 
> 
> Following a thread [1] (which contains a test case) within the Batik's
> mailing list, the doubt is whether event handling should occur
> whenever relevant graphical content is under the pointer. Quoting
> Thomas DeWeese:
> 
>   Neither SVG 1.1 or SVG 1.2 Tiny says anything about clipping
>   with respect to when 'relevant graphical content is under the pointer'. [2]
> 
> I've crawled through the potentially relevant parts of the
> specification [3] [4] and through the SVG-WG mailing list archive [5]
> and also couldn't find an answer for this. Could some pointers be
> provided and/or the WG pronounce about this (somehow tricky) detail?
> 
> 
> Best regards,
> 
>   Helder Magalhães
> 
> 
> [1] http://www.nabble.com/Likely-Batik-bug-with-SVG-scrollbars-td20676287.html
> [2] https://issues.apache.org/bugzilla/show_bug.cgi?id=46289#c0
> [3] http://www.w3.org/TR/SVGTiny12/interact.html#EventDispatching
> [4] http://www.w3.org/TR/SVGTiny12/script.html#EventHandling
> [5] http://lists.w3.org/Archives/Public/www-svg/
> 

Received on Thursday, 4 December 2008 15:44:09 UTC