public override AdjustPositionResult AdjustPositionByDelta(Figure figure, float dx, float dy, AdjustPositionResult adjustmentResult) { var bb = figure.GetBoundingBoxIncludeLinked(); bb.X += dx; bb.Y += dy; if (Region.Contains(bb)) { return(adjustmentResult); } if (bb.Top > Region.Top) { adjustmentResult.Dy = 0; adjustmentResult.LockDy(); } if (bb.Left < Region.Left) { adjustmentResult.Dx = 0; adjustmentResult.LockDx(); } if (bb.Right > Region.Right) { adjustmentResult.Dx = 0; adjustmentResult.LockDx(); } if (bb.Bottom < Region.Bottom) { adjustmentResult.Dy = 0; adjustmentResult.LockDy(); } return(adjustmentResult); }
public override AdjustPositionResult AdjustPositionByDelta(Figure figure, float dx, float dy, AdjustPositionResult adjustmentResult) { switch (Direction) { case DragDropDirections.All: adjustmentResult.Dx = dx; adjustmentResult.Dy = dy; break; case DragDropDirections.Horizontal: adjustmentResult.Dx = dx; adjustmentResult.Dy = 0; adjustmentResult.LockDy(); break; case DragDropDirections.Vertical: adjustmentResult.Dx = 0; adjustmentResult.Dy = dy; adjustmentResult.LockDx(); break; default: throw new ArgumentOutOfRangeException(); } return(adjustmentResult); }