Add workspace panel overlay routing

This commit is contained in:
2026-04-29 17:34:31 +08:00
parent 4a125cbe7f
commit f74503c2a5
21 changed files with 458 additions and 53 deletions

View File

@@ -792,6 +792,9 @@ void InspectorPanel::Update(
RefreshPresentation(context, subjectChanged);
ApplyColorPickerToolValue(context);
RebuildScrollableLayout();
const std::vector<UIRect> popupBounds = CollectInteractiveOverlayBounds();
const std::vector<UIInputEvent> filteredEvents =
BuildUIEditorPanelInputEvents(
@@ -812,7 +815,8 @@ void InspectorPanel::Update(
HasActivePointerCapture()
},
dispatchEntry.focusGained,
dispatchEntry.focusLost);
dispatchEntry.focusLost,
popupBounds.empty() ? nullptr : &popupBounds);
TryClaimHostedPanelCommandFocus(
m_commandFocusService,
EditorActionRoute::Inspector,
@@ -820,7 +824,6 @@ void InspectorPanel::Update(
m_bounds,
dispatchEntry.allowInteraction);
RebuildScrollableLayout();
const UIRect scrollViewportBounds = BuildScrollViewportBounds();
if (scrollViewportBounds.width > 0.0f && scrollViewportBounds.height > 0.0f) {
m_scrollInteractionState.scrollViewState.focused =
@@ -951,7 +954,8 @@ void InspectorPanel::Append(UIDrawList& drawList) const {
::XCEngine::UI::Editor::GetUIEditorFixedPropertyGridMetrics(),
{},
{},
m_textMeasurer);
m_textMeasurer,
false);
}
if (ShouldShowAddComponentButton()) {
@@ -985,6 +989,71 @@ void InspectorPanel::Append(UIDrawList& drawList) const {
drawList.PopClipRect();
}
void InspectorPanel::AppendOverlay(UIDrawList& drawList) const {
if (!m_visible) {
return;
}
Widgets::UIEditorMenuPopupLayout popupLayout = {};
Widgets::UIEditorMenuPopupState popupState = {};
std::vector<Widgets::UIEditorMenuPopupItem> popupItems = {};
if (!BuildPropertyGridPopupRuntime(popupLayout, popupState, popupItems)) {
return;
}
const Widgets::UIEditorMenuPopupMetrics& popupMetrics =
ResolveUIEditorMenuPopupMetrics();
const Widgets::UIEditorMenuPopupPalette& popupPalette =
ResolveUIEditorMenuPopupPalette();
Widgets::AppendUIEditorMenuPopupBackground(
drawList,
popupLayout,
popupItems,
popupState,
popupPalette,
popupMetrics);
Widgets::AppendUIEditorMenuPopupForeground(
drawList,
popupLayout,
popupItems,
popupState,
popupPalette,
popupMetrics);
}
std::vector<UIRect> InspectorPanel::CollectInteractiveOverlayBounds() const {
Widgets::UIEditorMenuPopupLayout popupLayout = {};
Widgets::UIEditorMenuPopupState popupState = {};
std::vector<Widgets::UIEditorMenuPopupItem> popupItems = {};
if (!BuildPropertyGridPopupRuntime(popupLayout, popupState, popupItems) ||
popupLayout.popupRect.width <= 0.0f ||
popupLayout.popupRect.height <= 0.0f) {
return {};
}
return { popupLayout.popupRect };
}
bool InspectorPanel::BuildPropertyGridPopupRuntime(
Widgets::UIEditorMenuPopupLayout& popupLayout,
Widgets::UIEditorMenuPopupState& popupState,
std::vector<Widgets::UIEditorMenuPopupItem>& popupItems) const {
if (!m_visible ||
m_gridFrame.layout.bounds.width <= 0.0f ||
m_gridFrame.layout.bounds.height <= 0.0f) {
return false;
}
return Widgets::BuildUIEditorPropertyGridPopupRuntime(
m_gridFrame.layout,
m_presentation.sections,
m_interactionState.propertyGridState,
popupLayout,
popupState,
popupItems,
ResolveUIEditorMenuPopupMetrics());
}
UIEditorHostCommandEvaluationResult InspectorPanel::EvaluateEditCommand(
std::string_view commandId) const {
const InspectorPresentationComponentBinding* binding =