Addressed an issue where UI would not show for certain resolutions
This commit is contained in:
@@ -21,13 +21,12 @@ void ApplyTransformOffset(SDK::UWidget* Widget, float OffsetX, float OffsetY) {
|
||||
Widget->SetRenderTransform(Transform);
|
||||
}
|
||||
|
||||
void CenterWidget(SDK::UUserWidget* Widget, float offset, float screenWidth, float screenHeight, float aspectRatio, float targetAspect, float compensation) {
|
||||
void CenterWidget(SDK::UUserWidget* Widget, float offset, float screenWidth, float screenHeight, float targetWidth, float targetHeight, float compensation) {
|
||||
if (!Widget) return;
|
||||
float targetHeight = (float)screenHeight; // For UW displays
|
||||
float targetWidth = screenWidth;
|
||||
float aspectRatio = screenWidth / screenHeight;
|
||||
float targetAspect = targetWidth / targetHeight;
|
||||
|
||||
if (aspectRatio > targetAspect) {
|
||||
targetHeight = 1080.f; // clamp at 1080 for UW
|
||||
float scale = targetHeight / screenHeight; // horizontal scale to apply to get the same vertical size as 1080p
|
||||
targetWidth = (float)screenWidth * scale;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user