w3c / window-management

Window Management API
https://www.w3.org/TR/window-management/
Other
95 stars 25 forks source link

Exposing content area coordinates #84

Open michaelwasserman opened 2 years ago

michaelwasserman commented 2 years ago

Currently, the window object exposes:

It's not currently possible to determine the x/y coordinates of the content viewport relative to the screen of the output device (see also w3c/csswg-drafts#809). Some window placement use cases would benefit from this information (e.g. opening a popup aligned with content in the opener, aligning content with the edge of a screen when the document spans multiple screens). It may be reasonable to extend the window interface with such attributes, e.g.:

Aside: In some implementations, screenX and screenY may incorrectly reflect the placement of the content viewport, instead of reflecting the placement of the client window, or be altogether buggy; e.g. http://crbug.com/1286870

quisquous commented 2 years ago

The last sentence is intended to be http://crbug.com/1286870, I think?

michaelwasserman commented 2 years ago

Yes, updated, thanks!

el-dav commented 1 year ago

This feature would be essential for my use case which is building a multi-window drag-and-drop system.

I was intending to do this using a global co-ordinate system so the various windows know their relative position, whether they are docked iframes or separate windows. But it's currently not possible without the viewport coordinates relative to the screen.

jpw-1975 commented 1 year ago

My use-case is exactly the same. We've been using drag and drop events to accomplish this so far, which works well, but prevents us from customizing the mouse cursor, which is important for our use-case. Using screen coordinates kind-of works, but we need to know both the viewport offset and the browser zoom level. The latter is not mentioned in this bug, but IMO needs to be a part of this for the use-cases described.

iamherrylok commented 1 year ago

there is great need for expose it! It's difficult to get the elemnt coordinate relative to screen when download bar appears!

michaelwasserman commented 1 year ago

An old Chromium issue to support mozInnerScreenX|Y also cited a gaze tracking use case.