If you add some Debug.WriteLines in BROperator.AlignNodeToMe: // Calculate the distance of the two points
double dx = targetPoint.X - pointToSnap.X;
double dy = targetPoint.Y - pointToSnap.Y;
// Move the dragged node to position
var childBounds = toAdd.Bounds;
Debug.WriteLine("1: " + childBounds);
childBounds.Offset(dx, dy);
toAdd.SetBounds(childBounds, true, true);
Debug.WriteLine("2: " + childBounds);
AssignNodeToSlot(toAdd, targetPoint);
they show that you align childBounds to a different position for the same initial rect: 1: 247.5,232.5,50,20 2: 231.5,192.5,50,20 1: 247.5,232.5,50,20 2: 263.5,262.5,50,20 1: 247.5,232.5,50,20 2: 231.5,192.5,50,20 1: 247.5,232.5,50,20 2: 263.5,262.5,50,20 The first Rect shows where the control wants to place the node due to standard move handling, the second one is where you want it aligned. So check all variables and fields you are using when calculating dx and dy, you might have to update some of them after each alignment. I hope that helps, Stoyan
|