Disable grid snapping for certain nodes

Hi,
we have a diagram with isGridSnapEnabled = true.
Is it possible to disable the snapping for a certain category of nodes but keep it for all other nodes?

Can I just change the isGridSnapEnabled in the SelectionChanged event or what would be the suggested way?

And what do you want to do when the user selects one or more of each category?

I suggest that you set Part.dragComputation Part | GoJS API on that Node template to just return the newLoc point.

Good point. I would say if at least one of the selected elements should snap then all elements should snap to the grid. Or alternatively all elements behave as if they where independendly moved. I think I need to try it to get a feeling on how to do it.

The Part.dragComputation looks good, I’ll have a look, thanks!

Part.dragComputation of course only affects the individual Node. This is how to implement your second scenario – independent movements.

If you want to decide what to do based on what is selected, you may need to override DraggingTool.doActivate to call the super method and then set DraggingTool.isGridSnapEnabled appropriately depending on the DraggingTool.draggedParts.