public override bool OnScale(ScaleGestureDetector detector) { _view._scaleFactor *= detector.ScaleFactor; _view._scaleFactor = Math.Max(1.0f, Math.Min(_view._scaleFactor, 5.0f)); _view._maxWidth = _view._width - (_view._width * _view._scaleFactor); _view._maxHeight = _view._height - (_view._height * _view._scaleFactor); _view.Invalidate(); return(true); }
public override bool OnScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { base.OnScroll(e1, e2, distanceX, distanceY); if (_view._scaleFactor > 1) { //if (((_view.ScrollX * _view._scaleFactor) < _view.Width) || ((_view.ScrollY * _view._scaleFactor) < _view.Height)) //{ _view.ScrollBy((int)distanceX, (int)distanceY); _view.Invalidate(); //} } else { var left = _view.Left; var width = _view.Width; var top = _view.Top; if (left - _view.ScrollX != 0 || top - _view.ScrollY != 0) { _view.ScrollBy(left - _view.ScrollX, top - _view.ScrollY); _view.Invalidate(); } } return(true); }