Refine editor action shell and add regression tests
This commit is contained in:
@@ -30,11 +30,7 @@ void ProjectPanel::Render() {
|
||||
|
||||
UI::PanelToolbarScope toolbar("ProjectToolbar", UI::ProjectPanelToolbarHeight());
|
||||
if (toolbar.IsOpen()) {
|
||||
|
||||
bool canGoBack = manager.CanNavigateBack();
|
||||
if (Actions::DrawToolbarAction(Actions::MakeNavigateBackAction(canGoBack), UI::ProjectBackButtonSize())) {
|
||||
manager.NavigateBack();
|
||||
}
|
||||
Actions::DrawProjectNavigateBackAction(manager);
|
||||
ImGui::SameLine();
|
||||
|
||||
size_t pathDepth = manager.GetPathDepth();
|
||||
@@ -88,29 +84,10 @@ void ProjectPanel::Render() {
|
||||
searchStr.empty() ? "Current folder is empty" : "No assets match the current search");
|
||||
}
|
||||
|
||||
if (ImGui::IsWindowHovered() && ImGui::IsMouseClicked(0) && !ImGui::IsAnyItemHovered()) {
|
||||
manager.SetSelectedIndex(-1);
|
||||
}
|
||||
|
||||
m_itemContextMenu.ConsumeOpenRequest("ItemContextMenu");
|
||||
if (UI::BeginPopup("ItemContextMenu")) {
|
||||
if (m_itemContextMenu.HasTarget()) {
|
||||
Actions::DrawProjectAssetContextActions(*m_context, m_itemContextMenu.TargetValue());
|
||||
}
|
||||
UI::EndPopup();
|
||||
}
|
||||
if (!ImGui::IsPopupOpen("ItemContextMenu") && !m_itemContextMenu.HasPendingOpenRequest()) {
|
||||
m_itemContextMenu.Clear();
|
||||
}
|
||||
|
||||
if (ImGui::IsWindowHovered() && ImGui::IsMouseClicked(1) && !ImGui::IsAnyItemHovered()) {
|
||||
ImGui::OpenPopup("EmptyContextMenu");
|
||||
}
|
||||
|
||||
if (UI::BeginPopup("EmptyContextMenu")) {
|
||||
Actions::DrawProjectEmptyContextActions(m_createFolderDialog);
|
||||
UI::EndPopup();
|
||||
}
|
||||
Actions::HandleProjectBackgroundPrimaryClick(manager);
|
||||
Actions::DrawProjectItemContextPopup(*m_context, m_itemContextMenu);
|
||||
Actions::RequestProjectEmptyContextPopup(m_emptyContextMenu);
|
||||
Actions::DrawProjectEmptyContextPopup(m_emptyContextMenu, m_createFolderDialog);
|
||||
|
||||
Actions::DrawProjectCreateFolderDialog(*m_context, m_createFolderDialog);
|
||||
}
|
||||
@@ -132,19 +109,18 @@ void ProjectPanel::RenderAssetItem(const AssetItemPtr& item, int index) {
|
||||
});
|
||||
|
||||
if (tile.clicked) {
|
||||
manager.SetSelectedIndex(index);
|
||||
Actions::HandleProjectItemSelection(manager, index);
|
||||
}
|
||||
|
||||
if (tile.contextRequested) {
|
||||
manager.SetSelectedIndex(index);
|
||||
m_itemContextMenu.RequestOpen(item);
|
||||
Actions::HandleProjectItemContextRequest(manager, index, item, m_itemContextMenu);
|
||||
}
|
||||
|
||||
Actions::AcceptProjectAssetDrop(manager, item);
|
||||
Actions::BeginProjectAssetDrag(item, iconKind);
|
||||
|
||||
if (tile.openRequested) {
|
||||
Commands::OpenAsset(*m_context, item);
|
||||
Actions::OpenProjectAsset(*m_context, item);
|
||||
}
|
||||
|
||||
ImGui::PopID();
|
||||
|
||||
Reference in New Issue
Block a user