Пример #1
0
 private void PanUpdated(object sender, PanUpdatedEventArgs e)
 {
     //int ID = int.Parse((e as PanUpdatedEventArgs).Parameter.ToString());
     //ObservableCollection<Notes> buf = new ObservableCollection<Notes>();
     //foreach (Notes note in Instance.marks1)
     //{
     //    buf.Add(note);
     //}
     //foreach (Notes note in Instance.marks2)
     //{
     //    buf.Add(note);
     //}
     //Notes my_note = buf.Select(a => { return a; }).Where(a => a.Id == ID).ToList()[0];
     //Instance.marks1.Remove(my_note);
     //Instance.marks2.Remove(my_note);
 }
Пример #2
0
 private void OnPanUpdated(object sender, PanUpdatedEventArgs e)
 {
     ((ZoomImage)sender).TranslateTo(e.TotalX, e.TotalY, 250, Easing.SpringOut);
     //if (Scale > MIN_SCALE)
     //    switch (e.StatusType)
     //    {
     //        case GestureStatus.Started:
     //            LastX = TranslationX;
     //            LastY = TranslationY;
     //            break;
     //        case GestureStatus.Running:
     //            TranslationX = Clamp(LastX + e.TotalX * Scale, -Width / 2, Width / 2);
     //            TranslationY = Clamp(LastY + e.TotalY * Scale, -Height / 2, Height / 2);
     //            break;
     //    }
 }
Пример #3
0
        private void PanGestureRecognizer_PanUpdated(object sender, PanUpdatedEventArgs e)
        {
            ViewExtensions.CancelAnimations(BottomSheet);
            switch (e.StatusType)
            {
            case GestureStatus.Running:
                lastChange = e.TotalY;
                BottomSheet.TranslationY = Math.Min(Math.Max(BottomSheet.TranslationY + e.TotalY, positions[0]), positions[positions.Length - 1]);
                break;

            case GestureStatus.Canceled:
            case GestureStatus.Completed:
                SnapToNearest(lastChange);
                break;
            }
        }
Пример #4
0
        private void OnPanUpdated(object sender, PanUpdatedEventArgs e)
        {
            switch (e.StatusType)
            {
            case GestureStatus.Running:
                newXPosition = Content.TranslationX = e.TotalX;
                newYPosition = Content.TranslationY = e.TotalY;
                break;

            case GestureStatus.Completed:
                Content.TranslationX = newXPosition;
                Content.TranslationY = newYPosition;
                MessagingCenter.Send <FotoListContainerControl>(this, "Remover");
                break;
            }
        }
        internal async void OnPanGestureUpdated(object sender, PanUpdatedEventArgs e)
        {
            if (Thumb == null || TrackBar == null || FillBar == null)
            {
                return;
            }

            switch (e.StatusType)
            {
            case GestureStatus.Started:
                await TrackBar.FadeTo(FadeEffect, AnimLength);

                break;

            case GestureStatus.Running:
                // Translate and ensure we don't pan beyond the wrapped user interface element bounds.
                var x = Math.Max(0, e.TotalX);
                if (x > (Width - Thumb.Width))
                {
                    x = (Width - Thumb.Width);
                }

                // Uncomment this if you want only forward dragging.
                // if (e.TotalX < Thumb.TranslationX)
                //    return;
                Thumb.TranslationX = x;
                SetLayoutBounds(FillBar, new Rectangle(0, 0, x + Thumb.Width / 2, Height));
                break;

            case GestureStatus.Completed:
                var posX = Thumb.TranslationX;
                SetLayoutBounds(FillBar, new Rectangle(0, 0, 0, Height));

                // Reset translation applied during the pan
                await Task.WhenAll(new Task[]
                {
                    TrackBar.FadeTo(1, AnimLength),
                    Thumb.TranslateTo(0, 0, AnimLength * 2, Easing.CubicIn),
                });

                if (posX >= (Width - Thumb.Width - 10 /* keep some margin for error*/))
                {
                    SlideCompleted?.Invoke(this, EventArgs.Empty);
                }
                break;
            }
        }
Пример #6
0
        private void PanGesture_PanUpdated(object sender, PanUpdatedEventArgs e)
        {
            try
            {
                switch (e.StatusType)
                {
                case GestureStatus.Running:
                {
                    _gestureX = e.TotalX;
                    _gestureY = e.TotalY;
                }
                break;

                case GestureStatus.Completed:
                {
                    IsSwipe = true;
                    //Debug.WriteLine("{0}  {1}", _gestureX, _gestureY);
                    if (Math.Abs(_gestureX) > Math.Abs(_gestureY))
                    {
                        if (_gestureX > 0)
                        {
                            OnSwipeRight(null);
                        }
                        else
                        {
                            OnSwipeLeft(null);
                        }
                    }
                    else
                    {
                        if (_gestureY > 0)
                        {
                            OnSwipeDown(null);
                        }
                        else
                        {
                            OnSwipeUP(null);
                        }
                    }
                }
                break;
                }
            }
            catch (Exception ex)
            {
            }
        }
Пример #7
0
        void OnPanUpdated(object sender, PanUpdatedEventArgs e)
        {
            switch (e.StatusType)
            {
            case GestureStatus.Running:
                // Translate and ensure we don't pan beyond the wrapped user interface element bounds.
                Content.TranslationX = Math.Max(Math.Min(0, x + e.TotalX), -Math.Abs(Content.Width - App.ScreenWidth));
                Content.TranslationY = Math.Max(Math.Min(0, y + e.TotalY), -Math.Abs(Content.Height - App.ScreenHeight));
                break;

            case GestureStatus.Completed:
                // Store the translation applied during the pan
                x = Content.TranslationX;
                y = Content.TranslationY;
                break;
            }
        }
Пример #8
0
        public MoveDirection GetDirection(PanUpdatedEventArgs panUpdatedEventArgs)
        {
            if (panUpdatedEventArgs.StatusType == GestureStatus.Completed)
            {
                if (Math.Sqrt(PanX * PanX + PanY * PanY) > 100)
                {
                    if (PanX > 0)
                    {
                        if (Math.Abs(PanX) > Math.Abs(PanY))
                        {
                            return(MoveDirection.Right);
                        }
                    }
                    else
                    {
                        if (Math.Abs(PanX) > Math.Abs(PanY))
                        {
                            return(MoveDirection.Left);
                        }
                    }
                    if (PanY > 0)
                    {
                        if (Math.Abs(PanX) < Math.Abs(PanY))
                        {
                            return(MoveDirection.Bottom);
                        }
                    }
                    else
                    {
                        if (Math.Abs(PanX) < Math.Abs(PanY))
                        {
                            return(MoveDirection.Top);
                        }
                    }
                }
            }
            else
            {
                PanX = panUpdatedEventArgs.TotalX;
                PanY = panUpdatedEventArgs.TotalY;

                return(MoveDirection.None);
            }

            return(MoveDirection.None);
        }
Пример #9
0
        void OnPanUpdated(object sender, PanUpdatedEventArgs e)
        {
            switch (e.StatusType)
            {
            case GestureStatus.Running:
                Content.TranslationX = Math.Max(Math.Min(0, x + e.TotalX), -Math.Abs(Content.Width - App.ScreenWidth));
                Content.TranslationY = Math.Max(Math.Min(0, y + e.TotalY), -Math.Abs(Content.Height - App.ScreenHeight));
                break;

            case GestureStatus.Completed:
                x = Content.TranslationX;
                y = Content.TranslationY;
                break;

            default: break;
            }
        }
        void OnPanUpdated(object sender, PanUpdatedEventArgs e)
        {
            switch (e.StatusType)
            {
            case GestureStatus.Started:
                HandleTouchStart();
                break;

            case GestureStatus.Running:
                HandleTouch((float)e.TotalX);
                break;

            case GestureStatus.Completed:
                HandleTouchEnd();
                break;
            }
        }
Пример #11
0
        void OnPanUpdated(object sender, PanUpdatedEventArgs e)
        {
            switch (e.StatusType)
            {
            case GestureStatus.Running:
                // Translate and ensure we don't pan beyond the wrapped user interface element bounds.
                Content.TranslationX = x + e.TotalX;
                Content.TranslationY = y + e.TotalY;
                break;

            case GestureStatus.Completed:
                // Store the translation applied during the pan
                x = Content.TranslationX;
                y = Content.TranslationY;
                break;
            }
        }
Пример #12
0
 async void Handle_Swipe(object sender, PanUpdatedEventArgs e)
 {
     if (e.TotalX < 0 && Math.Abs(e.TotalX) > Math.Abs(e.TotalY))
     {
         if (!_ViewController.InputObject.IsSwipeDetected)
         {
             SwipeRight();
         }
     }
     else if (e.TotalX > 0 && e.TotalX > Math.Abs(e.TotalY))
     {
         if (!_ViewController.InputObject.IsSwipeDetected)
         {
             SwipeLeft();
         }
     }
 }
Пример #13
0
        private void PanGestureRecognizer_PanUpdated(object sender, PanUpdatedEventArgs e)
        {
            if (hueSelected)
            {
                guessingColor = guessingColor
                                .WithSaturation(Math.Min(1, Math.Max(0, (guessingColor.Saturation + (e.TotalX / (100 * ColorDisplayBoxView.Width)) % 1))))
                                .WithLuminosity(Math.Min(1, Math.Max(0, (guessingColor.Luminosity - (e.TotalY / (100 * ColorDisplayBoxView.Height)) % 1))));
                SubmitButton.TextColor = guessingColor;
            }
            else
            {
                guessingColor             = guessingColor.WithHue(Math.Abs(guessingColor.Hue + (e.TotalX / (200 * ColorDisplayBoxView.Width))) % 1);
                SelectHueButton.TextColor = guessingColor;
            }

            ColorDisplayBoxView.BackgroundColor = guessingColor;
        }
Пример #14
0
        private void PanGesture_PanUpdated(object sender, PanUpdatedEventArgs e)
        {
            switch (e.StatusType)
            {
            case GestureStatus.Started:
                _originalTranslationY = TranslationY;
                break;

            case GestureStatus.Running:
                TranslationY = _originalTranslationY + e.TotalY;
                break;

            case GestureStatus.Canceled:
                _originalTranslationY = 0;
                break;
            }
        }
Пример #15
0
        private void OnPanUpdated(object sender, PanUpdatedEventArgs e)
        {
            switch (e.StatusType)
            {
            case GestureStatus.Started:
                PanStarted();
                break;

            case GestureStatus.Running:
                PanRunning(e);
                break;

            case GestureStatus.Completed:
                PanCompleted();
                break;
            }
        }
Пример #16
0
        void OnPanUpdated(object sender, PanUpdatedEventArgs e)
        {
            switch (e.StatusType)
            {
            case GestureStatus.Running:
                _totalX = e.TotalX;
                _totalY = e.TotalY;
                if (_totalX < 0)
                {
                    OnSwipedLeft(_totalX, _totalY);
                }
                else if (_totalX > 0)
                {
                    OnSwipedRight(_totalX, _totalY);
                }
                if (_totalY < 0)
                {
                    OnSwipedDown(_totalX, _totalY);
                }
                else if (_totalY > 0)
                {
                    OnSwipedUp(_totalX, _totalY);
                }
                break;

            case GestureStatus.Completed:
                if (_totalX < 0)
                {
                    OnSwipedLeft(_totalX, _totalY);
                }
                else if (_totalX > 0)
                {
                    OnSwipedRight(_totalX, _totalY);
                }
                if (_totalY < 0)
                {
                    OnSwipedDown(_totalX, _totalY);
                }
                else if (_totalY > 0)
                {
                    OnSwipedUp(_totalX, _totalY);
                }
                break;
            }
        }
Пример #17
0
        private void OnDrag(object sender, PanUpdatedEventArgs e)
        {
            if (!m_sheetBehaviour.IsDraggable)
            {
                return;
            }
            if (m_newY == 0)
            {
                m_newY = SheetFrame.TranslationY;
            }

            switch (e.StatusType)
            {
            case GestureStatus.Started:
                m_sheetBehaviour.IsDragging = true;
                break;

            case GestureStatus.Running:

                var translationY    = (Device.RuntimePlatform == Device.Android) ? OuterSheetFrame.TranslationY : m_newY;
                var newYTranslation = e.TotalY + translationY;
                //Hack to remove jitter from android
                if (Device.RuntimePlatform == Device.Android)
                {
                    e = new PanUpdatedEventArgs(e.StatusType, e.GestureId, 0, newYTranslation);
                    newYTranslation = e.TotalY;
                }

                m_sheetBehaviour.UpdatePosition(newYTranslation);
                break;

            case GestureStatus.Completed:
                m_newY = SheetFrame.TranslationY;
                m_sheetBehaviour.IsDragging = false;
                //Snap?
                break;

            case GestureStatus.Canceled:
                m_sheetBehaviour.IsDragging = false;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
        private void OnPanUpdated(object sender, PanUpdatedEventArgs e)
        {
            if (_parent == null || !IsTranslateEnabled)
            {
                return;
            }

            switch (e.StatusType)
            {
            case GestureStatus.Started:
                panStartX    = _xOffset;
                panStartY    = _yOffset;
                panStartTime = DateTime.Now.Ticks;
                break;

            case GestureStatus.Running:
                _parent.Content.TranslationX = _xOffset + e.TotalX;
                _parent.Content.TranslationY = _yOffset + e.TotalY;
                break;

            case GestureStatus.Completed:
                _xOffset = _parent.Content.TranslationX;
                _yOffset = _parent.Content.TranslationY;

                if (_currentScale == 1)
                {
                    panEndTime = DateTime.Now.Ticks;
                    if (panEndTime - panStartTime < 1500000)
                    {
                        double yDifference = panStartY - _yOffset;
                        double xDifference = panStartX - _xOffset;

                        if (yDifference > -100 && yDifference < 100 &&
                            (xDifference < -35 || xDifference > 35))
                        {
                            // If x is bigger than 0 sliding direction is right, otherwise left
                            MessagingCenter.Send(this, xDifference > 0 ? Constants.RIGHT_SLIDE : Constants.LEFT_SLIDE);
                        }
                        panStartX = 0;
                        panStartY = 0;
                    }
                }
                break;
            }
        }
Пример #19
0
        void HandlePanUpdated(object sender, PanUpdatedEventArgs e)
        {
            View content = (View)sender;

            switch (e.StatusType)
            {
            case GestureStatus.Running:

                try
                {
                    translatedX = e.TotalX;
                    translatedY = e.TotalY;
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine(ex.Message);
                }
                break;

            case GestureStatus.Completed:

                if (translatedX < 0 && Math.Abs(translatedX) > Math.Abs(translatedY))
                {
                    mISwipeCallback.onLeftSwipe(content);
                }
                else if (translatedX > 0 && translatedX > Math.Abs(translatedY))
                {
                    mISwipeCallback.onRightSwipe(content);
                }
                else if (translatedY < 0 && Math.Abs(translatedY) > Math.Abs(translatedX))
                {
                    mISwipeCallback.onTopSwipe(content);
                }
                else if (translatedY > 0 && translatedY > Math.Abs(translatedX))
                {
                    mISwipeCallback.onBottomSwipe(content);
                }
                else
                {
                    mISwipeCallback.onNothingSwiped(content);
                }

                break;
            }
        }
Пример #20
0
        //swipe action
        private void OnMediaPan(object sender, PanUpdatedEventArgs e)
        {
            switch (e.StatusType)
            {
            case GestureStatus.Started:
                break;

            case GestureStatus.Running:

                UIMediaContent.TranslationX = e.TotalX;
                break;

            case GestureStatus.Completed:

                double x = UIMediaContent.TranslationX;

                double Threshhold = (Booru.ScreenWidth / 3);     //aka 1/3 of the screen
                if (Threshhold < Math.Abs(x))
                {
                    //A new Image Will Load, Clear the Current one
                    UIMediaContent.Children.Clear();

                    //place on oppsite side (so the next one slides in)
                    //[last] <- [current] <- [next]
                    //   ^----------------------^

                    bool Direction = (x < 0) ? true : false;

                    switch (Direction)
                    {
                    case true:        // swipe right ->
                        UIMediaContent.TranslationX = Booru.ScreenWidth;
                        OnSwipeLeft();
                        break;

                    case false:        //swipe left <-
                        UIMediaContent.TranslationX = -Booru.ScreenWidth;
                        OnSwipeRight();
                        break;
                    }
                }
                UIMediaContent.TranslateTo(0, 0);
                break;
            }
        }
Пример #21
0
        void OnPanUpdated(object sender, PanUpdatedEventArgs e)
        {
            try
            {
                switch (e.StatusType)
                {
                case GestureStatus.Running:
                    // Translate and ensure we don't pan beyond the wrapped user interface element bounds.
                    var translationX = e.TotalX;
                    var translationY = e.TotalY;
                    if (this.CanMove())
                    {
                        Content.TranslationX = translationX;
                        Content.TranslationY = translationY;
                        CropFrame.Current.MoveCorners(this.x + translationX,
                                                      this.y + translationY,
                                                      this.CornerPosition);
                        App.MainPagePage.SetLabelsCoordinate();
                    }

                    break;

                case GestureStatus.Completed:
                    // Store the translation applied during the pan
                    x += Content.TranslationX;
                    y += Content.TranslationY;

                    // Move PanContainer
                    this.TranslationX = x;
                    this.TranslationY = y;

                    // Move Content of the PanContainer
                    Content.TranslationX = 0;
                    Content.TranslationY = 0;

                    // Set GUI
                    CropFrame.Current.SetCropSize(this.CornerPosition);
                    break;
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
        }
Пример #22
0
        private void OnPanUpdated(object sender, PanUpdatedEventArgs e)
        {
            if (Scale > MIN_SCALE)
            {
                switch (e.StatusType)
                {
                case GestureStatus.Started:
                    LastX = TranslationX;
                    LastY = TranslationY;
                    break;

                case GestureStatus.Running:
                    TranslationX = Clamp(LastX + e.TotalX * Scale, -Width / 2, Width / 2);
                    TranslationY = Clamp(LastY + e.TotalY * Scale, -Height / 2, Height / 2);
                    break;
                }
            }
        }
Пример #23
0
        private void OnPanUpdated(object sender, PanUpdatedEventArgs e)
        {
            if (Scale > MIN_SCALE)
            {
                switch (e.StatusType)
                {
                case GestureStatus.Running:
                    TranslationX = _xOffset + e.TotalX;
                    TranslationY = _yOffset + e.TotalY;
                    break;

                case GestureStatus.Completed:
                    _xOffset = TranslationX;
                    _yOffset = TranslationY;
                    break;
                }
            }
        }
Пример #24
0
        private void OnPanUpdated(object sender, PanUpdatedEventArgs e)
        {
            double r = hourHand.Rotation;

            switch (e.StatusType)
            {
            case GestureStatus.Running:


                break;

            case GestureStatus.Completed:
                //set rotation according to TranslationX and TranslationY
                hourHand.Rotation = 180;

                break;
            }
        }
Пример #25
0
        private void OnPanUpdated(object sender, PanUpdatedEventArgs e)
        {
            if (!isBusy)
            {
                switch (e.StatusType)
                {
                case GestureStatus.Running:
                    Content.TranslationX = Math.Max(Math.Min(0, xOffset + e.TotalX), -Math.Abs(Content.Width - (Content.Width * currentScale)));
                    Content.TranslationY = Math.Max(Math.Min(0, yOffset + e.TotalY), -Math.Abs(Content.Height - (Content.Height * currentScale)));
                    break;

                case GestureStatus.Completed:
                    xOffset = Content.TranslationX;
                    yOffset = Content.TranslationY;
                    break;
                }
            }
        }
Пример #26
0
        private void OnPanUpdated(object sender, PanUpdatedEventArgs e)
        {
            if (currentScale != 0)
            {
                switch (e.StatusType)
                {
                case GestureStatus.Running:
                    this.Content.TranslationX = _xOffset + e.TotalX;
                    this.Content.TranslationY = _yOffset + e.TotalY;
                    break;

                case GestureStatus.Completed:
                    _xOffset = this.Content.TranslationX;
                    _yOffset = this.Content.TranslationY;
                    break;
                }
            }
        }
Пример #27
0
        public override bool OnTouchEvent(MotionEvent e)
        {
            _detector.OnTouchEvent(e);

            if (e.ActionMasked == MotionEventActions.Move)
            {
                var density = Context.Resources.DisplayMetrics.Density;
                var distXDp = GetTotalX(e) / density;
                var distYDp = GetTotalY(e) / density;
                var args    = new PanUpdatedEventArgs(GestureStatus.Running, GestureId, distXDp, distYDp);
                Element.OnPanUpdated(args);
            }

            HandleDownEvent(e);
            HandleUpEvent(e);

            return(true);
        }
Пример #28
0
        private void PanScreen(object sender, PanUpdatedEventArgs e)
        {
            switch (e.StatusType)
            {
            case GestureStatus.Started:
                if (!_isZoomed)
                {
                    _selectedState = null;
                }
                _xGestureStart = _x;
                _yGestureStart = _y;
                break;

            case GestureStatus.Running:
                UpdateCanvasProperties((float)e.TotalX + _xGestureStart, (float)e.TotalY + _yGestureStart);
                break;
            }
        }
Пример #29
0
        private async void PanGestureRecognizer_PanUpdated(object sender, PanUpdatedEventArgs e)
        {
            Point currentPosition = new Point(e.TotalX, e.TotalY);

            if (currentPosition.IsEmpty)
            {
                _previousPosition = Point.Zero;
                return;
            }

            Point offset = new Point(currentPosition.X - _previousPosition.X, currentPosition.Y - _previousPosition.Y);

            Debug.WriteLine("offset: " + offset);

            _previousPosition = currentPosition;

            await _viewModel.MoveMouseCursor(offset);
        }
Пример #30
0
        private void PanGestureRecognizer_PanUpdated(object sender, PanUpdatedEventArgs e)
        {
            panning = true;
            switch (e.StatusType)
            {
            case GestureStatus.Started:
                HandleTouchStart();
                break;

            case GestureStatus.Running:
                HandleTouch((float)e.TotalY);
                break;

            case GestureStatus.Completed:
                HandleTouchEnd();
                break;
            }
        }