mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-26 12:55:00 +00:00
feat: repository tab add the ability to close repository tabs using the middle mouse button
This commit is contained in:
parent
a74851de4a
commit
27fd5829f5
1 changed files with 27 additions and 3 deletions
|
@ -237,14 +237,37 @@ namespace SourceGit.Views
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnPointerPressedTab(object sender, PointerPressedEventArgs e)
|
private void OnPointerPressedTab(object sender, PointerPressedEventArgs e)
|
||||||
|
{
|
||||||
|
var point = e.GetCurrentPoint(this);
|
||||||
|
if (point.Properties.IsMiddleButtonPressed)
|
||||||
|
{
|
||||||
|
_middleButtonPressed = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
_pressedTab = true;
|
_pressedTab = true;
|
||||||
_startDrag = false;
|
_startDrag = false;
|
||||||
_pressedTabPosition = e.GetPosition(sender as Border);
|
_pressedTabPosition = e.GetPosition(sender as Border);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void OnPointerReleasedTab(object sender, PointerReleasedEventArgs e)
|
private void OnPointerReleasedTab(object sender, PointerReleasedEventArgs e)
|
||||||
{
|
{
|
||||||
|
if (_middleButtonPressed)
|
||||||
|
{
|
||||||
|
if (sender is Border border)
|
||||||
|
{
|
||||||
|
var point = e.GetPosition(border);
|
||||||
|
if (border.Bounds.Contains(point))
|
||||||
|
{
|
||||||
|
if (DataContext is ViewModels.Launcher vm)
|
||||||
|
{
|
||||||
|
vm.CloseTab(border.DataContext as ViewModels.LauncherPage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_middleButtonPressed = false;
|
||||||
|
}
|
||||||
_pressedTab = false;
|
_pressedTab = false;
|
||||||
_startDrag = false;
|
_startDrag = false;
|
||||||
}
|
}
|
||||||
|
@ -337,5 +360,6 @@ namespace SourceGit.Views
|
||||||
private bool _pressedTab = false;
|
private bool _pressedTab = false;
|
||||||
private Point _pressedTabPosition = new Point();
|
private Point _pressedTabPosition = new Point();
|
||||||
private bool _startDrag = false;
|
private bool _startDrag = false;
|
||||||
|
private bool _middleButtonPressed = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue