diff --git a/Brio/UI/Entitites/EntityHierarchyView.cs b/Brio/UI/Entitites/EntityHierarchyView.cs index 9bbd311b..008c5823 100644 --- a/Brio/UI/Entitites/EntityHierarchyView.cs +++ b/Brio/UI/Entitites/EntityHierarchyView.cs @@ -42,7 +42,7 @@ private void DrawEntity(Entity entity, EntityId? selectedEntityId, float lastOff { bool isSelected = false; bool hasChildren = false; - + if(entity.Children.Count > 0) hasChildren = true; if(selectedEntityId != null && entity.Id.Equals(selectedEntityId)) @@ -52,20 +52,18 @@ private void DrawEntity(Entity entity, EntityId? selectedEntityId, float lastOff { using(ImRaii.PushColor(ImGuiCol.Button, 0)) { - { - var invsButtonPos = ImGui.GetCursorPos(); - - if(ImGui.Button($"###{entity.Id}_invs_button", new(buttonWidth, 0))) - { - Select(entity); - } - if(ImGui.IsItemClicked(ImGuiMouseButton.Right)) - { - ImGui.OpenPopup($"context_popup"); - } + var invsButtonPos = ImGui.GetCursorPos(); - ImGui.SetCursorPos(invsButtonPos); + if(ImGui.Button($"###{entity.Id}_invs_button", new(buttonWidth, 0))) + { + Select(entity); + } + if(ImGui.IsItemClicked(ImGuiMouseButton.Right)) + { + ImGui.OpenPopup($"context_popup{entity.Id}"); } + + ImGui.SetCursorPos(invsButtonPos); } if(lastOffset > 0) @@ -80,30 +78,32 @@ private void DrawEntity(Entity entity, EntityId? selectedEntityId, float lastOff { using(ImRaii.Disabled(true)) { - ImGui.Button($"###{entity.Id}"); + ImGui.Button($"###tab_{entity.Id}"); } } } DrawNode(entity); - if(hasChildren) + using(var popup = ImRaii.Popup($"context_popup{entity.Id}")) { - foreach(var child in entity.Children) - DrawEntity(child, selectedEntityId, lastOffset == 0 ? 3 : lastOffset); - } - - using var popup = ImRaii.Popup("context_popup"); - if(popup.Success) - { - foreach(var v in entity.Capabilities) + if(popup.Success) { - if(v.Widget is not null && v.Widget.Flags.HasFlag(WidgetFlags.DrawPopup)) + foreach(var v in entity.Capabilities) { - v.Widget.DrawPopup(); + if(v.Widget is not null && v.Widget.Flags.HasFlag(WidgetFlags.DrawPopup)) + { + v.Widget.DrawPopup(); + } } } } + + if(hasChildren) + { + foreach(var child in entity.Children) + DrawEntity(child, selectedEntityId, lastOffset == 0 ? 3 : lastOffset); + } } private static void DrawNode(Entity entity)