コード例 #1
0
        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);
        }
コード例 #2
0
ファイル: OBSlider.cs プロジェクト: xjpeter/gMusic
        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);
        }
コード例 #3
0
ファイル: UIControl.cs プロジェクト: afrog33k/CocoaSharp
 public virtual void EndTrackingWithTouch(UITouch touches, UIEvent withEvent)
 {
 }
コード例 #4
0
ファイル: UIControl.cs プロジェクト: afrog33k/CocoaSharp
 public virtual bool ContinueTrackingWithTouch(UITouch touch, UIEvent withEvent)
 {
     return(default(bool));
 }