fix: sync scroll not working

This commit is contained in:
leo 2024-06-05 19:56:45 +08:00
parent 1d7518a327
commit ce35a0365d
No known key found for this signature in database
GPG key ID: B528468E49CD0E58

View file

@ -5,6 +5,8 @@ using System.Text.RegularExpressions;
using Avalonia; using Avalonia;
using Avalonia.Media.Imaging; using Avalonia.Media.Imaging;
using CommunityToolkit.Mvvm.ComponentModel;
namespace SourceGit.Models namespace SourceGit.Models
{ {
public enum TextDiffLineType public enum TextDiffLineType
@ -59,12 +61,17 @@ namespace SourceGit.Models
} }
} }
public partial class TextDiff public partial class TextDiff : ObservableObject
{ {
public string File { get; set; } = string.Empty; public string File { get; set; } = string.Empty;
public List<TextDiffLine> Lines { get; set; } = new List<TextDiffLine>(); public List<TextDiffLine> Lines { get; set; } = new List<TextDiffLine>();
public int MaxLineNumber = 0; public int MaxLineNumber = 0;
public Vector SyncScrollOffset { get; set; } = Vector.Zero;
private Vector _syncScrollOffset = Vector.Zero;
public Vector SyncScrollOffset {
get => _syncScrollOffset;
set => SetProperty(ref _syncScrollOffset, value);
}
public void GenerateNewPatchFromSelection(Change change, string fileBlobGuid, TextDiffSelection selection, bool revert, string output) public void GenerateNewPatchFromSelection(Change change, string fileBlobGuid, TextDiffSelection selection, bool revert, string output)
{ {