From bb22bbdf758d9739f4aad4b12019db1939b2a00d Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Thu, 17 Mar 2022 20:04:58 +0100 Subject: [PATCH] Fixed children of Panel scroll bars also being scrolled --- CHANGELOG.md | 1 + MLEM.Ui/Elements/Panel.cs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 170246c..e8c7a98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -60,6 +60,7 @@ Fixes - Fixed auto-navigating panels not scrolling to the center of elements properly - Fixed UiControls allowing for non-selectable or non-mouseable elements to be marked as selected or moused - Fixed buttons and checkboxes changing their CanBeSelected and CanBePressed values when being disabled +- Fixed children of Panel scroll bars also being scrolled Removals - Marked StyleProp equality members as obsolete diff --git a/MLEM.Ui/Elements/Panel.cs b/MLEM.Ui/Elements/Panel.cs index f452fc1..6d86fdd 100644 --- a/MLEM.Ui/Elements/Panel.cs +++ b/MLEM.Ui/Elements/Panel.cs @@ -119,7 +119,8 @@ namespace MLEM.Ui.Elements { if (!this.scrollOverflow) return; var offset = new Vector2(0, -this.ScrollBar.CurrentValue); - foreach (var child in this.GetChildren(c => c != this.ScrollBar, true)) { + // we ignore false grandchildren so that the children of the scroll bar stay in place + foreach (var child in this.GetChildren(c => c != this.ScrollBar, true, true)) { if (!child.ScrollOffset.Equals(offset, Epsilon)) { child.ScrollOffset = offset; this.relevantChildrenDirty = true;