From 287885b96d9662c56fe9482ff3400300dac360c2 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sat, 24 Aug 2019 19:21:06 +0200 Subject: [PATCH] fixed panels overflowing incorrectly in some dimensions --- MLEM.Ui/Elements/Panel.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MLEM.Ui/Elements/Panel.cs b/MLEM.Ui/Elements/Panel.cs index 3ef523c..21175c2 100644 --- a/MLEM.Ui/Elements/Panel.cs +++ b/MLEM.Ui/Elements/Panel.cs @@ -31,7 +31,7 @@ namespace MLEM.Ui.Elements { // the "real" first child is the scroll bar, which we want to ignore var firstChild = this.Children[1]; // as all children have to be auto-aligned, moving the first one up will move all others - firstChild.PositionOffset = new Vector2(firstChild.PositionOffset.X, -value.Ceil()); + firstChild.PositionOffset = new Vector2(firstChild.PositionOffset.X, -value.Floor()); this.ForceUpdateArea(); }, CanAutoAnchorsAttach = false @@ -67,8 +67,8 @@ namespace MLEM.Ui.Elements { var firstChild = this.Children[1]; var lowestChild = this.GetLowestChild(false, true); // the max value of the scrollbar is the amount of non-scaled pixels taken up by overflowing components - var childrenHeight = lowestChild.Area.Bottom - firstChild.Area.Top; - this.ScrollBar.MaxValue = (childrenHeight - this.Area.Height) / this.Scale + this.ChildPadding.Y * 2; + var childrenHeight = lowestChild.Area.Bottom + 1 - firstChild.Area.Top; + this.ScrollBar.MaxValue = ((childrenHeight - this.Area.Height) / this.Scale + this.ChildPadding.Y * 2).Floor(); // update the render target var targetArea = this.GetRenderTargetArea();