Question: How to stop a node being dragged AND stop the diagram being panned / dragged.
Scenario: You want the nodes on your diagram to be static and not movable with mouse or touch. You set movable-false on the node declaration but find that the diagram panning defeats your intentions. How to absolutely stop movement of nodes and diagram. And then how to stop the drag-selection rectangle appearing ?
Answer:
a. To fix the node on the diagram: Set the node movable option to false;
b. To fix the diagram and stop panning: Set the diagram option panningTool.isEnabled to false.
c. Next you will want to stop the dragSelectingTool when user click-drags. Set the diagram option dragSelectingTool to false.
myDiagram = $(go.Diagram
, 'theElementId', {
allowVerticalScroll: false
, autoScrollRegion: 0
, "panningTool.isEnabled": false
, 'dragSelectingTool.isEnabled': false
} )
Posted to help myself & others - it’s not explicit / obvious in documentation. Note to Northwoods - might be worth explaining this explicitly, the tools docs mention the isEnabled property but it is not clear how to set this at the diagram level. It is a very handy tip in some cases.