How to prevent diagram from moving when dragging

Hello,

When I drag, I want the node to be selected without the diagram moving.

I applied the code below but it does not work.

this.myDiagram.toolManager.draggingTool.isEnabled = false;
this.myDiagram.toolManager.dragSelectingTool.isEnabled = true;

How can I fix it?

Thanks,
Mun

I think you want to disable the PanningTool.

this.myDiagram.toolManager.panningTool.isEnabled = false;

Thank you. It works

And one more question,

Can I make only nodes selected when dragging with dragSelectingTool? (except linkā€¦)

Do you need to allow Links to be selected at all? If not, just set selectable to false on each Link template.

Otherwise it might be easiest to override DragSelectingTool.selectInRect to call the base method and then deselect all selected Links.

I tried to override DragSelectingTool.selectInRect as your advice.

var tool = this.myDiagram.toolManager.dragSelectingTool;
tool.selectInRect = function(){
	//call base method
	go.DragSelectingTool.prototype.selectInRect.call(tool);

	//TODO : deselect link

}

But I got a console error when dragged

Am I misusing it?

Yes, you are, because it takes one argument: DragSelectingTool | GoJS API

oh i missed it. Thank you