Re: Transformed Pointer Coordinates?

On Jan 29, 2013, at 9:28 AM, Doug Schepers <> wrote:

> Hi, folks-
> When elements are transformed (shifted X/y through translate, larger or smaller through scale, etc.) using CSS transforms or SVG, dealing with pointer events becomes more complicated and unintuitive... things just aren't where they appear to be.
> This leads to all sorts of confusion for authors in positioning things... dragging, repositioning, or creating elements based on pointer position. (To a lesser extent, this is a general problem with positioning relative to transformed elements, but nesting context takes care of most non-pointer-position cases.)
> Jonathan Watt (Mozilla) has a handy script library [1] that helps authors solve this in SVG, but unless someone knows about that script, it is frustrating. I think this should be solved in a spec, perhaps as a method to get the relative transformed coordinates in the appropriate coordinate space.
> I started to address this in DOM3 Events [2][3], but we decided to defer it, or to address it in CSSOM or the CSS Transforms spec.
> I'm raising this here to ask where it is most appropriate to address this: the Pointer Events v2 spec (still in the future), the CSS Transforms spec, or the CSSOM spec?
> [1]
> [2]
> [3]

I think this should be solved via a generic point mapping API, which has nothing to do with user events or cursors (which dissuades from putting it in the Pointer Events spec).

WebKit has, on DOMWindow,

    WebKitPoint webkitConvertPointFromPageToNode(in Node node, in WebKitPoint p);
    WebKitPoint webkitConvertPointFromNodeToPage(in Node node,  in WebKitPoint p);


interface WebKitPoint {
    attribute float x;
    attribute float y;

for this purpose, which I think is a reasonable approach.


Received on Tuesday, 29 January 2013 18:58:42 UTC