Fixed Display Line

This commit is contained in:
JacobTech 2024-11-18 01:32:53 -05:00
parent 169a20daf0
commit ba71d022d6
3 changed files with 36 additions and 13 deletions

View File

@ -1,6 +1,7 @@
using GraphicsManager.Enums; using GraphicsManager.Enums;
using GraphicsManager.Interfaces; using GraphicsManager.Interfaces;
using GraphicsManager.Objects; using GraphicsManager.Objects;
using OpenTK.Mathematics;
namespace Luski.GUI.MainScreen.UI.Generic; namespace Luski.GUI.MainScreen.UI.Generic;
@ -19,4 +20,28 @@ public class LuskiFlow : FlowLayout
if (Parent is not null) Parent.TryDraw(); if (Parent is not null) Parent.TryDraw();
BlockDraw = false; 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;
}
} }

View File

@ -1,6 +1,9 @@
using GraphicsManager.Enums;
using GraphicsManager.Objects;
using Luski.Classes; using Luski.Classes;
using Luski.GUI.MainScreen.UI.LuskiControls.SettingsMenuBase.Core; using Luski.GUI.MainScreen.UI.LuskiControls.SettingsMenuBase.Core;
using Luski.GUI.MainScreen.UI.SettingsPanel; using Luski.GUI.MainScreen.UI.SettingsPanel;
using OpenTK.Mathematics;
namespace Luski.GUI.MainScreen.UI.LuskiSettings.Pages.AdvancedSettings; namespace Luski.GUI.MainScreen.UI.LuskiSettings.Pages.AdvancedSettings;
@ -15,11 +18,18 @@ public class ExperimentSettings : PageFlow
{ {
g = new(exp); g = new(exp);
Controls.Add(g); 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) if (g is not null)
{ {
g.line.WindowLoaded += _ => g.dd.WindowLoaded += _ =>
{ {
ParentResize(); ParentResize();
return Task.CompletedTask; return Task.CompletedTask;

View File

@ -10,7 +10,6 @@ namespace Luski.GUI.MainScreen.UI.SettingsPanel;
public class ExperimentGUI : UserControl public class ExperimentGUI : UserControl
{ {
private Label Top; private Label Top;
public Rectangle line;
public DropDown<ExperimentDropButton> dd; public DropDown<ExperimentDropButton> dd;
private static Texture? TopOpen, BottomOpen; private static Texture? TopOpen, BottomOpen;
private ExperimentSelectorInfo? currentEnabled; private ExperimentSelectorInfo? currentEnabled;
@ -85,8 +84,6 @@ public class ExperimentGUI : UserControl
{ {
BlockDraw = true; BlockDraw = true;
Size = new(base.Size.X, base.Size.Y + ( b ? dd.DropDownContainer.Size.Y : -1 * dd.DropDownContainer.Size.Y)); 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) if (b)
{ {
dd.Textures[0] = TopOpen; 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.Size = new(base.Size.X - Top.Location.X - Top.Location.X, dd.Size.Y);
dd.ForceDistanceUpdate(this); 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); 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)); base.BackgroundColor = new((byte)new Random().Next(255),(byte)new Random().Next(255),(byte)new Random().Next(255),(byte)new Random().Next(255));
} }