Genogram.
How can I allow user dragging the whole diagram with holding spacebar even when they are clicking on a diagram node? I just want allow user dragging diagram easier when diagram have a lot of nodes.
The spacebar is like a regular key on the keyboard – when held down it will auto-repeat sending the “SPACE” character. It is not a modifier key like the Ctrl, Shirt, Alt, and Meta keys.
As described at GoJS Tools -- Northwoods Software, there are four predefined tools in the ToolManager.mouseMoveTools list:
- LinkingTool
- DraggingTool
- DragSelectingTool
- PanningTool
So if you were to ask about how to disable the DraggingTool to allow the PanningTool to operate when the user holds down the Shift key, rather than starting a drag of the selection:
$(go.Diagram, "myDiagramDiv",
{
"draggingTool.canStart": function() {
if (this.diagram.lastInput.shift) return false;
return go.DraggingTool.prototype.canStart.call(this);
}
});
This applies to all diagrams, not just Genogram, so I have changed this topic’s title.