w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.45k stars 657 forks source link

[cssom-view] New feature - Zoom factor #449

Open Demitrius opened 8 years ago

Demitrius commented 8 years ago

Hello,

This is feature request for the zoom factor.

In some cases developers need to know current zoom factor. As usual, zoom can be set by hit Ctrl and + / Ctrl and - or from browser menu.

Where is no universal way in javascript to get the browser zoom factor Today.

First discussion #399

cvrebert commented 8 years ago

It's worth noting you appear to be referring to Page Zoom as opposed to Pinch Zoom. "Zoom" without further qualification is ambiguous.

Demitrius commented 8 years ago

Some clarification of requested value.

On desktop. Page default zoom = 100% If I type CTRL and + several times, zoom increase to 150% If I type CTRL and - several times, zoom decrease to 70%

I mean this zoom (requested value - 100, 150, 70)

On mobile. When user drag the fingers to pan across the screen and zoom in / out page, requested value must updating. In case when site scale down to fit the screen, requested value must be less than 100%

staktrace commented 8 years ago

The "pinch zoom" (mobile finger-dragging) will be exposed by the proposed visual viewport API: https://github.com/WICG/ViewportAPI, perhaps it's worth making the "page zoom" also be exposed as a property on that object?

Demitrius commented 8 years ago

Yes, would be nice expose 'visualViewport.scale' as a property.

This is the same scale as used in the viewport tag.

Demitrius commented 7 years ago

Hi guys!

What's about this issue?

hexalys commented 7 years ago

@staktrace

visualViewport being an event object, I don't think it is well suited for "page zoom". Unlike mobile, where pinch-zoom start at 1.0; page-zoom can be anything right from the start and should be detectable on initial load. I preferably would like to see that page-zoom scale property on a prospect layout viewport object exposed on the window object.