diff --git a/CHANGELOG.md b/CHANGELOG.md index bfae87c..8bf0183 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,9 @@ Improvements - Allow scrolling panels to contain other scrolling panels - Allow dropdowns to have scrolling panels +Fixes +- Fixed panels updating their relevant children too much when the scroll bar is hidden + ### MLEM.Data Fixes - Fixed various exception types not being wrapped by ContentLoadExceptions when loading raw or JSON content diff --git a/MLEM.Ui/Elements/Panel.cs b/MLEM.Ui/Elements/Panel.cs index a3771e3..dfb4398 100644 --- a/MLEM.Ui/Elements/Panel.cs +++ b/MLEM.Ui/Elements/Panel.cs @@ -271,7 +271,7 @@ namespace MLEM.Ui.Elements { } // the max value of the scroll bar is the amount of non-scaled pixels taken up by overflowing components - var scrollBarMax = (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)) { this.ScrollBar.MaxValue = scrollBarMax; this.relevantChildrenDirty = true;