public CGRect Cancel() { var updateRect = CGRectExtensions.CGRectNull(); foreach (var point in Points) { point.PointType |= PointType.Cancelled; updateRect = updateRect.UnionWith(CalcUpdateRectFor(point)); } return(updateRect); }
private CGRect CalcUpdateRectFor(LinePoint point) { if (point == null) { return(CGRectExtensions.CGRectNull()); } var rect = new CGRect(point.Location, CGSize.Empty); // The negative magnitude ensures an outset rectangle var magnitude = -3 * LineWidth - 2; rect = rect.Inset(magnitude, magnitude); return(rect); }
public CGRect RemovePointsWithType(PointType type) { var updateRect = CGRectExtensions.CGRectNull(); LinePoint priorPoint = null; for (var i = Points.Count - 1; i >= 0; i--) { var point = Points[i]; if (point.PointType.HasFlag(type)) { Points.RemoveAt(i); updateRect = updateRect.UnionWith(CalcUpdateRectFor(point)); updateRect = updateRect.UnionWith(CalcUpdateRectFor(priorPoint)); } priorPoint = point; } return(updateRect); }