Bug 20832 - Consider defining methods for converting points between different transformed coordinate systems
Summary: Consider defining methods for converting points between different transformed...
Status: NEW
Alias: None
Product: CSS
Classification: Unclassified
Component: CSSOM View (show other bugs)
Version: unspecified
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Simon Pieters
QA Contact: public-css-bugzilla
Depends on:
Reported: 2013-01-31 01:02 UTC by Jacob Rossi [MSFT]
Modified: 2013-08-08 13:28 UTC (History)
3 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Jacob Rossi [MSFT] 2013-01-31 01:02:41 UTC
Opening this based on discussion in the Pointer Events WG [1]

From Doug Schepers <schepers@w3.org>:

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 [2] 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.

Also, webkit has non-standard APIs similar to this that might be a good starting point. [3]

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;

[1] http://lists.w3.org/Archives/Public/public-pointer-events/2013JanMar/0046.html
[2] http://jwatt.org/svg/tmp/mouse-relative-positioning.svg
[3] http://lists.w3.org/Archives/Public/public-pointer-events/2013JanMar/0049.html