Skip to content

Commit

Permalink
update avalonia
Browse files Browse the repository at this point in the history
  • Loading branch information
danwalmsley committed Oct 15, 2019
1 parent 4488058 commit 45164fc
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 36 deletions.
2 changes: 1 addition & 1 deletion build/Avalonia.Desktop.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="Avalonia.Desktop" Version="0.8.999-cibuild0004405-beta" />
<PackageReference Include="Avalonia.Desktop" Version="0.9.0-preview1" />
<PackageReference Include="Avalonia.Angle.Windows.Natives" Version="2.1.0.2019013001" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion build/Avalonia.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.8.999-cibuild0004405-beta" />
<PackageReference Include="Avalonia" Version="0.9.0-preview1" />
</ItemGroup>
</Project>
28 changes: 14 additions & 14 deletions src/Dock.Avalonia/Controls/HostWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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;
}
}
}

Expand Down
34 changes: 14 additions & 20 deletions src/Dock.Avalonia/Controls/MetroWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -128,18 +134,6 @@ protected override void OnPointerReleased(PointerReleasedEventArgs e)
base.OnPointerReleased(e);
}

/// <inheritdoc/>
protected override void OnPointerMoved(PointerEventArgs e)
{
if (_titleBar != null && _titleBar.IsPointerOver && _mouseDown)
{
WindowState = WindowState.Normal;
BeginMoveDrag();
_mouseDown = false;
}
base.OnPointerMoved(e);
}

/// <inheritdoc/>
protected override void OnTemplateApplied(TemplateAppliedEventArgs e)
{
Expand Down

0 comments on commit 45164fc

Please sign in to comment.