Hi there,
I want my Node to Drag only if they are 5 Pixels away from their original position, cause some users unlink them when double clicking cause of shaky hands.
Searching the forum leads my to override IsBeyondDragSize, but if I do so and try to drag the pan mouse cursor is showing up and no drag is happening.
Yes, and I removed the / 2 to achieve a greater distance.
protected override bool IsBeyondDragSize()
{
Diagram diagram = this.Diagram;
if (diagram == null) return false;
DiagramPanel panel = diagram.Panel;
if (panel == null) return false;
// Get all of the points in screen/view coordinates
Point first = panel.TransformModelToView(diagram.FirstMousePointInModel);
Point last = panel.TransformModelToView(diagram.LastMousePointInModel);
return (Math.Abs(last.X - first.X) > SystemParameters.MinimumHorizontalDragDistance ||
Math.Abs(last.Y - first.Y) > SystemParameters.MinimumVerticalDragDistance);
}
But instead of dragging the Panning-Cursor was shown.
I assume that is because the PanningTool is actually running? That’s odd, though, because that can only happen if the mouse-down is not over a Node or a Link (unless you customized that).
You could try overriding PanningTool.IsBeyondDragSize in the same manner. FYI, the DragSelectingTool is another tool whose CanStart method depends on IsBeyondDragSize.