Exclude certain nodes from multiselection

I have a certain category of nodes that are related to a parent group. I want these types of nodes to be able to be individually selected (so they can be moved and resized), but not they should never be able to be included in a multiselection situation.

Presumably I’d have to extend the selection tool to make this happen, but was wondering if there was an easier way?


Let’s call an instance of such a node “A” and a regularly-selected node “B”.

So starting from nothing selected the user can select “B” and then cannot select “A” (using control or shift click or anything else).

And if the user selects “A” first, they cannot select “B” next?

Your example is correct and proposed solution would probably work for the click-to-select situations.

For drag selecting, presumably I would need to have the tool reject any potential “A” node selections if there are more than 1 items in the selection area?

After further thought, never mind what I suggested. I’ll edit that response.

Another strategy that you could try is that whenever a node is selected, in the Part | GoJS API event handler you could set Part.selectable to false on all of the nodes that are like “A”. This would allow multiple selection of nodes of type “B”.

Whenever the event handler notes that Diagram.selection.count is zero, you can make all of those “A”-like node selectable again. This would allow a single node of type “A” to be selected.

Interesting, I’ll have to try it out and see if it gives the behavior that I want. Thanks!