mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-20 11:44:59 +00:00
Merge branch 'develop' into feature/allowing_to_checkout_commit
This commit is contained in:
commit
db9ca5ba25
56 changed files with 822 additions and 283 deletions
|
@ -1,8 +1,12 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
using Avalonia;
|
||||
using Avalonia.Collections;
|
||||
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace SourceGit.ViewModels
|
||||
{
|
||||
public enum BranchTreeNodeType
|
||||
|
@ -13,8 +17,10 @@ namespace SourceGit.ViewModels
|
|||
Branch,
|
||||
}
|
||||
|
||||
public class BranchTreeNode
|
||||
public class BranchTreeNode : ObservableObject
|
||||
{
|
||||
public const double DEFAULT_CORNER = 4.0;
|
||||
|
||||
public string Name { get; set; }
|
||||
public BranchTreeNodeType Type { get; set; }
|
||||
public object Backend { get; set; }
|
||||
|
@ -57,6 +63,43 @@ namespace SourceGit.ViewModels
|
|||
get => IsBranch && (Backend as Models.Branch).IsCurrent;
|
||||
}
|
||||
|
||||
public bool IsSelected
|
||||
{
|
||||
get => _isSelected;
|
||||
set => SetProperty(ref _isSelected, value);
|
||||
}
|
||||
|
||||
public CornerRadius CornerRadius
|
||||
{
|
||||
get => _cornerRadius;
|
||||
set => SetProperty(ref _cornerRadius, value);
|
||||
}
|
||||
|
||||
public void UpdateCornerRadius(ref BranchTreeNode prev)
|
||||
{
|
||||
if (_isSelected && prev != null && prev.IsSelected)
|
||||
{
|
||||
var prevTop = prev.CornerRadius.TopLeft;
|
||||
prev.CornerRadius = new CornerRadius(prevTop, 0);
|
||||
CornerRadius = new CornerRadius(0, DEFAULT_CORNER);
|
||||
}
|
||||
else if (CornerRadius.TopLeft != DEFAULT_CORNER ||
|
||||
CornerRadius.BottomLeft != DEFAULT_CORNER)
|
||||
{
|
||||
CornerRadius = new CornerRadius(DEFAULT_CORNER);
|
||||
}
|
||||
|
||||
prev = this;
|
||||
|
||||
if (!IsBranch && IsExpanded)
|
||||
{
|
||||
foreach (var child in Children)
|
||||
child.UpdateCornerRadius(ref prev);
|
||||
}
|
||||
}
|
||||
private bool _isSelected = false;
|
||||
private CornerRadius _cornerRadius = new CornerRadius(DEFAULT_CORNER);
|
||||
|
||||
public class Builder
|
||||
{
|
||||
public List<BranchTreeNode> Locals => _locals;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue