w3c/csswg-drafts

[cssom-view] window.innerScreenX windows.innerScreenY

Open

#809 aberto em 15 de dez. de 2016

Ver no GitHub
 (12 comments) (20 reactions) (0 assignees)HTML (545 forks)batch import
Help Wantedcssom-view-1

Métricas do repositório

Stars
 (3.546 stars)
Métricas de merge de PR
 (Mesclagem média 87d 7h) (24 fundiu PRs em 30d)

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 .

Guia do colaborador