1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-25 22:18:34 +01:00

Revert "fixed 0571e8a not updating older panels correctly"

This reverts commit 7bfe44de07.
This commit is contained in:
Ell 2023-10-14 17:22:05 +02:00
parent 7bfe44de07
commit 281a6f7588

View file

@ -56,7 +56,7 @@ namespace MLEM.Ui.Elements {
private readonly List<Element> relevantChildren = new List<Element>(); private readonly List<Element> relevantChildren = new List<Element>();
private readonly HashSet<Element> scrolledChildren = new HashSet<Element>(); private readonly HashSet<Element> scrolledChildren = new HashSet<Element>();
private readonly List<float> scrollBarMaxHistory = new List<float>(); private readonly float[] scrollBarMaxHistory = new float[3];
private readonly bool scrollOverflow; private readonly bool scrollOverflow;
private RenderTarget2D renderTarget; private RenderTarget2D renderTarget;
@ -113,7 +113,7 @@ namespace MLEM.Ui.Elements {
} }
base.ForceUpdateArea(); base.ForceUpdateArea();
this.scrollBarMaxHistory.Clear(); Array.Clear(this.scrollBarMaxHistory, 0, this.scrollBarMaxHistory.Length);
this.SetScrollBarStyle(); this.SetScrollBarStyle();
} }
@ -278,10 +278,10 @@ namespace MLEM.Ui.Elements {
var scrollBarMax = Math.Max(0, (childrenHeight - this.ChildPaddedArea.Height) / this.Scale); var scrollBarMax = Math.Max(0, (childrenHeight - this.ChildPaddedArea.Height) / this.Scale);
if (!this.ScrollBar.MaxValue.Equals(scrollBarMax, Element.Epsilon)) { if (!this.ScrollBar.MaxValue.Equals(scrollBarMax, Element.Epsilon)) {
// avoid a show/hide oscillation that occurs while updating our area with children that can lose height when the scroll bar is shown (like long paragraphs) // avoid a show/hide oscillation that occurs while updating our area with children that can lose height when the scroll bar is shown (like long paragraphs)
if (this.scrollBarMaxHistory.Count < 3 || !this.scrollBarMaxHistory[0].Equals(this.scrollBarMaxHistory[2], Element.Epsilon) || !this.scrollBarMaxHistory[1].Equals(scrollBarMax, Element.Epsilon)) { if (!this.scrollBarMaxHistory[0].Equals(this.scrollBarMaxHistory[2], Element.Epsilon) || !this.scrollBarMaxHistory[1].Equals(scrollBarMax, Element.Epsilon)) {
if (this.scrollBarMaxHistory.Count > 0) this.scrollBarMaxHistory[0] = this.scrollBarMaxHistory[1];
this.scrollBarMaxHistory.RemoveAt(0); this.scrollBarMaxHistory[1] = this.scrollBarMaxHistory[2];
this.scrollBarMaxHistory.Add(scrollBarMax); this.scrollBarMaxHistory[2] = scrollBarMax;
this.ScrollBar.MaxValue = scrollBarMax; this.ScrollBar.MaxValue = scrollBarMax;
this.relevantChildrenDirty = true; this.relevantChildrenDirty = true;