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;
|
worktreeList.Height = desiredHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
var desiredLocalBranchHeight = GetTreeRowsCount(vm.LocalBranchTrees) * 24;
|
if (vm.IsLocalBranchGroupExpanded)
|
||||||
var desiredRemoteHeight = GetTreeRowsCount(vm.RemoteBranchTrees) * 24;
|
|
||||||
|
|
||||||
if (!vm.IsRemoteGroupExpanded)
|
|
||||||
{
|
{
|
||||||
if (vm.IsLocalBranchGroupExpanded)
|
var localBranchMax = vm.IsRemoteGroupExpanded ? leftHeight * 0.5 : leftHeight;
|
||||||
{
|
var desiredHeight = GetTreeRowsCount(vm.LocalBranchTrees) * 24;
|
||||||
var localBranchHeight = Math.Min(leftHeight, desiredLocalBranchHeight);
|
var localBranchHeight = Math.Min(localBranchMax, desiredHeight);
|
||||||
|
if (!localBranchTree.Height.IsClose(localBranchHeight))
|
||||||
localBranchTree.Height = localBranchHeight;
|
localBranchTree.Height = localBranchHeight;
|
||||||
}
|
leftHeight -= localBranchHeight;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (vm.IsRemoteGroupExpanded)
|
||||||
{
|
{
|
||||||
if (vm.IsLocalBranchGroupExpanded)
|
var desiredHeight = GetTreeRowsCount(vm.RemoteBranchTrees) * 24;
|
||||||
{
|
var remoteHeight = Math.Min(leftHeight, desiredHeight);
|
||||||
var localBranchHeight = Math.Min(leftHeight * 0.5, desiredLocalBranchHeight);
|
|
||||||
if (!localBranchTree.Height.IsClose(localBranchHeight))
|
|
||||||
localBranchTree.Height = localBranchHeight;
|
|
||||||
|
|
||||||
leftHeight -= localBranchHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
var remoteHeight = Math.Min(leftHeight, desiredRemoteHeight);
|
|
||||||
if (!remoteBranchTree.Height.IsClose(remoteHeight))
|
if (!remoteBranchTree.Height.IsClose(remoteHeight))
|
||||||
remoteBranchTree.Height = remoteHeight;
|
remoteBranchTree.Height = remoteHeight;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue