private static void SnapMouseCanvasPoints(ShapeSnappingOption snappingOption, PointDouble startPoint, PointDouble endPoint, out PointDouble snappedStartPoint, out PointDouble snappedEndPoint) { switch (snappingOption) { case ShapeSnappingOption.None: snappedStartPoint = startPoint; snappedEndPoint = endPoint; return; case ShapeSnappingOption.RectangleCorners: SnapMouseCanvasCoordinatesToRectangleCorners(startPoint, endPoint, out snappedStartPoint, out snappedEndPoint); return; case ShapeSnappingOption.PixelCenters: snappedStartPoint = PointDouble.Truncate(startPoint) + new VectorDouble(0.5, 0.5); snappedEndPoint = PointDouble.Truncate(endPoint) + new VectorDouble(0.5, 0.5); return; } throw ExceptionUtil.InvalidEnumArgumentException <ShapeSnappingOption>(snappingOption, "snappingOption"); }
public ShapeOptions(ShapeConstraintOption constraint = 1, ShapeElideOption elide = 2, ShapeTransformOption transform = 2, ShapeSnappingOption snapping = 1) { this.Constraint = constraint; this.Elide = elide; this.Transform = transform; this.Snapping = snapping; }