-
Notifications
You must be signed in to change notification settings - Fork 715
[cssom-view] Add pageZoomFactor to window interface #3538
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for raising this, Ella. To clarify, We already have |
The first question would be, why should content be aware of zoom level? I think content are supposed to be responsive to just the viewport, and the viewport changes based on the zoom level. Ideally I hope content would never be able to be aware of zoom level. In Gecko, both |
It's definitely nicer to have the
I'm not very familiar with the use case except event part, but this chromium bug has 10+ stars, and also there are a lot of discussion here. This can be a sign showing that people are still care about the zoom level. |
Here is an old WebKit bug that also shows the need for a new factor exposed to developers. @upsuper: We also saw the challenge in changing |
People caring about the zoom level but no concrete usecase provided isn't a helpful situation. They may actually want something different that could deserve a better solution. |
pageZoomfactor is usable on some situations yes. Like currently in our case - we want our content not be zoomed at all in any case, I can explain why if anyone interested.
But CSS zoom is essential for us to render our content properly. What we do is we render iframes into webpages as guest and if and when that page has CSS zoom applied we absolutely The easiest way is:
Now I apply
fixes that, now Back to my case - currently Chrome would render on Windows our iframe content 2 times bigger as expected. Naturally I have a fix,
but I would like to get correct values from |
So you want to disable browser zooming on your page. I'm indeed interested why, and I'm also wondering how you can disable that by knowing that factor.
You should probably not rely on Also, it seems to me when using browser zooming, iframe as well as its content would get that zoomed together automatically. Am I missing something? |
|
How is a large zoom different from user changing their window to a smaller size that your box would simply overflow? As I mentioned above, I believe sites should just be responsive to the viewport size, regardless of it being from zooming or window resizing. Am I missing something?
So why do you use |
|
How about making your content responsive to viewport size, so that you solve the two problems together without using any hack for getting browsers' zoom ratio? |
This browser zoom has nothing to do with the CSS zoom issue at hand. I regret to even pointing it out and are not interested discussing it further. Let's concentrate on the issue at hand - incorrect reporting of CSS zoom and why it is needed. |
This issue is about exposing browser zoom factor. And I see no usecase of this. CSS zoom is non-standard, so whether it's correctly reported, or even what's its correct behavior, is out of scope here, I suppose. |
I was kindly asked: https://bugs.chromium.org/p/chromium/issues/detail?id=899707#c13 to present my use case here. I did. I'm out now. |
Looks like the use-cases we mentioned so far can be solved through the the original point @upsuper mentioned: the content should be responsive to just the viewport. Let me add a different example that seems to need the proposed @upsuper: Do you think this justifies the proposal here? |
If you do want physical movement to mean the logical movement, maybe you have to use page zoom factor. But I would argue that "physical" movement is probaby a rather arbitrary measurement, would you want to also get user's DPI? Actually, probably a zoom-aware mouse DPI data would fit that usecase better? For this case, I would suggest that, imagine you don't use pointer lock, and thus can still see the cursor on the screen. In that case, you would probably want to use a normalized position based on the width or height rather than the "physical" movement. |
The problem here is the lack of the cursor (because of PointerLock): there is no visual cue that explicitly links the effect (the 3D rotation angle in the threejs demo above) to the movement of mouse. So the user must "get used to" how physical movement determines the angle. Making this dependent on zoom factor looks counter-intuitive. Having said that, I agree this is not a prominent use-case. |
Closing this as there is no good use-case. (I thought I already closed it months ago but somehow I didn't) |
In retrospect, this seems to have been a duplicate of #449 |
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, andclientX/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.
The text was updated successfully, but these errors were encountered: