Invisible part of the template breaks snapToGrid durring node is being dragged

Hi
I’ve added an extra space in outer panel to display an Icon “on the edge” of the node.
image

And after that when node is being dragged its visualy not snapped to the grid.
2022-06-22_18-55-39

After node is being moved I can adjust position of the node by handling it in “SelectionMoved” diagram event.
But I’m failing to find what I need to override or where I need to handle same offset during the drag.

I tried draggingTool.moveParts, draggingTool.computeMove but it seems like its not a correct places.
Any ideas?

Thanks
Vlad.

Yes, the node is being snapped to the grid – if you temporarily set the background of the Node to “lime”, you’ll see it, because with the icon the node is taller.

What I think you want to do is assign the body in your node (i.e. what I assume is an “Auto” Panel with a “RoundedRectangle” Shape) a name. Let’s name it “BODY”. Then set Node.locationObjectName to “BODY”.

The DraggingTool snaps each node’s location to the grid, not each node’s position.
https://gojs.net/latest/intro/nodes.html#PositionAndLocation

Thats exactly what I needed, thanks! That way I don’t need to add any extra handlers anywhere else, perfect.