From 8c4531188be434e45afeb6dd0e5fb691e676dab6 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Mon, 9 Apr 2018 17:31:03 +0300 Subject: [PATCH] Fixed scrollable area of GUIListBoxes not changing when children are hidden (e.g. when filtering messages in the server log), fixed new log messages appearing in the server log even if the type of message has been filtered out. --- Barotrauma/BarotraumaClient/Source/GUI/GUIListBox.cs | 2 +- Barotrauma/BarotraumaClient/Source/Networking/ServerLog.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Barotrauma/BarotraumaClient/Source/GUI/GUIListBox.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUIListBox.cs index 758b12aff..3507f37ee 100644 --- a/Barotrauma/BarotraumaClient/Source/GUI/GUIListBox.cs +++ b/Barotrauma/BarotraumaClient/Source/GUI/GUIListBox.cs @@ -355,7 +355,7 @@ namespace Barotrauma totalSize = (int)(padding.Y + padding.W); foreach (GUIComponent child in children) { - if (child == frame) continue; + if (child == frame || !child.Visible) continue; totalSize += (scrollBar.IsHorizontal) ? child.Rect.Width : child.Rect.Height; } diff --git a/Barotrauma/BarotraumaClient/Source/Networking/ServerLog.cs b/Barotrauma/BarotraumaClient/Source/Networking/ServerLog.cs index 1929837ec..95e75df25 100644 --- a/Barotrauma/BarotraumaClient/Source/Networking/ServerLog.cs +++ b/Barotrauma/BarotraumaClient/Source/Networking/ServerLog.cs @@ -83,6 +83,7 @@ namespace Barotrauma.Networking var textBlock = new GUITextBlock(new Rectangle(0, 0, 0, 0), line.Text, "", Alignment.TopLeft, Alignment.TopLeft, listBox, true, GUI.SmallFont); textBlock.Rect = new Rectangle(textBlock.Rect.X, textBlock.Rect.Y, textBlock.Rect.Width, Math.Max(13, textBlock.Rect.Height)); textBlock.TextColor = messageColor[(int)line.Type]; + textBlock.Visible = !msgTypeHidden[(int)line.Type]; textBlock.CanBeFocused = false; textBlock.UserData = line; @@ -108,7 +109,7 @@ namespace Barotrauma.Networking textBlock.Visible = string.IsNullOrEmpty(filter) || textBlock.Text.ToLower().Contains(filter); } - + listBox.UpdateScrollBarSize(); listBox.BarScroll = 0.0f; return true;