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
|
||||
{
|
||||
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 SPLITTER_THICKNESS = 4;
|
||||
|
||||
private Border? _dropTargetOverlay;
|
||||
private readonly HashSet<DockNode> _subscribedNodes = new();
|
||||
|
||||
public enum DockPosition { Center, Top, Bottom, Left, Right, None }
|
||||
|
||||
public DockLayout()
|
||||
{
|
||||
DefaultStyleKey = typeof(DockLayout);
|
||||
@@ -287,6 +291,7 @@ public sealed partial class DockLayout : Control
|
||||
protected override void OnApplyTemplate()
|
||||
{
|
||||
base.OnApplyTemplate();
|
||||
_dropTargetOverlay = GetTemplateChild(PART_DROP_TARGET_OVERLAY) as Border;
|
||||
RenderTree();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,15 @@
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<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>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
|
||||
Reference in New Issue
Block a user