public virtual void OnDrag(Canvas canvas, float dxSum, float dySum, float dx, float dy, bool isShiftKey, bool isCtrlKey) { if (HittedResizeHandle != null) { HittedResizeHandle.OnDrag(canvas, dxSum, dySum, dx, dy, isShiftKey, isCtrlKey); } else { var isSnapped = false; Point delta = null; foreach (var policy in canvas.GetSnapPolicies()) { Point snapPoint; isSnapped = policy.Snap(canvas, Position, dx, dy, dxSum, dySum, out snapPoint, out delta, new[] { this }); if (isSnapped) { break; } } if (isSnapped) { Translate(delta.X, delta.Y); } else { Translate(dx, dy); } } }