Пример #1
0
 public override bool OnFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
 {
     //
     // 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));
 }
Пример #2
0
 public void Run()
 {
     try
     {
         if (_scroller.IsFinished)
         {
             _scroller = null;
             return;
         }
         if (_scroller.ComputeScrollOffset())
         {
             var newX   = _scroller.CurrX;
             var newY   = _scroller.CurrY;
             var transX = newX - _currX;
             var transY = newY - _currY;
             _currX = newX;
             _currY = newY;
             _view._matrix.PostTranslate(transX, transY);
             _view.FixTrans();
             _view.ImageMatrix = _view._matrix;
             _view.CompatPostOnAnimation(this);
         }
     }
     catch (System.Exception ex)
     {
         AppSettings.Logger.Warning(ex);
     }
 }
Пример #3
0
 public void Run()
 {
     try
     {
         if (_scroller.IsFinished)
         {
             _scroller = null;
             return;
         }
         if (_scroller.ComputeScrollOffset())
         {
             var newX   = _scroller.CurrX;
             var newY   = _scroller.CurrY;
             var transX = newX - _currX;
             var transY = newY - _currY;
             _currX = newX;
             _currY = newY;
             _view._matrix.PostTranslate(transX, transY);
             _view.FixTrans();
             _view.ImageMatrix = _view._matrix;
             _view.CompatPostOnAnimation(this);
         }
     }
     catch
     {
         //todo nothing
     }
 }
Пример #4
0
            public override void OnScaleEnd(ScaleGestureDetector detector)
            {
                base.OnScaleEnd(detector);
                _view.SetState(TouchState.None);
                var animateToZoomBoundary = false;
                var 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)
                {
                    var doubleTap = new DoubleTapZoom(_view, targetZoom, _view.ViewWidth / 2f, _view.ViewHeight / 2f, true);
                    _view.CompatPostOnAnimation(doubleTap);
                }
            }
Пример #5
0
            public void Run()
            {
                var t          = Interpolate();
                var 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);
                }
            }