Re: [w3c/uievents] Define what layerX/layerY do in presence of transforms. (Issue #398)

chrishtr left a comment (w3c/uievents#398)

> Would you be able to define precisely what you're doing / in which coordinate space are you operating?

Here's what it does currently (using X as an example; Y functions the same way):

1. Start with [pageX](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/pageX) (which is in document space [screen space offset by document scroll] and so includes transforms) 
2. Scale by the zoom of the frame (e.g. if the parent frame of an iframe placed a CSS or browser zoom on it)
3. Subtract off the layout offset of the "layer root" (see #135) from the root of the document, excluding any transforms on that element or any ancestor (that's what "kIgnoreTransforms" does).
4. Divide by the scale factor of step 2.

I don't see a good reason to ignore transforms in step 3 - subtracting something that ignores transforms from one that does makes no sense. I looked at the code history in mouse_event.cc and I think this was just an oversight. I'm happy to try shipping a fix for that, will try that now.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/uievents/issues/398#issuecomment-3070325191
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/uievents/issues/398/3070325191@github.com>

Received on Monday, 14 July 2025 17:10:13 UTC