Пример #1
0
 /// <summary>
 /// Make sure the gesture recognizer is on, then stop it.
 /// Otherwise, leave it alone because it's already in the desired state.
 /// </summary>
 public void StopGestureRecognizer()
 {
     if (gestureRecognizer != null && gestureRecognizer.IsCapturingGestures())
     {
         gestureRecognizer.StopCapturingGestures();
     }
     if (navigationGestureRecognizer != null && navigationGestureRecognizer.IsCapturingGestures())
     {
         navigationGestureRecognizer.StopCapturingGestures();
     }
 }
Пример #2
0
        /// <summary>
        /// Make sure the gesture recognizer is on, then stop it.
        /// Otherwise, leave it alone because it's already in the desired state.
        /// </summary>
        public void StopGestureRecognizer()
        {
#if UNITY_EDITOR || UNITY_WSA
            if (gestureRecognizer != null && gestureRecognizer.IsCapturingGestures())
            {
                gestureRecognizer.StopCapturingGestures();
            }
            if (navigationGestureRecognizer != null && navigationGestureRecognizer.IsCapturingGestures())
            {
                navigationGestureRecognizer.StopCapturingGestures();
            }
#endif
        }
        protected override void OnDestroy()
        {
            if (gestureRecognizer != null)
            {
                gestureRecognizer.StopCapturingGestures();
                gestureRecognizer.TappedEvent -= OnTappedEvent;

                gestureRecognizer.HoldStartedEvent   -= OnHoldStartedEvent;
                gestureRecognizer.HoldCompletedEvent -= OnHoldCompletedEvent;
                gestureRecognizer.HoldCanceledEvent  -= OnHoldCanceledEvent;

                gestureRecognizer.ManipulationStartedEvent   -= OnManipulationStartedEvent;
                gestureRecognizer.ManipulationUpdatedEvent   -= OnManipulationUpdatedEvent;
                gestureRecognizer.ManipulationCompletedEvent -= OnManipulationCompletedEvent;
                gestureRecognizer.ManipulationCanceledEvent  -= OnManipulationCanceledEvent;

                gestureRecognizer.Dispose();
            }

            base.OnDestroy();
        }