Skip to content

WebPrefrences.ZoomFactor is int instead of double #754

Closed
@Yuvix25

Description

@Yuvix25
  • Electron.NET Version: 23.6.1
  • .NET Version: 7.0.202
  • Node.js Version: 18.12.1
  • Target: Windows

I want to make my app resolution fixed to 1920x1080 no matter what's the screen resolution, while still keeping the app full screen. To achieve that, I tried the following:

double factor = (await Electron.Screen.GetPrimaryDisplayAsync()).WorkAreaSize.Width / 1920.0;
var window = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions()
{
    WebPreferences = new WebPreferences()
    {
        ZoomFactor = factor,
    },
    Resizable = false,
    Fullscreen = true,
    Minimizable = false,
    Movable = false,
    Frame = false,
    Transparent = true,
    BackgroundColor = "#00000000",
});

However, this did not work, as ZoomFactor is expecting an int, not a double, unlike the original implementation in Electron.JS where it is indeed a double.

Can this be fixed?
(From a quick look at the source code, it seems as the only change necessary is public int ZoomFactor { get; set; } to public double ZoomFactor { get; set; }, but I'm not entirely sure, so I prefer not posting this as a PR)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions