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.

This commit is contained in:
Joonas Rikkonen
2018-04-09 17:31:03 +03:00
parent cc92341fae
commit 8c4531188b
2 changed files with 3 additions and 2 deletions
@@ -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;
}
@@ -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;