code_review: PR #190

* check middle button click before other action
* pass clicked tab instead of null to avoid closing current active page while clicking on other invalid tab
This commit is contained in:
leo 2024-06-20 09:25:56 +08:00
parent f3e54369ad
commit 7241879f5a
No known key found for this signature in database

View file

@ -258,17 +258,19 @@ namespace SourceGit.Views
private void OnPointerPressedTab(object sender, PointerPressedEventArgs e)
{
_pressedTab = true;
_startDragTab = false;
_pressedTabPosition = e.GetPosition(sender as Border);
_pressedPoint = e.GetCurrentPoint(sender as Border);
if (_pressedPoint.Properties.IsMiddleButtonPressed)
var border = sender as Border;
var point = e.GetCurrentPoint(border);
if (point.Properties.IsMiddleButtonPressed)
{
var vm = DataContext as ViewModels.Launcher;
vm.CloseTab(null);
vm.CloseTab(border.DataContext as ViewModels.LauncherPage);
e.Handled = true;
return;
}
_pressedTab = true;
_startDragTab = false;
_pressedTabPosition = e.GetPosition(sender as Border);
}
private void OnPointerReleasedTab(object sender, PointerReleasedEventArgs e)
@ -339,6 +341,5 @@ namespace SourceGit.Views
private bool _pressedTab = false;
private Point _pressedTabPosition = new Point();
private bool _startDragTab = false;
private PointerPoint _pressedPoint = new PointerPoint();
}
}