Skip to content

[cssom-view] Add pageZoomFactor to window interface #3538

Closed
@EiraGe

Description

@EiraGe

window.devicePixelRatio includes both the device scale and the page zoom. However, there is no easy way to get the page zoom factor alone.

Developers use different ways to get the zoom factor, but they are either inaccurate or not specced
(e.g window.outerWidth / window.innerWidth, and window.getComputedStyle()['zoom'])

In addition, as mentioned in this comment, event.screenX/Y are in DIP(device independent pixels), which includes zoom, and clientX/Y are in CSS pixel. Lacking page zoom factor causes developer having trouble converting between the coordinates spaces.

I therefore propose adding a new window.pageZoomFactor to expose the zoom factor.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions