Esempio n. 1
0
 public override bool OnFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
 {
     if (view.fling != null)
     {
         //
         // If a previous fling is still active, it should be cancelled so that two flings
         // are not run simultaenously.
         //
         view.fling.CancelFling();
     }
     view.fling = new Fling(view, (int)velocityX, (int)velocityY);
     view.CompatPostOnAnimation(view.fling);
     return(base.OnFling(e1, e2, velocityX, velocityY));
 }
Esempio n. 2
0
            public void Run()
            {
                float t          = Interpolate();
                float deltaScale = CalculateDeltaScale(t);

                view.ScaleImage(deltaScale, bitmapX, bitmapY, stretchImageToSuper);
                TranslateImageToCenterTouchPosition(t);
                view.FixScaleTrans();
                view.ImageMatrix = view.matrix;

                if (t < 1f)
                {
                    //
                    // We haven't finished zooming
                    //
                    view.CompatPostOnAnimation(this);
                }
                else
                {
                    //
                    // Finished zooming
                    //
                    view.SetState(TouchState.NONE);
                }
            }
Esempio n. 3
0
            public void Run()
            {
                if (scroller.IsFinished)
                {
                    scroller = null;
                    return;
                }

                if (scroller.ComputeScrollOffset())
                {
                    int newX   = scroller.CurrX;
                    int newY   = scroller.CurrY;
                    int transX = newX - currX;
                    int transY = newY - currY;
                    currX = newX;
                    currY = newY;
                    view.matrix.PostTranslate(transX, transY);
                    view.FixTrans();
                    view.ImageMatrix = view.matrix;
                    view.CompatPostOnAnimation(this);
                }
            }
Esempio n. 4
0
            public override void OnScaleEnd(ScaleGestureDetector detector)
            {
                base.OnScaleEnd(detector);
                view.SetState(TouchState.NONE);
                bool  animateToZoomBoundary = false;
                float targetZoom            = view.normalizedScale;

                if (view.normalizedScale > view.maxScale)
                {
                    targetZoom            = view.maxScale;
                    animateToZoomBoundary = true;
                }
                else if (view.normalizedScale < view.minScale)
                {
                    targetZoom            = view.minScale;
                    animateToZoomBoundary = true;
                }

                if (animateToZoomBoundary)
                {
                    DoubleTapZoom doubleTap = new DoubleTapZoom(view, targetZoom, view.viewWidth / 2, view.viewHeight / 2, true);
                    view.CompatPostOnAnimation(doubleTap);
                }
            }