From 608f33d4d32fd569d1a4809b02a73052d246cba0 Mon Sep 17 00:00:00 2001 From: ssdfasd <2156608475@qq.com> Date: Wed, 15 Apr 2026 13:37:39 +0800 Subject: [PATCH] fix(new_editor/docking): darken overlay and use full center preview --- .../EditorShellRuntimeRendering.cpp | 49 ++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/new_editor/app/Composition/EditorShellRuntimeRendering.cpp b/new_editor/app/Composition/EditorShellRuntimeRendering.cpp index 982502e1..15e01402 100644 --- a/new_editor/app/Composition/EditorShellRuntimeRendering.cpp +++ b/new_editor/app/Composition/EditorShellRuntimeRendering.cpp @@ -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); }