Panning diagram with right click

Hi,

Just wondering if there is way to pan the diagram with right click down?

I have a working version with left click mouse down, but for some reason, we want to use right click to drag the whole diagram. Anyone has done this before? Any tips?

Thanks!
K.

OK. I answer it myself.

I just overrider the panningTool.canStart method like this

diagram.toolManager.panningTool.canStart = function () {
if(!this.isEnabled)
return !1;
var a=this.g;
return null===a||!a.ye&&!a.ze||!a.U.right||a.gb!==this&&!this.isBeyondDragSize()?!1:!0;
};

then all good!

That’s right. Here is how PanningTool.canStart is defined:

PanningTool.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 left button & that it has moved far enough away from the mouse down point, so it isn't a click
  if (!diagram.lastInput.left) 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;
};

You should update your override so that it does not refer to any compiler-minified properties. Those minified property names are not supported and will change with each baselevel release of the GoJS library.