1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-04-29 07:39:06 +02:00

improved 0571e8a implementation

This commit is contained in:
Ell 2023-10-14 17:34:43 +02:00
parent 281a6f7588
commit 95b28c6039

View file

@ -56,7 +56,7 @@ namespace MLEM.Ui.Elements {
private readonly List<Element> relevantChildren = new List<Element>();
private readonly HashSet<Element> scrolledChildren = new HashSet<Element>();
private readonly float[] scrollBarMaxHistory = new float[3];
private readonly float[] scrollBarMaxHistory;
private readonly bool scrollOverflow;
private RenderTarget2D renderTarget;
@ -97,6 +97,10 @@ namespace MLEM.Ui.Elements {
this.ScrollToElement(e);
};
this.AddChild(this.ScrollBar);
this.scrollBarMaxHistory = new float[3];
for (var i = 0; i < this.scrollBarMaxHistory.Length; i++)
this.scrollBarMaxHistory[i] = -1;
}
}
@ -110,11 +114,11 @@ namespace MLEM.Ui.Elements {
if (child != this.ScrollBar && !child.Anchor.IsAuto())
throw new NotSupportedException($"A panel that handles overflow can't contain non-automatic anchors ({child})");
}
for (var i = 0; i < this.scrollBarMaxHistory.Length; i++)
this.scrollBarMaxHistory[i] = -1;
}
base.ForceUpdateArea();
Array.Clear(this.scrollBarMaxHistory, 0, this.scrollBarMaxHistory.Length);
this.SetScrollBarStyle();
}