示例#1
0
            public DoubleTapZoom(ScaleImageView view, float targetZoom, float focusX, float focusY, bool stretchImageToSuper)
            {
                _view = view;
                view.SetState(TouchState.AnimateZoom);
                _startTime           = DateTime.Now.Ticks;
                _startZoom           = view._normalizedScale;
                _targetZoom          = targetZoom;
                _stretchImageToSuper = stretchImageToSuper;
                var bitmapPoint = view.TransformCoordTouchToBitmap(focusX, focusY, false);

                _bitmapX = bitmapPoint.X;
                _bitmapY = bitmapPoint.Y;

                //
                // Used for translating image during scaling
                //
                _startTouch = view.TransformCoordBitmapToTouch(_bitmapX, _bitmapY);
                _endTouch   = new PointF(view.ViewWidth / 2f, view.ViewHeight / 2f);
            }
示例#2
0
            public Fling(ScaleImageView view, int velocityX, int velocityY)
            {
                try
                {
                    _view = view;
                    view.SetState(TouchState.Fling);
                    _scroller = new Scroller(view._context);
                    view._matrix.GetValues(view._m);

                    var startX = (int)view._m[Matrix.MtransX];
                    var startY = (int)view._m[Matrix.MtransY];
                    int minX, maxX, minY, maxY;

                    if (view.GetImageWidth() > view.ViewWidth)
                    {
                        minX = view.ViewWidth - (int)view.GetImageWidth();
                        maxX = 0;
                    }
                    else
                    {
                        minX = maxX = startX;
                    }
                    if (view.GetImageHeight() > view.ViewHeight)
                    {
                        minY = view.ViewHeight - (int)view.GetImageHeight();
                        maxY = 0;
                    }
                    else
                    {
                        minY = maxY = startY;
                    }
                    _scroller.Fling(startX, startY, velocityX, velocityY, minX, maxX, minY, maxY);
                    _currX = startX;
                    _currY = startY;
                }
                catch (System.Exception ex)
                {
                    AppSettings.Logger.Warning(ex);
                }
            }
示例#3
0
 public ScaleListener(ScaleImageView view)
 {
     _view = view;
 }
示例#4
0
 public GestureListener(ScaleImageView view)
 {
     _view = view;
 }
示例#5
0
        //
        // Set zoom parameters equal to another ScaleImageView. Including scale, position,
        // and ScaleType.
        // @param ScaleImageView
        //
        public void SetZoom(ScaleImageView img)
        {
            var center = img.GetScrollPosition();

            SetZoom(img.GetCurrentZoom(), center.X, center.Y, img.GetScaleType());
        }