imgui-node-editor icon indicating copy to clipboard operation
imgui-node-editor copied to clipboard

Selection and dragging broken when node ID set to 0

Open neverhood311 opened this issue 4 years ago • 1 comments

Following the pattern of the "Basic Interaction" example, I created a collection of nodes with unique IDs. I have a global nextNodeId variable which starts at 1 and is incremented any time a new node is created.

However, if I start the nextNodeId at 0, several weird things happen:

  • I'm unable to click-select the node with ID 0. The only way to select it is using a box selection.
  • Once I've box-selected the node with ID 0, I'm unable to click and drag the node around. I have to move it by selecting node 0 and another node, then clicking and dragging the other node to move both.
  • If I select any node, I cannot deselect them simply by clicking on the background. To deselect the nodes, I have to do a box selection on the background.
  • I cannot select links.
  • I cannot delete nodes using the Backspace key.

As soon as I start nextNodeId at 1, all of these problems go away. I'm not sure if this intended behavior, but I haven't seen it documented anywhere so I assume it's unwanted behavior.

neverhood311 avatar Dec 10 '19 21:12 neverhood311

This is intended. Zero is an invalid ID, you can think of it as null. Node editor use such id to represent lack od node. This also apply to other ID types.

Hope that helps.

thedmd avatar Dec 10 '19 22:12 thedmd