- If you set
myDiagram.toolManager.dragSelectingTool.delay = 0;
I think that will cause all background drags to start the DragSelectingTool instead of allowing the PanningTool to run.
To get the PanningTool to start on a right mouse button event, you will need to override PanningTool.canStart method. I haven’t tried this, but it ought to look something like:
[code]function CustomPanningTool() {
go.PanningTool.call(this);
}
go.Diagram.inherit(CustomPanningTool, go.PanningTool);
CustomPanningTool.prototype.canStart = function() {
if (!this.isEnabled) return false;
var diagram = this.diagram;
if (diagram === null) return false;
if (!diagram.allowHorizontalScroll && !diagram.allowVerticalScroll) return false;
// require right button & that it has moved far enough away from the mouse down point, so it isn’t a click
// CHANGED to check InputEvent.right INSTEAD OF InputEvent.left
if (!diagram.lastInput.right) return false;
// don’t include the following check when this tool is running modally
if (diagram.currentTool !== this) {
// mouse needs to have moved from the mouse-down point
if (!this.isBeyondDragSize()) return false;
}
return true;
};[/code]
Then install the new tool by:
myDiagram.toolManager.panningTool = new CustomPanningTool();
-
I don’t know what events, if any, that DOM elements will get. It probably depends on the hardware and on the browser. If it’s at all possible, you can implement it yourself, resulting in changes to Diagram.position.
-
I’m not sure about this. You’ll need to override LinkingTool.doMouseUp. (Define your CustomLinkingTool just like the CustomPanningTool, above.) Then do something like:
CustomLinkingTool.prototype.doMouseUp = function() {
if (this.isActive && this.findTargetPort(this.isForwards) === null) {
... do what you want on failure to link ...
} else {
go.LinkingTool.prototype.doMouseUp.call(this);
}
};