Polish shared editor tree context behavior

This commit is contained in:
2026-03-28 00:03:20 +08:00
parent 7d6032be23
commit b77615569c
7 changed files with 164 additions and 38 deletions

View File

@@ -109,8 +109,9 @@ void HierarchyPanel::Render() {
}
Actions::HandleHierarchyBackgroundPrimaryClick(*m_context, m_renameState);
Actions::DrawHierarchyBackgroundContextPopup(*m_context);
Actions::RequestHierarchyBackgroundContextPopup(m_backgroundContextMenu);
Actions::DrawHierarchyEntityContextPopup(*m_context, m_itemContextMenu);
Actions::DrawHierarchyBackgroundContextPopup(*m_context, m_backgroundContextMenu);
Actions::DrawHierarchyRootDropTarget(*m_context);
}
ImGui::PopStyleColor(2);
@@ -153,6 +154,10 @@ void HierarchyPanel::RenderEntity(::XCEngine::Components::GameObject* gameObject
Actions::HandleHierarchySelectionClick(*m_context, gameObject->GetID(), ImGui::GetIO().KeyCtrl);
}
if (node.secondaryClicked) {
Actions::HandleHierarchyItemContextRequest(*m_context, gameObject, m_itemContextMenu);
}
if (node.doubleClicked) {
BeginRename(gameObject);
}
@@ -160,7 +165,6 @@ void HierarchyPanel::RenderEntity(::XCEngine::Components::GameObject* gameObject
nodeDefinition.callbacks.onRenderExtras = [this, gameObject]() {
Actions::BeginHierarchyEntityDrag(gameObject);
Actions::AcceptHierarchyEntityDrop(*m_context, gameObject);
Actions::DrawHierarchyEntityContextPopup(*m_context, gameObject);
};
const UI::TreeNodeResult node = UI::DrawTreeNode(