Links sometimes linking nodes just by clicking

Hi Walter,

I'm having an issue with the linking in that if two nodes are close enough together and I just click on a node, it automatically is drawing a link to another node. I suspect the linking is a bit sensitive. Is there a way to turn down the sensitivity?
The following are set in my node:
go:Node.LinkableFrom="True" go:Node.LinkableTo="True"

I’m pretty sure you are not just clicking on the node’s port, but are also moving the mouse enough for it to allow the Diagram.LinkingTool to run. Or is it the case that you are sure that the mouse is not moving while the left button is down?

If I’m right about my assumption, then one thing you could do is customize LinkingTool.IsBeyondDragSize() to require a bigger movement before LinkingTool.CanStart() can return true.

Here’s the definition of IsBeyondDragSize. You’ll need to change it in your own CustomLinkingTool and then replace the Diagram.LinkingTool.

[code]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 / 2 || Math.Abs(last.Y - first.Y) > SystemParameters.MinimumVerticalDragDistance / 2); }[/code]

Is there a way to call DiagramPanel.IsBeyondDragSize. It appears to be internal? or if not is there a way to mimic this method?

(I'm going to guess at it being something like this?
public static bool IsBeyondDragSize(DiagramPanel panel, Point a, Point b) { if (Math.Abs(b.X - a.X) <= 2) { return (Math.Abs(b.Y - a.Y) > 2); } return true; } }

Sorry, I didn’t have time before to clean up that code. I have edited it so that it doesn’t use that internal method.

I don’t think this is the problem. I think the problem is that if I drag the blue arrow out from a node, it tries to find other nodes to connect to. Is there away to turn this behavior off? Ideally, it would be better to allow an option for the user to drag all the way to the node they need to connect to otherwise it seems like they get spurious connections.

Here is a picture of what I mean. The mouse is in the area marked in red, but the link tries to connect well outside of where its dragged to the shape. sometimes the user doesn’t need to do much to cause a connection to occur. It would be great if there was a way to tell the node at which point it could accept a connection from the mouse within a distance.

Here is the diagram:

Ah, OK, now I understand what you are talking about. Just set the LinkingTool.PortGravity to a smaller value.