mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 20:24:59 +00:00
fix: begin drag was triggered when double click on the title bar
This commit is contained in:
parent
b77ed6520c
commit
762ec1f702
8 changed files with 119 additions and 16 deletions
|
@ -1,3 +1,4 @@
|
|||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
|
||||
|
@ -22,7 +23,29 @@ namespace SourceGit.Views
|
|||
|
||||
private void BeginMoveWindow(object sender, PointerPressedEventArgs e)
|
||||
{
|
||||
BeginMoveDrag(e);
|
||||
if (e.ClickCount != 2)
|
||||
_pressedTitleBar = true;
|
||||
}
|
||||
|
||||
private void MoveWindow(object sender, PointerEventArgs e)
|
||||
{
|
||||
if (!_pressedTitleBar)
|
||||
return;
|
||||
|
||||
var visual = (Visual)e.Source;
|
||||
BeginMoveDrag(new PointerPressedEventArgs(
|
||||
e.Source,
|
||||
e.Pointer,
|
||||
visual,
|
||||
e.GetPosition(visual),
|
||||
e.Timestamp,
|
||||
new PointerPointProperties(RawInputModifiers.None, PointerUpdateKind.LeftButtonPressed),
|
||||
e.KeyModifiers));
|
||||
}
|
||||
|
||||
private void EndMoveWindow(object sender, PointerReleasedEventArgs e)
|
||||
{
|
||||
_pressedTitleBar = false;
|
||||
}
|
||||
|
||||
private void OnChangeContextRequested(object sender, ContextRequestedEventArgs e)
|
||||
|
@ -43,5 +66,7 @@ namespace SourceGit.Views
|
|||
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private bool _pressedTitleBar = false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue