Pointer Events

From SVG
Jump to: navigation, search

Mozilla wants us to reexamine the pointer-events model, including potentially new, more intuitive values. This would also be applicable to masks, clips, filters, and other effects. The model should take into account CSS and HTML, as well.

Here were some of the errata we decided to forego in order to keep options open for a revision in SVG 2.0:

 Capturing pointer-events with a zero opacity mask
 Category: 3
 In reference to: http://www.w3.org/TR/2003/REC-SVG11-20030114/interact.html#PointerEventsProperty
 Description
 It's unclear whether if an element has a mask, pointer-events are still 

 captured even in areas where the mask goes to zero opacity. Don't want 
 nearly transparent and fully transparent to behave differently.
 Resolution
 If an element has a mask, pointer-events are still captured even in areas 
 where the mask goes to zero opacity.
 Change

 In http://www.w3.org/TR/2003/REC-SVG11-20030114/interact.html#PointerEventsProperty, 
 change:

 to:

     16.6.1 Clipping paths, masking, and pointer events

     The effects of masking and clipping differ with respect to pointer-events. 
 A clip path is a geometric boundary, and a given point is clearly either 
 inside or outside that boundary; thus, pointer events must be captured 
 normally over the visible areas of a clipped element, and may be captured 
 normally over the clipped areas depending upon the different values of 
 the pointer-events property, as described in the definition of clipping 
 paths. By contrast, a mask (like a filter) is not a binary transition, 
 but a pixel operation, and different behavior for fully transparent and 
 'almost but not fully transparent' would be confusing; as a consequence, 
 for elements with a mask applied, pointer-events must still be captured 
 even in areas where the mask goes to zero opacity. If an author wishes 
 to achieve an effect where the transparent parts of a mask allow pointer-events 
 to pass to an element below, a combination of masking and clipping may 
 be used.
 Unclear how clip-path affects bounding boxes
 Category: 3
 Test case: clip-pointer-bbox.svg
 Description
 It is  unclear whether the bounding-box of an object should take into account 
 a clip-path on that object.
 Resolution
 The clip-path should not affect the bounding-box, but the getRenderedBBox 
 would be affected by stroke, markers, filters, and clip-path. Note: this 
 erratum is resolved by another erratum, 'clippath-pointer-events'
 Clarify clipPath and Pointer-Events
 Category: 3
 Reported by: Doug Schepers
 Comment:
 Description
 It is unclear where pointer events should be triggered on elements with 
 a clipping path applied.
 Resolution
 An explanation of the different values for 'pointer-events' and how they 
 are affected by a clipping path will be added.
 Change

 In http://www.w3.org/TR/2003/REC-SVG11-20030114/masking.html#EstablishingANewClippingPath, 
 change:

 to:

     14.3.6 Clipping paths, geometry, and pointer events

     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, or a child of the referencing element) 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 outside of the clipping region, regardless 
 of the setting of the 'visibility' property. Within the clipping region 
 the 'visibility' property acts normally on event sensitivity. 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' or 'fill', for example. Note that for 
 a child element of an element that references a clip-path, the relevant 
 'pointer-events' value is that of the target element (i.e., the child element), 
 not the parent element. In other words, if a 'g' element has both a 'clip-path' 
 property and the 'pointer-events' property value of 'visible', but a 'circle' 
 child element has a 'pointer-events' property value of 'all', then the 
 circle would be sensitive to pointer events even if it were clipped.

     Note that this property-dependent event clipping behavior applies only 
 to elements clipped by the 'clip-path' property. For elements clipped by 
 elements that establish a new viewport, such as nested 'svg' elements, 
 events are always clipped for the clipped portions of a target element.