diff --git a/build/Avalonia.Desktop.props b/build/Avalonia.Desktop.props index f2ca8ac03..1c25a8e39 100644 --- a/build/Avalonia.Desktop.props +++ b/build/Avalonia.Desktop.props @@ -1,7 +1,7 @@  - + diff --git a/build/Avalonia.props b/build/Avalonia.props index 9c0eb8de2..37a1c34dd 100644 --- a/build/Avalonia.props +++ b/build/Avalonia.props @@ -1,6 +1,6 @@  - + diff --git a/src/Dock.Avalonia/Controls/HostWindow.cs b/src/Dock.Avalonia/Controls/HostWindow.cs index d453f1ab4..2b357af75 100644 --- a/src/Dock.Avalonia/Controls/HostWindow.cs +++ b/src/Dock.Avalonia/Controls/HostWindow.cs @@ -191,40 +191,46 @@ protected override void OnPointerPressed(PointerPressedEventArgs e) if (_topHorizontalGrip != null && _topHorizontalGrip.IsPointerOver) { - BeginResizeDrag(WindowEdge.North); + BeginResizeDrag(WindowEdge.North, e); } else if (_bottomHorizontalGrip != null && _bottomHorizontalGrip.IsPointerOver) { - BeginResizeDrag(WindowEdge.South); + BeginResizeDrag(WindowEdge.South, e); } else if (_leftVerticalGrip != null && _leftVerticalGrip.IsPointerOver) { - BeginResizeDrag(WindowEdge.West); + BeginResizeDrag(WindowEdge.West, e); } else if (_rightVerticalGrip != null && _rightVerticalGrip.IsPointerOver) { - BeginResizeDrag(WindowEdge.East); + BeginResizeDrag(WindowEdge.East, e); } else if (_topLeftGrip != null && _topLeftGrip.IsPointerOver) { - BeginResizeDrag(WindowEdge.NorthWest); + BeginResizeDrag(WindowEdge.NorthWest, e); } else if (_bottomLeftGrip != null && _bottomLeftGrip.IsPointerOver) { - BeginResizeDrag(WindowEdge.SouthWest); + BeginResizeDrag(WindowEdge.SouthWest, e); } else if (_topRightGrip != null && _topRightGrip.IsPointerOver) { - BeginResizeDrag(WindowEdge.NorthEast); + BeginResizeDrag(WindowEdge.NorthEast, e); } else if (_bottomRightGrip != null && _bottomRightGrip.IsPointerOver) { - BeginResizeDrag(WindowEdge.SouthEast); + BeginResizeDrag(WindowEdge.SouthEast, e); } else if (_titleBar != null && _titleBar.IsPointerOver) { _mouseDown = true; _startPoint = e.GetPosition(this); + + if (e.GetCurrentPoint(this).Properties.IsLeftButtonPressed && !s_useCustomDrag) + { + BeginMoveDrag(e); + _mouseDown = false; + } } else { @@ -257,12 +263,6 @@ protected override void OnPointerMoved(PointerEventArgs e) Position = this.Position.WithX((int)x).WithY((int)y); _startPoint = new Point(point.X - delta.X, point.Y - delta.Y); } - else - { - WindowState = WindowState.Normal; - BeginMoveDrag(); - _mouseDown = false; - } } } diff --git a/src/Dock.Avalonia/Controls/MetroWindow.cs b/src/Dock.Avalonia/Controls/MetroWindow.cs index 5991fd52a..3d86028ef 100644 --- a/src/Dock.Avalonia/Controls/MetroWindow.cs +++ b/src/Dock.Avalonia/Controls/MetroWindow.cs @@ -79,39 +79,45 @@ protected override void OnPointerPressed(PointerPressedEventArgs e) { if (_topHorizontalGrip != null && _topHorizontalGrip.IsPointerOver) { - BeginResizeDrag(WindowEdge.North); + BeginResizeDrag(WindowEdge.North, e); } else if (_bottomHorizontalGrip != null && _bottomHorizontalGrip.IsPointerOver) { - BeginResizeDrag(WindowEdge.South); + BeginResizeDrag(WindowEdge.South, e); } else if (_leftVerticalGrip != null && _leftVerticalGrip.IsPointerOver) { - BeginResizeDrag(WindowEdge.West); + BeginResizeDrag(WindowEdge.West, e); } else if (_rightVerticalGrip != null && _rightVerticalGrip.IsPointerOver) { - BeginResizeDrag(WindowEdge.East); + BeginResizeDrag(WindowEdge.East, e); } else if (_topLeftGrip != null && _topLeftGrip.IsPointerOver) { - BeginResizeDrag(WindowEdge.NorthWest); + BeginResizeDrag(WindowEdge.NorthWest, e); } else if (_bottomLeftGrip != null && _bottomLeftGrip.IsPointerOver) { - BeginResizeDrag(WindowEdge.SouthWest); + BeginResizeDrag(WindowEdge.SouthWest, e); } else if (_topRightGrip != null && _topRightGrip.IsPointerOver) { - BeginResizeDrag(WindowEdge.NorthEast); + BeginResizeDrag(WindowEdge.NorthEast, e); } else if (_bottomRightGrip != null && _bottomRightGrip.IsPointerOver) { - BeginResizeDrag(WindowEdge.SouthEast); + BeginResizeDrag(WindowEdge.SouthEast, e); } else if (_titleBar != null && _titleBar.IsPointerOver) { _mouseDown = true; + + if(e.GetCurrentPoint(this).Properties.IsLeftButtonPressed) + { + BeginMoveDrag(e); + _mouseDown = false; + } } else { @@ -128,18 +134,6 @@ protected override void OnPointerReleased(PointerReleasedEventArgs e) base.OnPointerReleased(e); } - /// - protected override void OnPointerMoved(PointerEventArgs e) - { - if (_titleBar != null && _titleBar.IsPointerOver && _mouseDown) - { - WindowState = WindowState.Normal; - BeginMoveDrag(); - _mouseDown = false; - } - base.OnPointerMoved(e); - } - /// protected override void OnTemplateApplied(TemplateAppliedEventArgs e) {