Refactor new editor state ownership model
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
#include "Host/ViewportRenderHost.h"
|
||||
#include "State/EditorContext.h"
|
||||
|
||||
#include "Composition/EditorPanelIds.h"
|
||||
|
||||
#include <XCEngine/Rendering/RenderContext.h>
|
||||
|
||||
namespace XCEngine::UI::Editor::App {
|
||||
@@ -104,42 +106,56 @@ Widgets::UIEditorDockHostCursorKind EditorShellRuntime::GetDockCursorKind() cons
|
||||
m_shellFrame.workspaceInteractionFrame.dockHostFrame.layout);
|
||||
}
|
||||
|
||||
EditorShellPointerOwner EditorShellRuntime::GetPointerOwner() const {
|
||||
const auto& dockHostInteractionState =
|
||||
m_shellInteractionState.workspaceInteractionState.dockHostInteractionState;
|
||||
if (dockHostInteractionState.splitterDragState.active ||
|
||||
!dockHostInteractionState.activeTabDragNodeId.empty()) {
|
||||
return EditorShellPointerOwner::DockHost;
|
||||
}
|
||||
|
||||
for (const auto& panelState :
|
||||
m_shellInteractionState.workspaceInteractionState.composeState.panelStates) {
|
||||
if (!panelState.viewportShellState.inputBridgeState.captured) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (panelState.panelId == kGamePanelId) {
|
||||
return EditorShellPointerOwner::GameViewport;
|
||||
}
|
||||
|
||||
return EditorShellPointerOwner::SceneViewport;
|
||||
}
|
||||
|
||||
if (m_hierarchyPanel.HasActivePointerCapture()) {
|
||||
return EditorShellPointerOwner::HierarchyPanel;
|
||||
}
|
||||
|
||||
if (m_projectPanel.HasActivePointerCapture()) {
|
||||
return EditorShellPointerOwner::ProjectPanel;
|
||||
}
|
||||
|
||||
return EditorShellPointerOwner::None;
|
||||
}
|
||||
|
||||
bool EditorShellRuntime::WantsHostPointerCapture() const {
|
||||
return m_hierarchyPanel.WantsHostPointerCapture() ||
|
||||
m_projectPanel.WantsHostPointerCapture();
|
||||
return IsHostedContentPointerOwner(GetPointerOwner());
|
||||
}
|
||||
|
||||
bool EditorShellRuntime::WantsHostPointerRelease() const {
|
||||
return (m_hierarchyPanel.WantsHostPointerRelease() ||
|
||||
m_projectPanel.WantsHostPointerRelease()) &&
|
||||
!HasHostedContentCapture();
|
||||
return !IsHostedContentPointerOwner(GetPointerOwner());
|
||||
}
|
||||
|
||||
bool EditorShellRuntime::HasHostedContentCapture() const {
|
||||
return m_hierarchyPanel.HasActivePointerCapture() ||
|
||||
m_projectPanel.HasActivePointerCapture();
|
||||
return IsHostedContentPointerOwner(GetPointerOwner());
|
||||
}
|
||||
|
||||
bool EditorShellRuntime::HasShellInteractiveCapture() const {
|
||||
if (m_shellInteractionState.workspaceInteractionState.dockHostInteractionState.splitterDragState.active) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!m_shellInteractionState.workspaceInteractionState.dockHostInteractionState.activeTabDragNodeId.empty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (const auto& panelState : m_shellInteractionState.workspaceInteractionState.composeState.panelStates) {
|
||||
if (panelState.viewportShellState.inputBridgeState.captured) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return IsShellPointerOwner(GetPointerOwner());
|
||||
}
|
||||
|
||||
bool EditorShellRuntime::HasInteractiveCapture() const {
|
||||
return HasShellInteractiveCapture() || HasHostedContentCapture();
|
||||
return GetPointerOwner() != EditorShellPointerOwner::None;
|
||||
}
|
||||
|
||||
} // namespace XCEngine::UI::Editor::App
|
||||
|
||||
Reference in New Issue
Block a user