diff --git a/src/ClaudeDo.Ui/Design/IslandStyles.axaml b/src/ClaudeDo.Ui/Design/IslandStyles.axaml index 191ccc6..2f62fa1 100644 --- a/src/ClaudeDo.Ui/Design/IslandStyles.axaml +++ b/src/ClaudeDo.Ui/Design/IslandStyles.axaml @@ -21,6 +21,7 @@ M4 9 H16 V11 H4 Z M4 4 H16 V6 H4 Z M4 14 H16 V16 H4 Z M4 4 H6 V16 H4 Z M14 4 H16 V16 H14 Z + M4 7 H13 V9 H4 Z M4 14 H13 V16 H4 Z M4 7 H6 V16 H4 Z M11 7 H13 V16 H11 Z M7 4 H16 V6 H7 Z M14 4 H16 V13 H14 Z M4 5 L5 4 L16 15 L15 16 Z M15 4 L16 5 L5 16 L4 15 Z M3 3 H21 V21 H3 Z M6 12 L7 11 L10 14 L17 7 L18 8 L10 16 Z @@ -1034,4 +1035,23 @@ + + + + + + + diff --git a/src/ClaudeDo.Ui/Views/Controls/ModalShell.axaml.cs b/src/ClaudeDo.Ui/Views/Controls/ModalShell.axaml.cs index 98ac50d..9ae35f3 100644 --- a/src/ClaudeDo.Ui/Views/Controls/ModalShell.axaml.cs +++ b/src/ClaudeDo.Ui/Views/Controls/ModalShell.axaml.cs @@ -1,4 +1,3 @@ -using System; using System.Windows.Input; using Avalonia; using Avalonia.Controls; @@ -23,16 +22,49 @@ public class ModalShell : ContentControl public object? Footer { get => GetValue(FooterProperty); set => SetValue(FooterProperty, value); } public ICommand? CloseCommand { get => GetValue(CloseCommandProperty); set => SetValue(CloseCommandProperty, value); } + private Window? _window; + private PixelPoint _dragStartScreen; + private PixelPoint _dragStartPos; + private bool _dragging; + protected override void OnApplyTemplate(TemplateAppliedEventArgs e) { base.OnApplyTemplate(e); if (e.NameScope.Find("PART_TitleBar") is { } bar) + { bar.PointerPressed += OnTitleBarPressed; + bar.PointerMoved += OnTitleBarMoved; + bar.PointerReleased += OnTitleBarReleased; + } } + // VisualRoot is a TopLevelHost (not the Window) in Avalonia 12, so resolve the + // owning Window via TopLevel.GetTopLevel and drive the move manually — BeginMoveDrag + // and a VisualRoot-as-Window cast both fail here. private void OnTitleBarPressed(object? sender, PointerPressedEventArgs e) { - if (e.GetCurrentPoint(this).Properties.IsLeftButtonPressed && VisualRoot is Window w) - w.BeginMoveDrag(e); + if (!e.GetCurrentPoint(this).Properties.IsLeftButtonPressed) return; + _window = TopLevel.GetTopLevel(this) as Window; + if (_window is null) return; + _dragStartScreen = _window.PointToScreen(e.GetPosition(_window)); + _dragStartPos = _window.Position; + _dragging = true; + e.Pointer.Capture(sender as IInputElement); + } + + private void OnTitleBarMoved(object? sender, PointerEventArgs e) + { + if (!_dragging || _window is null + || !e.GetCurrentPoint(this).Properties.IsLeftButtonPressed) return; + var cur = _window.PointToScreen(e.GetPosition(_window)); + _window.Position = new PixelPoint( + _dragStartPos.X + (cur.X - _dragStartScreen.X), + _dragStartPos.Y + (cur.Y - _dragStartScreen.Y)); + } + + private void OnTitleBarReleased(object? sender, PointerReleasedEventArgs e) + { + _dragging = false; + e.Pointer.Capture(null); } } diff --git a/src/ClaudeDo.Ui/Views/MainWindow.axaml b/src/ClaudeDo.Ui/Views/MainWindow.axaml index 1c922e8..ef81bce 100644 --- a/src/ClaudeDo.Ui/Views/MainWindow.axaml +++ b/src/ClaudeDo.Ui/Views/MainWindow.axaml @@ -82,7 +82,7 @@