Пример #1
0
        CGRect AddPointsOfType(PointType type, UITouch[] touches, Line line)
        {
            var accumulatedRect = CGRectNull();

            for (int i = 0; i < touches.Length; i++)
            {
                var touch = touches [i];
                // The visualization displays non-`.Stylus` touches differently.
                if (touch.Type != UITouchType.Stylus)
                {
                    type |= PointType.Finger;
                }

                // Touches with estimated properties require updates; add this information to the `PointType`.
                if (touch.EstimatedProperties != 0)
                {
                    type |= PointType.NeedsUpdate;
                }

                // The last touch in a set of .Coalesced touches is the originating touch. Track it differently.
                bool isLast = (i == touches.Length - 1);
                if (type.HasFlag(PointType.Coalesced) && isLast)
                {
                    type &= ~PointType.Coalesced;
                    type |= PointType.Standard;
                }

                var touchRect = line.AddPointOfType(type, touch);
                accumulatedRect = accumulatedRect.UnionWith(touchRect);
                CommitLine(line);
            }

            return(accumulatedRect);
        }
Пример #2
0
		CGRect AddPointsOfType (PointType type, UITouch[] touches, Line line)
		{
			var accumulatedRect = CGRectNull ();

			for (int i = 0; i < touches.Length; i++) {
				var touch = touches [i];
				// The visualization displays non-`.Stylus` touches differently.
				if (touch.Type != UITouchType.Stylus)
					type |= PointType.Finger;

				// Touches with estimated properties require updates; add this information to the `PointType`.
				if (touch.EstimatedProperties != 0)
					type |= PointType.NeedsUpdate;

				// The last touch in a set of .Coalesced touches is the originating touch. Track it differently.
				bool isLast = (i == touches.Length - 1);
				if (type.HasFlag (PointType.Coalesced) && isLast) {
					type &= ~PointType.Coalesced;
					type |= PointType.Standard;
				}

				var touchRect = line.AddPointOfType (type, touch);
				accumulatedRect = accumulatedRect.UnionWith (touchRect);
				CommitLine (line);
			}

			return accumulatedRect;
		}