Hi Stoyan,
During the re-factoring of our project we found out that the snap logic sometimes isn't working as we would like it to work.
To get the node to snap to the nearest connection point we use the MindFusion method GetNearestNode, which will - at least, i presume - look up the nearest node in correspondence to the node that's being dragged. However, sometimes it will snap to a snap-point on a node that is visually not the nearest node.
According to this, a few questions come to mind:
1) The first question is, does the nearest node get calculated from the bounds of the node that is being dragged, or is it calculated from the cursor position?
2) The second question is, does it have anything to do with an error in the way we calculate our snap-points?
3) Our third question is, if the above questions are not relevant, might it be possible to prioritize certain nodes when calling the GetNearestNode method? Or if this is not possible, or the right problem, could you give us a hint as to where to fine tune this?
protected void AlignToNearestPoint(Point current, InteractionState ist)
{
if (ist.AdjustmentHandle == 8) // If the node is moved
{
BRNode nearbyNode;
switch (SnapType)
{
case SnapTypes.Free: nearbyNode = (BRNode)Parent.GetNearestNode(current, 25, this); break;
case SnapTypes.SnapInstantly: nearbyNode = GetParentDiagramElement().GetLastAddedBRNode(); break;
default: nearbyNode = (BRNode)Parent.GetNearestNode(current, 25, this); break;
}
if (nearbyNode != null)
{
if (!(nearbyNode is BRIfNode))
nearbyNode.SendAlignRequestToController((int)this.Tag);
}
}
}
Thanks in advance

.
Greets,
Sander