From 5521a8cce2db21913da3d08f3085972ec1840352 Mon Sep 17 00:00:00 2001 From: Misaki Date: Sat, 28 Mar 2026 22:10:08 +0900 Subject: [PATCH] fix(docking): address code quality issues in DockingLayout and DockRegionHighlight --- .../View/Controls/Docking/DockRegionHighlight.xaml | 2 +- .../View/Controls/Docking/DockingLayout.cs | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Editor/Ghost.Editor/View/Controls/Docking/DockRegionHighlight.xaml b/src/Editor/Ghost.Editor/View/Controls/Docking/DockRegionHighlight.xaml index 99023f1..1959f90 100644 --- a/src/Editor/Ghost.Editor/View/Controls/Docking/DockRegionHighlight.xaml +++ b/src/Editor/Ghost.Editor/View/Controls/Docking/DockRegionHighlight.xaml @@ -7,7 +7,7 @@ - + diff --git a/src/Editor/Ghost.Editor/View/Controls/Docking/DockingLayout.cs b/src/Editor/Ghost.Editor/View/Controls/Docking/DockingLayout.cs index 97754ff..a854c66 100644 --- a/src/Editor/Ghost.Editor/View/Controls/Docking/DockingLayout.cs +++ b/src/Editor/Ghost.Editor/View/Controls/Docking/DockingLayout.cs @@ -34,14 +34,23 @@ public class DockingLayout : Control private static void OnRootPanelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { - if (d is DockingLayout layout && e.NewValue is DockPanel panel) + if (d is DockingLayout layout) { - panel.Root = layout; + if (e.OldValue is DockPanel oldPanel) + { + oldPanel.Root = null; + } + + if (e.NewValue is DockPanel newPanel) + { + newPanel.Root = layout; + } } } public void AddDocument(DockDocument document, DockTarget target, DockGroup? targetGroup = null) { + // TODO: Handle non-Center targets (Task 5) if (RootPanel == null) { RootPanel = new DockPanel();