From ba71d022d64f22de630d3369e8e9b341db04d6c6 Mon Sep 17 00:00:00 2001 From: JacobTech Date: Mon, 18 Nov 2024 01:32:53 -0500 Subject: [PATCH] Fixed Display Line --- Luski/GUI/MainScreen/UI/Generic/LuskiFlow.cs | 25 +++++++++++++++++++ .../AdvancedSettings/ExperimentSettings.cs | 12 ++++++++- .../UI/SettingsPanel/ExperimentGUI.cs | 12 --------- 3 files changed, 36 insertions(+), 13 deletions(-) diff --git a/Luski/GUI/MainScreen/UI/Generic/LuskiFlow.cs b/Luski/GUI/MainScreen/UI/Generic/LuskiFlow.cs index ea7356c..37ab153 100644 --- a/Luski/GUI/MainScreen/UI/Generic/LuskiFlow.cs +++ b/Luski/GUI/MainScreen/UI/Generic/LuskiFlow.cs @@ -1,6 +1,7 @@ using GraphicsManager.Enums; using GraphicsManager.Interfaces; using GraphicsManager.Objects; +using OpenTK.Mathematics; namespace Luski.GUI.MainScreen.UI.Generic; @@ -19,4 +20,28 @@ public class LuskiFlow : FlowLayout if (Parent is not null) Parent.TryDraw(); BlockDraw = false; } + + public override void ReportSizeUpdate(IRenderObject Control) + { + BlockDraw = true; + int index = Controls.IndexOf(Control); + if (index < Controls.Length - 1) + { + int dif = Control.Location.Y + Control.Size.Y - Controls[index + 1].Location.Y; + Vector2i v3i = new(0, dif); + for (int i = index + 1; i < Controls.Length; i++) + { + Controls[i].Location += v3i; + if (Controls[i] is IParent p) + { + p.ParentResize(); + } + } + } + else + { + ForceScrollUpdate(); + } + BlockDraw = false; + } } \ No newline at end of file diff --git a/Luski/GUI/MainScreen/UI/LuskiSettings/Pages/AdvancedSettings/ExperimentSettings.cs b/Luski/GUI/MainScreen/UI/LuskiSettings/Pages/AdvancedSettings/ExperimentSettings.cs index 2f806c7..223f709 100644 --- a/Luski/GUI/MainScreen/UI/LuskiSettings/Pages/AdvancedSettings/ExperimentSettings.cs +++ b/Luski/GUI/MainScreen/UI/LuskiSettings/Pages/AdvancedSettings/ExperimentSettings.cs @@ -1,6 +1,9 @@ +using GraphicsManager.Enums; +using GraphicsManager.Objects; using Luski.Classes; using Luski.GUI.MainScreen.UI.LuskiControls.SettingsMenuBase.Core; using Luski.GUI.MainScreen.UI.SettingsPanel; +using OpenTK.Mathematics; namespace Luski.GUI.MainScreen.UI.LuskiSettings.Pages.AdvancedSettings; @@ -15,11 +18,18 @@ public class ExperimentSettings : PageFlow { g = new(exp); Controls.Add(g); + Controls.Add(new Rectangle() + { + Size = new(base.Size.X - 2, 1.ScaleInt()), + BackgroundColor = Color4.Gray, + Location = new(1, base.Size.Y - 1.ScaleInt()), + Anchor = ObjectAnchor.Left | ObjectAnchor.Right | ObjectAnchor.Bottom + }); } if (g is not null) { - g.line.WindowLoaded += _ => + g.dd.WindowLoaded += _ => { ParentResize(); return Task.CompletedTask; diff --git a/Luski/GUI/MainScreen/UI/SettingsPanel/ExperimentGUI.cs b/Luski/GUI/MainScreen/UI/SettingsPanel/ExperimentGUI.cs index 0f5ad1e..f6dda68 100644 --- a/Luski/GUI/MainScreen/UI/SettingsPanel/ExperimentGUI.cs +++ b/Luski/GUI/MainScreen/UI/SettingsPanel/ExperimentGUI.cs @@ -10,7 +10,6 @@ namespace Luski.GUI.MainScreen.UI.SettingsPanel; public class ExperimentGUI : UserControl { private Label Top; - public Rectangle line; public DropDown dd; private static Texture? TopOpen, BottomOpen; private ExperimentSelectorInfo? currentEnabled; @@ -85,8 +84,6 @@ public class ExperimentGUI : UserControl { BlockDraw = true; Size = new(base.Size.X, base.Size.Y + ( b ? dd.DropDownContainer.Size.Y : -1 * dd.DropDownContainer.Size.Y)); - line!.Location = new(line.Location.X, - line.Location.Y + (b ? dd.DropDownContainer.Size.Y : -1 * dd.DropDownContainer.Size.Y)); if (b) { dd.Textures[0] = TopOpen; @@ -132,15 +129,6 @@ public class ExperimentGUI : UserControl dd.Size = new(base.Size.X - Top.Location.X - Top.Location.X, dd.Size.Y); dd.ForceDistanceUpdate(this); - line = new() - { - Size = new(base.Size.X - 2, 1.ScaleInt()), - BackgroundColor = Color4.Gray, - Location = new(1, base.Size.Y - 1.ScaleInt()), - Anchor = ObjectAnchor.Left | ObjectAnchor.Right | ObjectAnchor.Bottom - }; - line.ForceDistanceUpdate(this); - Controls.Add(line); Controls.Add(Top); base.BackgroundColor = new((byte)new Random().Next(255),(byte)new Random().Next(255),(byte)new Random().Next(255),(byte)new Random().Next(255)); }