feat(dock): add visual drop target overlay

This commit is contained in:
2026-03-28 13:32:29 +09:00
parent ad90bf1d34
commit 49e6bbe8b0
2 changed files with 14 additions and 1 deletions

View File

@@ -15,11 +15,15 @@ namespace Ghost.Editor.View.Controls;
public sealed partial class DockLayout : Control public sealed partial class DockLayout : Control
{ {
private const string PART_ROOT_GRID = "PART_RootGrid"; private const string PART_ROOT_GRID = "PART_RootGrid";
private const string PART_DROP_TARGET_OVERLAY = "PART_DropTargetOverlay";
private const double MIN_PANE_SIZE = 100; private const double MIN_PANE_SIZE = 100;
private const double SPLITTER_THICKNESS = 4; private const double SPLITTER_THICKNESS = 4;
private Border? _dropTargetOverlay;
private readonly HashSet<DockNode> _subscribedNodes = new(); private readonly HashSet<DockNode> _subscribedNodes = new();
public enum DockPosition { Center, Top, Bottom, Left, Right, None }
public DockLayout() public DockLayout()
{ {
DefaultStyleKey = typeof(DockLayout); DefaultStyleKey = typeof(DockLayout);
@@ -287,6 +291,7 @@ public sealed partial class DockLayout : Control
protected override void OnApplyTemplate() protected override void OnApplyTemplate()
{ {
base.OnApplyTemplate(); base.OnApplyTemplate();
_dropTargetOverlay = GetTemplateChild(PART_DROP_TARGET_OVERLAY) as Border;
RenderTree(); RenderTree();
} }
} }

View File

@@ -7,7 +7,15 @@
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="local:DockLayout"> <ControlTemplate TargetType="local:DockLayout">
<Grid x:Name="PART_RootGrid" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" /> <Grid>
<Grid x:Name="PART_RootGrid" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" />
<Border x:Name="PART_DropTargetOverlay"
Background="#660078D4"
BorderBrush="#FF0078D4"
BorderThickness="2"
Visibility="Collapsed"
IsHitTestVisible="False" />
</Grid>
</ControlTemplate> </ControlTemplate>
</Setter.Value> </Setter.Value>
</Setter> </Setter>