New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify relation of isPointInFill and pointer-events #416
Comments
Currently only Chrome seem to support It needs to get checked if it respects winding rules set by Link to the spec: https://svgwg.org/svg2-draft/types.html#InterfaceSVGGeometryElement |
@heycam Do you recall the intention of the functions? |
I don't see any reason for having these functions depend on the |
I think the idea was that the However, then again, hit testing on a shape within a Also, should it matter if I would prefer that those functions operate as independent of the context the element lives in. Independent where they are and independent if they get clipped or not. However, what about the winding rule? Add an optional additional argument in |
The Working Group just discussed
The full IRC log of that discussion<BogdanBrinza> topic: Clarify relation of isPointInFill and pointer-events<BogdanBrinza> GitHub: https://github.com//issues/416 <AmeliaBR> scribenick: AmeliaBR <krit> https://svgwg.org/svg2-draft/types.html#InterfaceSVGGeometryElement <AmeliaBR> Dirk: The specification isn't clear about how isPointInFill/Stroke should be calculated? <AmeliaBR> ... in particular, what does it mean that "normal hit testing rules apply" with respect to pointer-events property <AmeliaBR> https://svgwg.org/svg2-draft/interact.html#PointerEventsProp <AmeliaBR> ... the way it's written, it suggests that the point would return false if pointer events setting would make it not sensitive <AmeliaBR> ... I don't think we should take the pointer events property into account at all <AmeliaBR> ... if its none, the method would always return false; if bounding-box, would all parts of the box be both fill and stroke? It doesn't make sense <AmeliaBR> Amelia: I agree, as written it doesn't make sense. Not sure of original intent. Maybe the intention was to reference some of the algorithms in the pointer-events section. <AmeliaBR> Dirk: Maybe it would make sense to say that isPointInStroke should include all points that would be sensitive with pointer-events: stroke. <AmeliaBR> ... If we follow that definition, however, it would mean that it would be affected by clip-paths. <AmeliaBR> ... There are also confusion about shapes in <defs>. They don't have pointer-events, but they could still use this interface. <AmeliaBR> (or children of pattern, clipPath, mask, etc.) <AmeliaBR> ... The current Chrome implementation isn't affected by whether the shape is rendered or clipped. <krit> https://html.spec.whatwg.org/multipage/scripting.html#dom-context-2d-ispointinpath <AmeliaBR> ... Results are similar to the canvas isPointInPath API, although that also takes a winding-order (equivalent to fill-rule) <AmeliaBR> Amelia: So, if we don't have that parameter, we need to use the fill-rule on the element? <krit> https://drafts.fxtf.org/css-masking-1/#the-clip-rule <AmeliaBR> Dirk: Yes, but for children of a clipPath, the relevant property is clip-rule. <AmeliaBR> Amelia: That's a pain. We have these two properties that do the same thing, but which to use depends on context. <AmeliaBR> Dirk: So, first question: Do we agree that the pointer-events property on the element shouldn't affect the API results? <AmeliaBR> RESOLVED: isPointInStroke/Fill methods shouldn't be affected by current value of pointer-events property <AmeliaBR> Dirk: Next question is how do we calculate it? <AmeliaBR> Dirk: My general suggestion is to align with HTML canvas spec. <AmeliaBR> Amelia: Do you know implementation status for the canvas methods? <AmeliaBR> Dirk: I did WebKit, a colleague did Gecko, Blink has it as well. <dstorey> https://developer.microsoft.com/en-us/microsoft-edge/platform/catalog/?page=1&q=isPointIn <- browser support <AmeliaBR> Amelia: So essentially, the canvas API is fixed <AmeliaBR> Dirk: The downside is that we then can't set it up to automatically match clip-rule <AmeliaBR> Amelia: But the canvas API accepts a parameter when you call the method, so we could extend our method as well, if an author wanted to query the clip-rule and pass it to the method. <AmeliaBR> Liam: But we could probably add that later, right? It doesn't have to be now. <AmeliaBR> Dirk: Probably <AmeliaBR> Dirk: It's not just clip-rule, it's also parent clip-path <AmeliaBR> Amelia: Oh, I see. Yes, I agree to keep the simpler approach for now. <AmeliaBR> ... We could later extend it by adding an options object, similar to the proposed options for getBBox() <AmeliaBR> Dirk: I'd still recommend we use the pointer-events algorithm (for fill versus stroke), just with not taking clipping paths into account <AmeliaBR> Amelia: Can you come up with a draft text for review? <AmeliaBR> Dirk: Yes <AmeliaBR> RESOLVED: Use the pointer-events algorithms for defining which areas are fill and which are stroke, EXCEPT for ignoring clipping <AmeliaBR> Dirk to create proposal |
Specify algorithm used for isPointInFill() and isPointInStroke(). #416
Currently the section Interface SVGGeometryElement is not very specific how
isPointInFill
andisPointInStroke
correlate to thepointer-events
CSS property.The spec says:
What happens when the property is set to
stroke
and we ask forisPointInFill
? OrvisibleStroke
withvisibility
hidden
and asking if the point is in the full area?I suppose we follow the rules for hit testing as if the
stroke
value was set forpointer-events
onisPointInSroke
and take things like clipping path into account but notvisibility
? ForisPointInFill
fill
?The text was updated successfully, but these errors were encountered: