-
-
Notifications
You must be signed in to change notification settings - Fork 61
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
Switch auto UI scale to use screen DPI #672
Conversation
100e5b7
to
120ea1e
Compare
src/GlobalSettings.gd
Outdated
if dpi < 72: | ||
return 0.75 | ||
elif dpi <= 96: | ||
return 1.0 | ||
elif dpi <=160: | ||
return 1.25 | ||
elif dpi <= 240: | ||
return 1.5 | ||
elif dpi <= 480: | ||
return 1.75 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These values are just a bit too low. DisplayServer.screen_get_dpi(screen)
returns 163
on my system with 200% scaling, so I would expect 2.0
to be returned, but this code is returning 1.5
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I adjusted the values to be roughly dpi/96. That's the DPI of my laptop screen and 1.0 looks fine on it, so i used it as a base.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Different perspectives I guess, I am using a high DPI desktop display.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your DPI will return 2.0 now.
I found that changing the scaling in Windows also changes the reported DPI. With that, it looks like scaling in GodSVG now roughly matches the OS scaling so it should be good now.
Co-authored-by: Aaron Franke <[email protected]>
Thanks A TON! |
Co-authored-by: Aaron Franke <[email protected]>
Co-authored-by: Aaron Franke <[email protected]>
This has to be tested on more devices. @aaronfranke
I only tested this on my phone and laptop, which both have low resolution screens. Different DPI though so it's tested a little bit and seems to work.
Previously it was making the default experience on phone even worse, because it made UI even smaller than it already was without automatic scale. I know phones arent really supported anyways, but I hope this fix also makes it better on desktop.
Edit: I did some testing on my laptop (1366x768, DPI 96). Previous implementation would make UI too small on it. New one seems to work well. Also tested with the AMD virtual resulution to set it to higher resolutions (FHD, DPI 120), and it still works well.