Skip to content

Commit

Permalink
Merge pull request #3 from C0d3W1thW1ngs/master
Browse files Browse the repository at this point in the history
Master
  • Loading branch information
radiatoryang committed Mar 27, 2019
2 parents 40fdb53 + 89466e7 commit 56bfa8b
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions Assets/Bobbin/Editor/TreeModel/BobbinTreeView.cs
Expand Up @@ -55,23 +55,19 @@ public static void TreeToList(TreeViewItem root, IList<TreeViewItem> result)
if (root.children == null)
return;

Stack<TreeViewItem> stack = new Stack<TreeViewItem>();
for (int i = root.children.Count - 1; i >= 0; i--)
stack.Push(root.children[i]);
Stack<TreeViewItem> stack = new Stack<TreeViewItem>(root.children);

while (stack.Count > 0)
{
TreeViewItem current = stack.Pop();
result.Add(current);

if (current.hasChildren && current.children[0] != null)
{
for (int i = current.children.Count - 1; i >= 0; i--)
{
stack.Push(current.children[i]);
}
foreach(TreeViewItem t in current.children)
stack.Push(t);
}
}
return;
}

public BobbinTreeView(TreeViewState state, MultiColumnHeader multicolumnHeader, TreeModel<BobbinPath> model) : base(state, multicolumnHeader, model)
Expand Down

0 comments on commit 56bfa8b

Please sign in to comment.