ItemList only shows scrollbar when necessary.

This commit is contained in:
Pieter-Jan Briers
2019-05-14 12:54:26 +02:00
parent b30c2155c7
commit bb7288d26a

View File

@@ -64,6 +64,7 @@ namespace Robust.Client.UserInterface.Controls
}
_scrollBar.MaxValue = Math.Max(_scrollBar.Page, _totalContentHeight);
_updateScrollbarVisibility();
}
public void AddItem(string text, Texture icon = null, bool selectable = true)
@@ -480,6 +481,11 @@ namespace Robust.Client.UserInterface.Controls
base.UIScaleChanged();
}
private void _updateScrollbarVisibility()
{
_scrollBar.Visible = _totalContentHeight + ActualBackground.MinimumSize.Y > PixelHeight;
}
public sealed class Item
{
public string Text = null;