Just curious as to whether multiselect via mouse click is a feature in RadialLayout? I have no animations enabled and my function called nodeClicked()
just logs name of the nodes currently. I have tried pressing CTRL with clicks in order to log the names of the clicked nodes but I see only the name of the clicked node. What API should I look into for Multiselect?
When you control-click or shift-click or drag-box-select, the user will select multiple nodes. However that sample does not have the nodes show that they are selected, because the template sets selectionAdorned: false
and does not implement any visual changes when Part.isSelected changes.
To prove this, comment out the line:
myDiagram.nodeTemplate =
$(go.Node, "Spot",
{
locationSpot: go.Spot.Center,
locationObjectName: "SHAPE", // Node.location is the center of the Shape
//selectionAdorned: false,
click: nodeClicked,
. . .
and you will see that the user can indeed select more than one node at a time. However you might not see some of the selected nodes because they were made not visible by the sample app.
As a continuation to the Multiselect Query. Is there any API Method which can be logged to check if two or nodes of the layout are multiselected. I understand adornments give a visual understanding. Is there some function like isMultiSelected
or some call that collects the node attributes and does some function?
I guess you can use Diagram.selection.count to see see how many items are currently selected. There is a ChangedSelection event if you need to react to user selections.
so I have the function:
nodeClicked(e: go.InputEvent, node: go.GraphObject) {
let rootNode = node.findTreeRoot().data.text; // show name of root node
let leafNode = node.data.text; // name of leaf node
// Don't need to count the selections rather
// get Names of the node..
// ChangedSelection ? {call an HTTP GET API call}
}
how should I use the e: go.InputEvent
along with ChangedSelection
?
Why then did you ask “Is there some function like isMultiSelected
”?
Diagram.selection is a Set | GoJS API of Parts, so you can iterate over it or whatever you need.
GoJS Selection -- Northwoods Software
GoJS Collections -- Northwoods Software