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

WebPrefrences.ZoomFactor is int instead of double #754

Closed
Yuvix25 opened this issue Apr 2, 2023 · 4 comments · Fixed by #755
Closed

WebPrefrences.ZoomFactor is int instead of double #754

Yuvix25 opened this issue Apr 2, 2023 · 4 comments · Fixed by #755
Labels

Comments

@Yuvix25
Copy link
Contributor

Yuvix25 commented Apr 2, 2023

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

@Yuvix25 Yuvix25 added the bug label Apr 2, 2023
@FlorianRappl
Copy link
Collaborator

Yes, I think this can be fixed and that the fix would be indeed as simple as the suggestion. Do you want to make a PR on this? Thanks!

@Yuvix25
Copy link
Contributor Author

Yuvix25 commented Apr 2, 2023

Sure, I'll make one!

@FlorianRappl
Copy link
Collaborator

Thanks! Merged and will be part of the next release. 🍻

@GregorBiswanger
Copy link
Member

Will be taken into account in the next update release.

Thank you @Yuvix25 for your PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants