From 6643c9035f6b8d3cc62c0b25f6df31acce0a48a8 Mon Sep 17 00:00:00 2001 From: dingyi Date: Thu, 28 Nov 2024 22:47:57 +0800 Subject: [PATCH] feat: deselect all nodes when switching to single or none selection mode This change ensures that when the selection mode of the TreeView is changed to single or none, all previously selected nodes are deselected. This provides a consistent and predictable behavior for these selection modes. --- .../kotlin/io/github/dingyi222666/view/treeview/TreeView.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/treeview/src/main/kotlin/io/github/dingyi222666/view/treeview/TreeView.kt b/treeview/src/main/kotlin/io/github/dingyi222666/view/treeview/TreeView.kt index 474a559..6e70a6e 100644 --- a/treeview/src/main/kotlin/io/github/dingyi222666/view/treeview/TreeView.kt +++ b/treeview/src/main/kotlin/io/github/dingyi222666/view/treeview/TreeView.kt @@ -501,7 +501,7 @@ class TreeView(context: Context, attrs: AttributeSet?, defStyleAttr: In return } coroutineScope.launch { - if (old !== SelectionMode.NONE) { + if (new == SelectionMode.SINGLE || new == SelectionMode.NONE) { tree.selectAllNode(false) } refresh(true)