internal static bool IsTouchInView(this _Touch touch, _View view) { var window = _Application.SharedApplication.KeyWindow; var screenLocation = touch.LocationInView(window); var bounds = GetBounds(window, view); return(screenLocation.X >= bounds.X && screenLocation.Y >= bounds.Y && screenLocation.X < bounds.Right && screenLocation.Y < bounds.Bottom); }
public override bool ContinueTracking(UITouch touch, UIEvent uievent) { if (!this.Tracking) { return(false); } var previousLocation = touch.PreviousLocationInView(this); var currentLocation = touch.LocationInView(this); var trackingOffset = currentLocation.X - previousLocation.X; nfloat verticalOffset = NMath.Abs(currentLocation.Y - beganTrackingLocation.Y); var scrubbingSpeedChangePosIndex = indexOfLowerScrubbingSpeed(verticalOffset); ScrubbingSpeed = ScrubbingSpeeds[scrubbingSpeedChangePosIndex]; var trackRect = this.TrackRectForBounds(this.Bounds); realPositionValue = realPositionValue + (MaxValue - MinValue) * (trackingOffset / trackRect.Width); nfloat valueAdjustment = ScrubbingSpeed * (MaxValue - MinValue) * (trackingOffset / trackRect.Width); nfloat thumbAdjustment = 0f; if (((beganTrackingLocation.Y < currentLocation.Y) && (currentLocation.Y < previousLocation.Y)) || ((beganTrackingLocation.Y > currentLocation.Y) && (currentLocation.Y > previousLocation.Y))) { // We are getting closer to the slider, go closer to the real location thumbAdjustment = (realPositionValue - Value) / (1 + NMath.Abs(currentLocation.Y - beganTrackingLocation.Y)); } Value += (float)(valueAdjustment + thumbAdjustment); if (Continuous) { this.SendActionForControlEvents(UIControlEvent.ValueChanged); } return(true); }
public virtual void EndTrackingWithTouch(UITouch touches, UIEvent withEvent) { }
public virtual bool ContinueTrackingWithTouch(UITouch touch, UIEvent withEvent) { return(default(bool)); }