Skip to content

Commit

Permalink
feat: Add expandTree() and collapseTree() methods to TreeState
Browse files Browse the repository at this point in the history
  • Loading branch information
fscarponi committed Oct 30, 2023
1 parent 120bca5 commit 776d751
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,14 @@ class TreeState(
fun openNodes(nodes: List<Any>) {
openNodes += nodes
}

fun expandTree() {
if (allNodes.size != openNodes.size) {
openNodes = allNodes.toSet()
}
}

fun collapseTree() {
if (openNodes.isNotEmpty()) openNodes = setOf()
}
}

0 comments on commit 776d751

Please sign in to comment.