From be429a9448f19b2533a3c44819e7ee374790665d Mon Sep 17 00:00:00 2001 From: LeonardoVAC Date: Fri, 16 Oct 2026 00:18:05 -0300 Subject: [PATCH] fix: Window clamp applies the UI scale twice --- src/TerraSharp/UI/WindowManager.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/TerraSharp/UI/WindowManager.cs b/src/TerraSharp/UI/WindowManager.cs index dab6dfa..5917698 100644 --- a/src/TerraSharp/UI/WindowManager.cs +++ b/src/TerraSharp/UI/WindowManager.cs @@ -108,7 +108,8 @@ public static class WindowManager Unfocus(); } - static Vector2 ClampPosition(Window window, Vector2 position) => new(MathHelper.Clamp(position.X, 0f, Math.Max(0f, Main.screenWidth / Main.UIScale - window.Width)), MathHelper.Clamp(position.Y, 0f, Math.Max(0f, Main.screenHeight / Main.UIScale - window.Height))); + // PlayerInput.SetZoom_UI already divides Main.screenWidth/Height by the UI scale inside UI layers. + static Vector2 ClampPosition(Window window, Vector2 position) => new(MathHelper.Clamp(position.X, 0f, Math.Max(0f, PlayerInput.RealScreenWidth / Main.UIScale - window.Width)), MathHelper.Clamp(position.Y, 0f, Math.Max(0f, PlayerInput.RealScreenHeight / Main.UIScale - window.Height))); public static void Draw(SpriteBatch spriteBatch) {