Is it possible to move an object / node by ‘x cm (e.g 1cm)’ while dragging
You can enable grid snapping during dragging by setting DraggingTool | GoJS API to true:
$(go.Diagram, "myDiagramDiv",
{ "draggingTool.isGridSnapEnabled": true,
"draggingTool.gridSnapCellSize": new go.Size(..., ...),
. . .
where you use Size values that correspond to the desired distance in your coordinate system.
Read more at GoJS Grid Patterns -- Northwoods Software.
Hi walter ,
it did not work for me. I am currently using floor planner example.
Can you please be more specific about what behavior you want? I was just guessing that you wanted dragging to snap to a grid. The Floor Planner project already has grid snapping enabled. Floor Planner
Ah, I think you need to change the dragWallParts
function to operate on gridPt
instead of on pt
.
Hmmm, that might not be exactly what you want, since if the window was not aligned on the grid to begin with, then you won’t get the snapping distance that you want. If that’s the case, you’ll need to change that function not to depend on gridPt
but to instead change the return point to match your requirements.
Thanks Walter.