Skip to content
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

min-width and max-width broken on hi-dpi screens #2714

Closed
tommoor opened this issue Sep 4, 2015 · 4 comments
Closed

min-width and max-width broken on hi-dpi screens #2714

tommoor opened this issue Sep 4, 2015 · 4 comments

Comments

@tommoor
Copy link
Contributor

tommoor commented Sep 4, 2015

This is a Windows issue.
Tested on Windows 10 using a retina Macbook, Electron 0.31.1

With a hi-dpi screen the min-width and max-widthattributes are interpreted as double size, so if I set a min-width of 500px on the browser-window it will actually enforce a min-width of 1000px. Same applies for height.

Obviously because customers will have a mixture of screen DPI's (increasingly hi-dpi) this means that the min and max options can't be used at all as they stretch the app out on the hires screens.

@etiktin
Copy link
Contributor

etiktin commented Sep 5, 2015

Do you mean that the min-width and min-height are doubled, but the width and height are not?
If all of them are doubled, the behavior you're describing sounds reasonable. An app designed on a 1920x1080 (FHD) screen, should have twice the width and height when running on a 3840x2160 (4K) screen of a similar size (the minimum and maximum of each dimension should be doubled as well).

In any case did you try using webFrame.setZoomFactor(factor)? Some users used it to implement HiDPI support on Linux, so I guess you might be able to use it in order to disable it.

@tommoor
Copy link
Contributor Author

tommoor commented Sep 5, 2015

You're correct in that min-width and min-height are doubled but the width and height are NOT. If I remove the min/max attributes then the window is correctly sized.

It's not the content that's zoomed, it's the browser window itself that is sized too large - the content rendering appears correct and crisp at the HiDPI (awesome).

@ToadKing
Copy link

ToadKing commented Sep 6, 2015

Something I brought up in #1806: on scaled desktops, window.outerHeight / outerWidth are set incorrectly. They appear to be scaled down based on the windows desktop scale ratio. So if you have desktop scaling set to 200%, a window 800px wide will have a outerWidth of 400. This might be related to this issue.

@zcbenz
Copy link
Member

zcbenz commented Sep 7, 2015

I'm merging this to #1806.

@zcbenz zcbenz closed this as completed Sep 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants