handle button toggling

This commit is contained in:
Matt Parker
2025-08-27 21:05:35 +10:00
parent c1dbaf4627
commit e26e9dbd9f
5 changed files with 18 additions and 11 deletions

View File

@@ -9,7 +9,6 @@ public partial class BottomPanelManager : Panel
private Control _problemsPanel = null!;
private Dictionary<BottomPanelType, Control> _panelTypeMap = [];
private BottomPanelType? _currentPanelType = BottomPanelType.Run;
public override void _Ready()
{
@@ -23,16 +22,15 @@ public partial class BottomPanelManager : Panel
{ BottomPanelType.Problems, _problemsPanel }
};
GodotGlobalEvents.LeftSideBarButtonClicked += OnLeftSideBarButtonClicked;
GodotGlobalEvents.BottomPanelTabSelected += OnBottomPanelTabSelected;
}
private async Task OnLeftSideBarButtonClicked(BottomPanelType type)
private async Task OnBottomPanelTabSelected(BottomPanelType? type)
{
await this.InvokeAsync(() =>
{
if (type == _currentPanelType)
if (type == null)
{
_currentPanelType = null;
// TODO: Ask parent to to collapse slider.
}
foreach (var kvp in _panelTypeMap)