public override bool OnDoubleTap(MotionEvent e) { var consumed = false; if (_view._doubleTapListener != null) { consumed = _view._doubleTapListener.OnDoubleTap(e); } if (_view._state == TouchState.None) { var targetZoom = (Math.Abs(_view._normalizedScale - _view._minScale) < Tolerance) ? _view._maxScale : _view._minScale; var doubleTap = new DoubleTapZoom(_view, targetZoom, e.GetX(), e.GetY(), false); _view.CompatPostOnAnimation(doubleTap); consumed = true; } return(consumed); }
public override bool OnDoubleTap(MotionEvent e) { bool consumed = false; if (view.doubleTapListener != null) { consumed = view.doubleTapListener.OnDoubleTap(e); } if (view.state == TouchState.NONE) { float targetZoom = (view.normalizedScale == view.minScale) ? view.maxScale : view.minScale; DoubleTapZoom doubleTap = new DoubleTapZoom(view, targetZoom, e.GetX(), e.GetY(), false); view.CompatPostOnAnimation(doubleTap); consumed = true; } return(consumed); }
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); } }
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); } }