mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-23 13:14:59 +00:00
feature: show tooltip of parent commit when hover the parent SHA
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
1f158eeded
commit
6e4f971733
3 changed files with 52 additions and 1 deletions
|
@ -1,3 +1,5 @@
|
|||
using System.Threading.Tasks;
|
||||
|
||||
using Avalonia;
|
||||
using Avalonia.Collections;
|
||||
using Avalonia.Controls;
|
||||
|
@ -113,6 +115,29 @@ namespace SourceGit.Views
|
|||
e.Handled = true;
|
||||
}
|
||||
|
||||
private async void OnSHAPointerEntered(object sender, PointerEventArgs e)
|
||||
{
|
||||
if (DataContext is ViewModels.CommitDetail detail && sender is Control { DataContext: string sha } ctl)
|
||||
{
|
||||
var tooltip = ToolTip.GetTip(ctl);
|
||||
if (tooltip is Models.Commit commit && commit.SHA == sha)
|
||||
{
|
||||
ToolTip.SetIsOpen(ctl, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
var c = await Task.Run(() => detail.GetParent(sha));
|
||||
if (c != null)
|
||||
{
|
||||
ToolTip.SetTip(ctl, c);
|
||||
ToolTip.SetIsOpen(ctl, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void OnSHAPressed(object sender, PointerPressedEventArgs e)
|
||||
{
|
||||
if (DataContext is ViewModels.CommitDetail detail && sender is Control { DataContext: string sha })
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue