Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit 26c5b32

Browse files
Merge branch 'enhancements/tree-view-checked-state' into enhancements/changes-tree-view
2 parents 94a9729 + 2590be4 commit 26c5b32

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/UnityExtension/Assets/Editor/GitHub.Unity/UI/TreeControl.cs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -311,33 +311,37 @@ private void ToggleParentFoldersChecked(int idx, TreeNode node, bool isChecked)
311311

312312
for (var i = idx - 1; i > 0 && node.Level <= nodes[i].Level; i--)
313313
{
314-
if (node.Level < nodes[i].Level)
314+
var previousNode = nodes[i];
315+
if (node.Level < previousNode.Level)
315316
{
316317
continue;
317318
}
318319

319320
firstSiblingIndex = i;
320-
var siblingIsChecked = nodes[i].CheckState == CheckState.Checked;
321321

322-
if (isChecked != siblingIsChecked)
322+
if (siblingsInSameState)
323323
{
324-
siblingsInSameState = false;
325-
break;
324+
var previousNodeIsChecked = previousNode.CheckState == CheckState.Checked;
325+
326+
if (isChecked != previousNodeIsChecked)
327+
{
328+
siblingsInSameState = false;
329+
}
326330
}
327331
}
328332

329333
if (siblingsInSameState)
330334
{
331335
for (var i = idx + 1; i < nodes.Count && node.Level <= nodes[i].Level; i++)
332336
{
333-
if (node.Level < nodes[i].Level)
337+
var followingNode = nodes[i];
338+
if (node.Level < followingNode.Level)
334339
{
335340
continue;
336341
}
337342

338-
var siblingIsChecked = nodes[i].CheckState == CheckState.Checked;
339-
340-
if (isChecked != siblingIsChecked)
343+
var followingNodeIsChecked = followingNode.CheckState == CheckState.Checked;
344+
if (isChecked != followingNodeIsChecked)
341345
{
342346
siblingsInSameState = false;
343347
break;

0 commit comments

Comments
 (0)