Skip to content

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

Closed

Description

@tommoor

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.

Activity

  1. etiktin commented on Sep 5, 2015

    @etiktin
    Contributor

    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.

  2. tommoor commented on Sep 5, 2015

    @tommoor
    ContributorAuthor

    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).

  3. ToadKing commented on Sep 6, 2015

    @ToadKing

    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.

  4. zcbenz commented on Sep 7, 2015

    @zcbenz
    Contributor

    I'm merging this to #1806.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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