fix(new_editor/docking): darken overlay and use full center preview

This commit is contained in:
2026-04-15 13:37:39 +08:00
parent 51aea47c83
commit 608f33d4d3

View File

@@ -6,6 +6,7 @@
namespace XCEngine::UI::Editor::App::RuntimeSupport {
using ::XCEngine::UI::UIColor;
using ::XCEngine::UI::UIDrawList;
UIEditorShellComposeModel BuildShellComposeModelFromFrame(
@@ -47,6 +48,49 @@ void AppendShellPopups(
}
}
UIEditorShellComposeFrame BuildShellComposeFrameWithoutDockPreview(
const UIEditorShellComposeFrame& frame) {
UIEditorShellComposeFrame copy = frame;
copy.workspaceFrame.dockHostLayout.dropPreview = {};
return copy;
}
UIRect ResolveDockPreviewOverlayRect(const UIEditorShellComposeFrame& frame) {
const auto& dropPreview = frame.workspaceFrame.dockHostLayout.dropPreview;
UIRect previewRect = dropPreview.previewRect;
if (dropPreview.placement != UIEditorWorkspaceDockPlacement::Center) {
return previewRect;
}
for (const Widgets::UIEditorDockHostTabStackLayout& tabStack :
frame.workspaceFrame.dockHostLayout.tabStacks) {
if (tabStack.nodeId == dropPreview.targetNodeId) {
return tabStack.bounds;
}
}
return previewRect;
}
void AppendDockPreviewOverlay(
UIDrawList& drawList,
const UIEditorShellComposeFrame& frame) {
const auto& dropPreview = frame.workspaceFrame.dockHostLayout.dropPreview;
if (!dropPreview.visible) {
return;
}
const UIRect previewRect = ResolveDockPreviewOverlayRect(frame);
if (previewRect.width <= 0.0f || previewRect.height <= 0.0f) {
return;
}
static const UIColor kDropPreviewFillColor(0.56f, 0.56f, 0.56f, 0.06f);
static const UIColor kDropPreviewBorderColor(0.68f, 0.68f, 0.68f, 0.26f);
drawList.AddFilledRect(previewRect, kDropPreviewFillColor);
drawList.AddRectOutline(previewRect, kDropPreviewBorderColor, 1.0f);
}
} // namespace XCEngine::UI::Editor::App::RuntimeSupport
namespace XCEngine::UI::Editor::App {
@@ -64,9 +108,11 @@ void EditorShellRuntime::Append(UIDrawList& drawList) const {
const auto& palette = ResolveUIEditorShellInteractionPalette();
const UIEditorShellComposeModel shellComposeModel =
BuildShellComposeModelFromFrame(m_shellFrame);
const UIEditorShellComposeFrame shellComposeFrame =
BuildShellComposeFrameWithoutDockPreview(m_shellFrame.shellFrame);
AppendUIEditorShellCompose(
drawList,
m_shellFrame.shellFrame,
shellComposeFrame,
shellComposeModel,
m_shellInteractionState.composeState,
palette.shellPalette,
@@ -75,6 +121,7 @@ void EditorShellRuntime::Append(UIDrawList& drawList) const {
m_hierarchyPanel.Append(drawList);
m_inspectorPanel.Append(drawList);
m_projectPanel.Append(drawList);
AppendDockPreviewOverlay(drawList, m_shellFrame.shellFrame);
AppendShellPopups(drawList, m_shellFrame, palette, metrics);
}