From 71dabe73608522afe68d426b1fcfe95d34c895d4 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Wed, 17 Jun 2020 01:44:16 +0200 Subject: [PATCH] use specific check instead of generic one for panel fix --- MLEM.Ui/Elements/Panel.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MLEM.Ui/Elements/Panel.cs b/MLEM.Ui/Elements/Panel.cs index d29720f..f3e16c9 100644 --- a/MLEM.Ui/Elements/Panel.cs +++ b/MLEM.Ui/Elements/Panel.cs @@ -70,7 +70,7 @@ namespace MLEM.Ui.Elements { return; if (otherElement == null || !otherElement.GetParentTree().Contains(this)) return; - var firstChild = this.Children.First(c => !(c is ScrollBar)); + var firstChild = this.Children.First(c => c != this.ScrollBar); this.ScrollBar.CurrentValue = (otherElement.Area.Bottom - firstChild.Area.Top - this.Area.Height / 2) / this.Scale; }; this.AddChild(this.ScrollBar); @@ -206,7 +206,7 @@ namespace MLEM.Ui.Elements { if (this.Children.Count == 1) return; // the "real" first child is the scroll bar, which we want to ignore - var firstChild = this.Children.First(c => !(c is ScrollBar)); + var firstChild = this.Children.First(c => c != this.ScrollBar); var lowestChild = this.GetLowestChild(e => !e.IsHidden); // 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;