From 86b036095e3405e26f88947e9b6308f858d0191e Mon Sep 17 00:00:00 2001 From: Sinai Date: Mon, 14 Jun 2021 18:56:51 +1000 Subject: [PATCH] Allow panels to be dragged further outside the game window --- src/UI/Panels/UIPanel.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/UI/Panels/UIPanel.cs b/src/UI/Panels/UIPanel.cs index bcfe290..500e72d 100644 --- a/src/UI/Panels/UIPanel.cs +++ b/src/UI/Panels/UIPanel.cs @@ -154,14 +154,13 @@ namespace UnityExplorer.UI.Panels // Prevent panel going oustide screen bounds var halfW = Screen.width * 0.5f; var halfH = Screen.height * 0.5f; - pos.x = Math.Max(-halfW, Math.Min(pos.x, halfW - panel.rect.width)); - pos.y = Math.Max(-halfH + panel.rect.height, Math.Min(pos.y, halfH)); + + pos.x = Math.Max(-halfW - panel.rect.width + 50, Math.Min(pos.x, halfW - 50)); + pos.y = Math.Max(-halfH + 50, Math.Min(pos.y, halfH)); panel.localPosition = pos; } - - #region Save Data public abstract void DoSaveToConfigElement();