-
Notifications
You must be signed in to change notification settings - Fork 85
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
Simplify UI scaler #1157
Simplify UI scaler #1157
Conversation
TLM/TLM/U/UIScaler.cs
Outdated
// always 1080f. But we keep this code for the sake of future proofing | ||
return resolution.y; | ||
} | ||
private static float BaseResolutionX => UIView.GetAView().GetScreenResolution().x; |
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'd reduce GetAView() calls to a minimum.
Call it once and cache it.
The method searches every time for the first UIView even though the value never changes.
Also the method is implemented via LINQ and will cause heap allocations each time.
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.
Renaming config option will reset scale for everyone.
I see, how do we handle that?
|
Reasonable default for example 100% zoom or keep old variable, give new variable default -1 for example, and if it is -1, we migrate value to new on the first load. This migration code can be removed in the next release. |
To be honest, in that case I'd probably leave the variable name as is since its too much hastle for too little gain. I did not consider that when I proposed to rename the variable. But your solution also sounds fine. I don't mind either solution in this case .. since they all have some little drawback. |
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.
👍
No description provided.