mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-23 02:12:25 +08:00
ux: reset scroll offset after viewing commit changed
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
@@ -5,7 +5,9 @@ using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Avalonia;
|
||||
using Avalonia.Threading;
|
||||
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace SourceGit.ViewModels
|
||||
@@ -157,6 +159,12 @@ namespace SourceGit.ViewModels
|
||||
private set => SetProperty(ref _canOpenRevisionFileWithDefaultEditor, value);
|
||||
}
|
||||
|
||||
public Vector ScrollOffset
|
||||
{
|
||||
get => _scrollOffset;
|
||||
set => SetProperty(ref _scrollOffset, value);
|
||||
}
|
||||
|
||||
public CommitDetail(Repository repo, CommitDetailSharedData sharedData)
|
||||
{
|
||||
_repo = repo;
|
||||
@@ -355,6 +363,7 @@ namespace SourceGit.ViewModels
|
||||
Children = null;
|
||||
RevisionFileSearchFilter = string.Empty;
|
||||
RevisionFileSearchSuggestion = null;
|
||||
ScrollOffset = Vector.Zero;
|
||||
|
||||
if (_commit == null)
|
||||
return;
|
||||
@@ -640,5 +649,6 @@ namespace SourceGit.ViewModels
|
||||
private string _revisionFileSearchFilter = string.Empty;
|
||||
private List<string> _revisionFileSearchSuggestion = null;
|
||||
private bool _canOpenRevisionFileWithDefaultEditor = false;
|
||||
private Vector _scrollOffset = Vector.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<TextBlock Classes="tab_header" Text="{DynamicResource Text.CommitDetail.Info}"/>
|
||||
</TabItem.Header>
|
||||
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
|
||||
<ScrollViewer Offset="{Binding ScrollOffset, Mode=TwoWay}" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<!-- Base Information -->
|
||||
<v:CommitBaseInfo Content="{Binding Commit}"
|
||||
|
||||
Reference in New Issue
Block a user