mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-23 20:47:25 -08:00
refactor: rewrite the way to get local & remote branch tree height
This commit is contained in:
parent
8faa8c7378
commit
6553e27d36
1 changed files with 10 additions and 19 deletions
|
@ -404,29 +404,20 @@ namespace SourceGit.Views
|
|||
worktreeList.Height = desiredHeight;
|
||||
}
|
||||
|
||||
var desiredLocalBranchHeight = GetTreeRowsCount(vm.LocalBranchTrees) * 24;
|
||||
var desiredRemoteHeight = GetTreeRowsCount(vm.RemoteBranchTrees) * 24;
|
||||
|
||||
if (!vm.IsRemoteGroupExpanded)
|
||||
{
|
||||
if (vm.IsLocalBranchGroupExpanded)
|
||||
{
|
||||
var localBranchHeight = Math.Min(leftHeight, desiredLocalBranchHeight);
|
||||
localBranchTree.Height = localBranchHeight;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (vm.IsLocalBranchGroupExpanded)
|
||||
{
|
||||
var localBranchHeight = Math.Min(leftHeight * 0.5, desiredLocalBranchHeight);
|
||||
var localBranchMax = vm.IsRemoteGroupExpanded ? leftHeight * 0.5 : leftHeight;
|
||||
var desiredHeight = GetTreeRowsCount(vm.LocalBranchTrees) * 24;
|
||||
var localBranchHeight = Math.Min(localBranchMax, desiredHeight);
|
||||
if (!localBranchTree.Height.IsClose(localBranchHeight))
|
||||
localBranchTree.Height = localBranchHeight;
|
||||
|
||||
leftHeight -= localBranchHeight;
|
||||
}
|
||||
|
||||
var remoteHeight = Math.Min(leftHeight, desiredRemoteHeight);
|
||||
if (vm.IsRemoteGroupExpanded)
|
||||
{
|
||||
var desiredHeight = GetTreeRowsCount(vm.RemoteBranchTrees) * 24;
|
||||
var remoteHeight = Math.Min(leftHeight, desiredHeight);
|
||||
if (!remoteBranchTree.Height.IsClose(remoteHeight))
|
||||
remoteBranchTree.Height = remoteHeight;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue