Skip to content

Node can't be reselected #8

@pavelreiter

Description

@pavelreiter

Describe the bug
Node can't be selected again if it was selected and then unselected.
Issue appears to be here

if (currentSelectedNode != null) currentSelectedNode.setSelected(false);

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:

  1. Create tree with at least one node
  2. Click on the same node 3 times
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions