Fix `KeyCounterDisplay` potentially getting stuck invisible due to autosize masking

Closes #14793.
This commit is contained in:
Dean Herbert 2021-09-20 23:51:58 +09:00
parent f5a5b87cf6
commit a3464c98a7
1 changed files with 9 additions and 2 deletions

View File

@ -33,8 +33,6 @@ public class KeyCounterDisplay : Container<KeyCounter>
public KeyCounterDisplay()
{
AutoSizeAxes = Axes.Both;
InternalChild = KeyFlow = new FillFlowContainer<KeyCounter>
{
Direction = FillDirection.Horizontal,
@ -42,6 +40,15 @@ public KeyCounterDisplay()
};
}
protected override void Update()
{
base.Update();
// Don't use autosize as it will shrink to zero when KeyFlow is hidden.
// In turn this can cause the display to be masked off screen and never become visible again.
Size = KeyFlow.Size;
}
public override void Add(KeyCounter key)
{
if (key == null) throw new ArgumentNullException(nameof(key));