Start DragSelectingTools over selected Node

Hi and a happy new year to all,
I have a node which is selectable but not movable. Is it possible to check this and start the DragSelectingTool if the user ckicks and hold the mouse over such a already selected node?

Yes, even if the Node has Node.CanMove() returning false, the DraggingTool will start if the user starts dragging the node if it is Selectable and Copyable (and Node.CanCopy() returns true) or if Diagram.AllowDragOut is true. Read about DraggingTool.CanStart. You can override the method if you would like to change its behavior.

But by default the DraggingTool is in the Diagram.MouseMoveTools list, so its CanStart predicate is called when a mouse-move event happens. I don’t know precisely what it is that you want.

I’ll try it.
So I make a CustomDragSelectingTool, override it’s CanStart() and make my tests there.

Here’s what it does by default:

    public override bool CanStart() {
      if (!base.CanStart()) return false;  // this just checks this.MouseEnabled

      Diagram diagram = this.Diagram;
      if (diagram == null) return false;
      if (diagram.IsReadOnly && !diagram.AllowDragOut) return false;
      if (!diagram.AllowMove && !diagram.AllowCopy && !diagram.AllowDragOut) return false;
      if (!diagram.AllowSelect) return false;

      // require left button & that it has moved far enough away from the mouse down point, so it isn't a click
      if (!IsLeftButtonDown()) return false;
      // don't include the following check when this tool is running modally
      if (diagram.CurrentTool != this) {
        if (!IsBeyondDragSize()) return false;
      }

      // need to be over a part that is movable or copyable
      Part part = FindDraggablePart();
      return (part != null);
    }

Or maybe you just want to customize the behavior of FindDraggablePart?

Thank you,
it’s working!