public InnerGestureListener(TapGestureHandler tapGestureHandler, PanGestureHandler panGestureHandler, SwipeGestureHandler swipeGestureHandler) { if (tapGestureHandler == null) { throw new ArgumentNullException(nameof(tapGestureHandler)); } if (panGestureHandler == null) { throw new ArgumentNullException(nameof(panGestureHandler)); } if (swipeGestureHandler == null) { throw new ArgumentNullException(nameof(swipeGestureHandler)); } _tapGestureHandler = tapGestureHandler; _panGestureHandler = panGestureHandler; _swipeGestureHandler = swipeGestureHandler; _tapDelegate = tapGestureHandler.OnTap; _tapGestureRecognizers = tapGestureHandler.TapGestureRecognizers; _scrollDelegate = panGestureHandler.OnPan; _scrollStartedDelegate = panGestureHandler.OnPanStarted; _scrollCompleteDelegate = panGestureHandler.OnPanComplete; _swipeDelegate = swipeGestureHandler.OnSwipe; _swipeCompletedDelegate = swipeGestureHandler.OnSwipeComplete; }
protected override void Dispose(bool disposing) { if (_disposed) { return; } _disposed = true; if (disposing) { _panGestureHandler = null; _swipeGestureHandler = null; _tapGestureHandler = null; _tapDelegate = null; _tapGestureRecognizers = null; _scrollDelegate = null; _scrollStartedDelegate = null; _scrollCompleteDelegate = null; _swipeDelegate = null; _swipeCompletedDelegate = null; _dragAndDropGestureHandler?.Dispose(); _dragAndDropGestureHandler = null; } base.Dispose(disposing); }
protected VisualElementRenderer() : base(Forms.Context) { _tapGestureHandler = new TapGestureHandler(() => View); _panGestureHandler = new PanGestureHandler(() => View, Context.FromPixels); _pinchGestureHandler = new PinchGestureHandler(() => View); _gestureDetector = new Lazy <GestureDetector>( () => new GestureDetector( _gestureListener = new InnerGestureListener(_tapGestureHandler.OnTap, _tapGestureHandler.TapGestureRecognizers, _panGestureHandler.OnPan, _panGestureHandler.OnPanStarted, _panGestureHandler.OnPanComplete))); _scaleDetector = new Lazy <ScaleGestureDetector>( () => new ScaleGestureDetector(Context, new InnerScaleListener(_pinchGestureHandler.OnPinch, _pinchGestureHandler.OnPinchStarted, _pinchGestureHandler.OnPinchEnded)) ); }