How to segment tools based on key modifiers

I’m looking at the DragZooming sample and see that it overrides the DragSelecting Tool.

However, I want both tools to be available. DragSelecting should be started after a long press and drag, but DragZooming should be started after a long press and drag while holding Control.

What is the suggested way to manage this?

Thanks!

Just modify the DragZoomingTool.canStart method to only return true if the control key is held down:

DragZoomingTool.prototype.canStart = function() {
  . . .
  // require left button & control button & that it has moved far enough away from the mouse down point, so it isn't a click
  if (!e.left || !e.control) return false;
  . . .

Or if you don’t want to modify extensions/DragZooming.js, override the method just in your app.

Perfect, thanks!