Exclude TextBlock from node selection

Hi,

My node is a go.Panel.Position that holds some shapes and a TextBlock:

vokoscreen-2021-09-23_16-22-03

As you can see, when I toggle the visibility of the TextBlock, the selection box changes. I would like to exclude the TextBlock from the node selection; is this possible?

Set Part.selectionObjectName.

I do have multiple parts in my node; how can I just exclude one part? Should I wrap the parts that I want in a panel and use that part name as the selectionObjectName?

Probably yes. It depends on the design that you want.

I continued with this and I now have the following behavior:

selection

So the selection object name is set to the red box but for selecting the node I still need to draw the selection rectangle around all the node visuals as illustrated in the image. What I would like the behavior to be is if I only put my pink selection window around the red box, that the node gets selected. It there another parameter I can play with?

Does the DragSelectingTool’s magenta box have to enclose that node’s red square?

If not, just set DragSelectingTool | GoJS API to true.

But if so, you’ll need to override DragSelectingTool.selectInRect to implement the behavior that you want.

Thanks, I have set isPartialInclusion to true and it looks right at first glance:

out

However, it looks like it is looking at the bounding boxes of the visuals instead of the actual visuals for selection. This is not really what I would expect. Is this expected? If so, I would have to go for a custom DragSelectingTool.selectInRect override I think.

https://gojs.net/extras/dragSelectingSelectionObject.html

That worked, thanks!