Exemplo n.º 1
0
 public void StartPinchToZoom(float x0, float y0, float x1, float y1)
 {
     _previousDist = LineUtil.Distance(x0, y0, x1, y1);
     if (_previousDist > _minPinchToZoomDistance)
     {
         _savedMatrix.Set(_matrix);
         LineUtil.Middle(ref _middle, x0, y0, x1, y1);
     }
 }
Exemplo n.º 2
0
        public void PinchToZoom(float x0, float y0, float x1, float y1)
        {
            float currentDist = LineUtil.Distance(x0, y0, x1, y1);

            if (currentDist > _minPinchToZoomDistance)
            {
                float scale = currentDist / _previousDist;
                _matrix.Set(_savedMatrix);
                _matrix.PostScale(scale, scale, _middle.X, _middle.Y);
                _matrix.GetValues(_matrixValues);

                Zoom = _matrixValues[Matrix.MscaleX];
                PanX = _matrixValues[Matrix.MtransX];
                PanY = _matrixValues[Matrix.MtransY];
            }
        }