Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 7069

How to detect deselection of a Node in RadialLayout?

$
0
0

@shantanoo-desai wrote:

Hi,

I have the following nodeClicked(ev: go.InputEvent, node: go.GraphObject) for the RadialLayout.

  • it detects if the user pressed the CTRL button to enable multiselect and if not it will be a single click query

nodeClicked(ev: go.InputEvent, node: go.GraphObject) {
    if (ev.control) {// if the user pressed the control key
        console.log("multiselect activated");

        if(node.isSelected) { // if node is selected
             // push the name of the node in an Array....
             // make an API call and store some data in variable
        } else { // if node deselected whilst the ctrl key is still pressed
             // remove node from the array
             // reset variable for API to null
        }
    } else {
        // if the user does not press CTRL
        console.log("Multiselect off");
         if (node.isSelected) { // however a single selected node must perform something
           // push name in the array
           // make an API call for the same node name and store value in variable
         } else { /* HERE Is the tricky part*/
            // if node got deselected in non-multiselect mode
           // make the arry empty
         }
    }
}

Without CTRL I try clicking the node and the area around it and the Adornment goes away however the it never makes the array empty; which implies that the node is not deselected.

The logic works perfectly with I hold the CTRL and select the node again. If i understand correctly the default way to deselect a node in GoJS RadialLayout is via CTRL, or is it something to do with my logic?

Some Guidance would be appreciated

Posts: 4

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles