-
Notifications
You must be signed in to change notification settings - Fork 757
Description
For the browser as such it is possible to obtain both the dimensions and the positon on the (operating system) screen area:
https://drafts.csswg.org/cssom-view/#dom-window-outerwidth
https://drafts.csswg.org/cssom-view/#dom-window-outerheight
https://drafts.csswg.org/cssom-view/#dom-window-screenx
https://drafts.csswg.org/cssom-view/#dom-window-screenx
However, for the viewport it is only possible to obtain the dimensions, not the position:
https://drafts.csswg.org/cssom-view/#dom-window-innerwidth
https://drafts.csswg.org/cssom-view/#dom-window-innerheight
The fact that the position is not available makes it impossible to translate coordinates on the screen to coordinates in the viewport.
I therefore propose the addition of corresponding innerScreenX and innerScreenY properties.
Since this translation is already performed by e.g. window.onMouseMove(), implementing the properties should not present any new technical or conceptual challenges.
The need arises when you get (OS) screen coordinates from some non-mouse source (in our particular case an gaze-tracking device), and want to relate them to the corresponding position in the displayed document.
There are non-standard implementations, e.g. mozInnerScreenX https://developer.mozilla.org/en-US/docs/Web/API/Window/mozInnerScreenX.
A previous request for another vendor-specific implementation was declined awaiting standardization https://bugs.chromium.org/p/chromium/issues/detail?id=151983 .