refactor(editor): isolate engine service boundaries

This commit is contained in:
2026-04-29 03:19:46 +08:00
parent ef11651ec2
commit 313a571e43
60 changed files with 3804 additions and 2611 deletions

View File

@@ -0,0 +1,62 @@
#include "Game/GameViewportController.h"
#include "Panels/EditorPanelIds.h"
#include "State/EditorCommandFocusService.h"
#include <algorithm>
namespace XCEngine::UI::Editor::App {
namespace {
bool ContainsPoint(
const ::XCEngine::UI::UIRect& rect,
const ::XCEngine::UI::UIPoint& point) {
return point.x >= rect.x &&
point.x <= rect.x + rect.width &&
point.y >= rect.y &&
point.y <= rect.y + rect.height;
}
} // namespace
void GameViewportController::ResetInteractionState() {}
void GameViewportController::SetCommandFocusService(
EditorCommandFocusService* commandFocusService) {
m_commandFocusService = commandFocusService;
}
void GameViewportController::Update(
const UIEditorWorkspaceComposeState& composeState,
const UIEditorWorkspaceComposeFrame& composeFrame) {
const UIEditorWorkspaceViewportComposeFrame* viewportFrame =
FindUIEditorWorkspaceViewportPresentationFrame(composeFrame, kGamePanelId);
const UIEditorWorkspacePanelPresentationState* panelState =
FindUIEditorWorkspacePanelPresentationState(composeState, kGamePanelId);
if (viewportFrame == nullptr || panelState == nullptr) {
return;
}
const auto& inputFrame = viewportFrame->viewportShellFrame.inputFrame;
const auto& slotLayout = viewportFrame->viewportShellFrame.slotLayout;
if (m_commandFocusService != nullptr &&
(inputFrame.focused ||
std::any_of(
inputFrame.pointerButtonTransitions.begin(),
inputFrame.pointerButtonTransitions.end(),
[&](const auto& transition) {
return transition.pressed &&
ContainsPoint(slotLayout.bounds, transition.screenPosition);
}))) {
m_commandFocusService->ClaimFocus(EditorActionRoute::Game);
}
(void)panelState;
}
void GameViewportController::Append(::XCEngine::UI::UIDrawList& drawList) const {
(void)drawList;
}
} // namespace XCEngine::UI::Editor::App