Example #1
0
        public CGRect Cancel()
        {
            var updateRect = CGRectExtensions.CGRectNull();

            foreach (var point in Points)
            {
                point.PointType |= PointType.Cancelled;
                updateRect       = updateRect.UnionWith(CalcUpdateRectFor(point));
            }

            return(updateRect);
        }
Example #2
0
        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);
        }
Example #3
0
        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);
        }