Node can't be reselected
pavelreiter opened this issue · 4 comments
Describe the bug
Node can't be selected again if it was selected and then unselected.
Issue appears to be here
The previously selected node is always set as unselected even if the newly selected node is the same.
I propose following change:
if (currentNode == currentSelectedNode) {
currentSelectedNode.setSelected(!currentSelectedNode.isSelected());
} else {
if (currentSelectedNode != null) currentSelectedNode.setSelected(false);
currentSelectedNode = currentNode;
}
To Reproduce
Steps to reproduce the behavior:
- Create tree with at least one node
- Click on the same node 3 times
- The node state is unselected
Expected behavior
If user is clicking on the same node it's state should switch between selected/unselected
Screenshots
N/A
Smartphone (please complete the following information):
- Device: API 28 Emulator
Additional context
Workaround for this issue is to click on different node, thus breaking the loop which is keeping the node in unset state.
Hello @pavelreiter,
Thank you for the report and suggestion I checked your solution and worked well, if you like you can make a PR with this solution if you want to work on it, if not I will add it and make a hot fix release
Thank you,
Amr Hesham
Thank you @pavelreiter again, i commit the solution and will make hot fix release today
It is released now in version 1.1.3