Skip to content

Commit 9d9df6a

Browse files
Merge pull request #1069 from danwalmsley/features/window-drag-helper-public
make window drag helper public.
2 parents 2c5a53a + 8645d9d commit 9d9df6a

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

src/Dock.Avalonia/Internal/WindowDragHelper.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace Dock.Avalonia.Internal;
1515
/// <summary>
1616
/// Helper that enables starting window drag operations from custom controls.
1717
/// </summary>
18-
internal class WindowDragHelper
18+
public class WindowDragHelper
1919
{
2020
private readonly Control _owner;
2121
private readonly Func<bool> _isEnabled;
@@ -33,6 +33,9 @@ internal class WindowDragHelper
3333
private IDisposable[]? _disposables;
3434
private IDisposable? _releasedEventDisposable;
3535

36+
/// <summary>
37+
/// Initializes a helper that starts tracked window move drags from a custom control.
38+
/// </summary>
3639
public WindowDragHelper(
3740
Control owner,
3841
Func<bool> isEnabled,
@@ -47,6 +50,9 @@ public WindowDragHelper(
4750
_getDockScope = getDockScope ?? (_ => WindowDragDockScope.FullWindow);
4851
}
4952

53+
/// <summary>
54+
/// Attaches pointer handlers to the owner control.
55+
/// </summary>
5056
public void Attach()
5157
{
5258
Detach();
@@ -58,6 +64,9 @@ public void Attach()
5864
];
5965
}
6066

67+
/// <summary>
68+
/// Detaches pointer handlers and clears any in-progress drag state.
69+
/// </summary>
6170
public void Detach()
6271
{
6372
if (_disposables != null)
@@ -262,7 +271,11 @@ private IDisposable SubscribeToPointerReleased(Window window)
262271
return window.AddDisposableHandler(InputElement.PointerReleasedEvent, OnPointerReleased, RoutingStrategies.Tunnel);
263272
}
264273

265-
internal static bool IsChildOfType<T>(Control owner, Control control) where T : Control
274+
/// <summary>
275+
/// Determines whether <paramref name="control"/> has an ancestor of type <typeparamref name="T"/>
276+
/// before reaching <paramref name="owner"/>.
277+
/// </summary>
278+
public static bool IsChildOfType<T>(Control owner, Control control) where T : Control
266279
{
267280
var parent = control;
268281
while (parent != null && parent != owner)

0 commit comments

Comments
 (0)