mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-21 18:35:00 +00:00
feature: double tap specific branch (#1416)
* feature: double tap specific branch * exactly match behavior of left sidebar
This commit is contained in:
parent
cadcf40d74
commit
88fd8f32f1
3 changed files with 61 additions and 2 deletions
|
@ -156,6 +156,22 @@ namespace SourceGit.Views
|
|||
InvalidateMeasure();
|
||||
}
|
||||
|
||||
public Models.Decorator DecoratorAt(Point point)
|
||||
{
|
||||
if (DataContext is not Models.Commit commit)
|
||||
return null;
|
||||
|
||||
var x = 0.0;
|
||||
for (var i = 0; i < _items.Count; i++)
|
||||
{
|
||||
x += _items[i].Width + 4;
|
||||
if (point.X < x)
|
||||
return commit.Decorators[i];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected override Size MeasureOverride(Size availableSize)
|
||||
{
|
||||
_items.Clear();
|
||||
|
|
|
@ -173,10 +173,14 @@ namespace SourceGit.Views
|
|||
{
|
||||
if (DataContext is ViewModels.Histories histories && sender is ListBox { SelectedItems.Count: 1 })
|
||||
{
|
||||
Models.Decorator decorator = null;
|
||||
if (e.Source is CommitRefsPresenter crp)
|
||||
decorator = crp.DecoratorAt(e.GetPosition(crp));
|
||||
|
||||
var source = e.Source as Control;
|
||||
var item = source.FindAncestorOfType<ListBoxItem>();
|
||||
if (item is { DataContext: Models.Commit commit })
|
||||
histories.DoubleTapped(commit);
|
||||
histories.DoubleTapped(commit, decorator);
|
||||
}
|
||||
e.Handled = true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue