feat(new_editor): wire project, inspector, and viewport runtime
This commit is contained in:
@@ -9,6 +9,15 @@ using Widgets::UIEditorViewportSlotFrame;
|
||||
using Widgets::UIEditorViewportSlotLayout;
|
||||
using Widgets::UIEditorViewportSlotState;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
UIEditorViewportSlotLayout BuildViewportShellLayout(
|
||||
const ::XCEngine::UI::UIRect& bounds,
|
||||
const UIEditorViewportShellSpec& spec,
|
||||
@@ -25,10 +34,13 @@ UIEditorViewportSlotLayout BuildViewportShellLayout(
|
||||
|
||||
UIEditorViewportSlotState BuildViewportShellSlotState(
|
||||
const UIEditorViewportShellVisualState& visualState,
|
||||
const UIEditorViewportInputBridgeFrame& inputFrame) {
|
||||
const UIEditorViewportInputBridgeFrame& inputFrame,
|
||||
const UIEditorViewportSlotLayout& slotLayout) {
|
||||
UIEditorViewportSlotState slotState = {};
|
||||
slotState.focused = inputFrame.focused;
|
||||
slotState.surfaceHovered = inputFrame.hovered;
|
||||
slotState.surfaceHovered =
|
||||
inputFrame.hasPointerPosition &&
|
||||
ContainsPoint(slotLayout.inputRect, inputFrame.screenPointerPosition);
|
||||
slotState.surfaceActive = inputFrame.focused || inputFrame.captured;
|
||||
slotState.inputCaptured = inputFrame.captured;
|
||||
slotState.hoveredToolIndex = visualState.hoveredToolIndex;
|
||||
@@ -62,10 +74,15 @@ UIEditorViewportShellFrame UpdateUIEditorViewportShell(
|
||||
frame.requestedViewportSize = frame.slotLayout.requestedSurfaceSize;
|
||||
frame.inputFrame = UpdateUIEditorViewportInputBridge(
|
||||
state.inputBridgeState,
|
||||
frame.slotLayout.bounds,
|
||||
frame.slotLayout.inputRect,
|
||||
inputEvents,
|
||||
model.spec.inputBridgeConfig);
|
||||
frame.slotState = BuildViewportShellSlotState(model.spec.visualState, frame.inputFrame);
|
||||
frame.slotState =
|
||||
BuildViewportShellSlotState(
|
||||
model.spec.visualState,
|
||||
frame.inputFrame,
|
||||
frame.slotLayout);
|
||||
return frame;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user