feat(dock): add visual drop target overlay
This commit is contained in:
@@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,15 @@
|
|||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<ControlTemplate TargetType="local:DockLayout">
|
<ControlTemplate TargetType="local:DockLayout">
|
||||||
|
<Grid>
|
||||||
<Grid x:Name="PART_RootGrid" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" />
|
<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>
|
||||||
|
|||||||
Reference in New Issue
Block a user