Refactor new editor boundaries and test ownership

This commit is contained in:
2026-04-19 15:52:28 +08:00
parent dc13b56cf3
commit 93f06e84ed
279 changed files with 6349 additions and 3238 deletions

View File

@@ -3,6 +3,7 @@
#include <XCEditor/Panels/UIEditorPanelContentHost.h>
#include <XCEditor/Panels/UIEditorPanelRegistry.h>
#include <XCEditor/Viewport/UIEditorViewportShell.h>
#include <XCEditor/Workspace/UIEditorWorkspaceInputOwner.h>
#include <XCEditor/Workspace/UIEditorWorkspaceSession.h>
#include <XCEditor/Docking/UIEditorDockHost.h>
@@ -95,7 +96,8 @@ UIEditorWorkspaceComposeFrame UpdateUIEditorWorkspaceCompose(
const std::vector<::XCEngine::UI::UIInputEvent>& inputEvents,
const Widgets::UIEditorDockHostState& dockHostState = {},
const Widgets::UIEditorDockHostMetrics& dockHostMetrics = {},
const Widgets::UIEditorViewportSlotMetrics& viewportMetrics = {});
const Widgets::UIEditorViewportSlotMetrics& viewportMetrics = {},
const UIEditorWorkspaceInputOwner* inputOwner = nullptr);
std::vector<std::string> CollectUIEditorWorkspaceComposeExternalBodyPanelIds(
const UIEditorWorkspaceComposeFrame& frame);

View File

@@ -0,0 +1,54 @@
#pragma once
#include <XCEditor/Panels/UIEditorPanelContentHost.h>
#include <XCEditor/Docking/UIEditorDockHost.h>
#include <XCEngine/UI/Types.h>
#include <cstdint>
#include <string>
#include <string_view>
namespace XCEngine::UI::Editor {
enum class UIEditorWorkspaceInputOwnerKind : std::uint8_t {
None = 0,
DockHost,
HostedPanel,
Viewport
};
struct UIEditorWorkspaceInputOwner {
UIEditorWorkspaceInputOwnerKind kind = UIEditorWorkspaceInputOwnerKind::None;
std::string panelId = {};
};
std::string_view GetUIEditorWorkspaceInputOwnerKindName(
UIEditorWorkspaceInputOwnerKind kind);
bool AreUIEditorWorkspaceInputOwnersEquivalent(
const UIEditorWorkspaceInputOwner& lhs,
const UIEditorWorkspaceInputOwner& rhs);
bool IsUIEditorWorkspaceDockHostInputOwner(
const UIEditorWorkspaceInputOwner& owner);
bool IsUIEditorWorkspaceHostedPanelInputOwner(
const UIEditorWorkspaceInputOwner& owner,
std::string_view panelId = {});
bool IsUIEditorWorkspaceViewportInputOwner(
const UIEditorWorkspaceInputOwner& owner,
std::string_view panelId = {});
UIEditorWorkspaceInputOwner ResolveUIEditorWorkspacePointerInputOwner(
const Widgets::UIEditorDockHostLayout& dockHostLayout,
const UIEditorPanelContentHostFrame& contentHostFrame,
const ::XCEngine::UI::UIPoint& pointerPosition);
UIEditorWorkspaceInputOwner NormalizeUIEditorWorkspaceInputOwner(
UIEditorWorkspaceInputOwner owner,
const Widgets::UIEditorDockHostLayout& dockHostLayout,
const UIEditorPanelContentHostFrame& contentHostFrame);
} // namespace XCEngine::UI::Editor

View File

@@ -2,6 +2,7 @@
#include <XCEditor/Docking/UIEditorDockHostInteraction.h>
#include <XCEditor/Workspace/UIEditorWorkspaceCompose.h>
#include <XCEditor/Workspace/UIEditorWorkspaceInputOwner.h>
#include <XCEngine/UI/Types.h>
@@ -17,6 +18,7 @@ struct UIEditorWorkspaceInteractionModel {
struct UIEditorWorkspaceInteractionState {
UIEditorDockHostInteractionState dockHostInteractionState = {};
UIEditorWorkspaceComposeState composeState = {};
UIEditorWorkspaceInputOwner inputOwner = {};
};
struct UIEditorWorkspaceInteractionResult {
@@ -33,6 +35,9 @@ struct UIEditorWorkspaceInteractionFrame {
UIEditorDockHostInteractionFrame dockHostFrame = {};
UIEditorWorkspaceComposeFrame composeFrame = {};
UIEditorWorkspaceInteractionResult result = {};
UIEditorWorkspaceInputOwner previousInputOwner = {};
UIEditorWorkspaceInputOwner inputOwner = {};
bool inputOwnerChanged = false;
};
UIEditorWorkspaceInteractionFrame UpdateUIEditorWorkspaceInteraction(