Ejemplo n.º 1
0
        private void OnGestureStarted(TwoFingerDragGesture gesture)
        {
            if (m_IsManipulating)
            {
                return;
            }

            if (CanStartManipulationForGesture(gesture))
            {
                m_IsManipulating    = true;
                gesture.onUpdated  += OnUpdated;
                gesture.onFinished += OnFinished;
                OnStartManipulation(gesture);
            }
        }
Ejemplo n.º 2
0
        void OnPanGestureStarted(InputAction.CallbackContext context)
        {
            if (m_ZoomGestureInProgress || m_PanGestureInProgress)
            {
                return;
            }

            TwoFingerDragGestureInteraction interaction = context.interaction as TwoFingerDragGestureInteraction;

            if (interaction?.currentGesture != null)
            {
                TwoFingerDragGesture dragGesture = interaction?.currentGesture as TwoFingerDragGesture;
                m_PanGestureInProgress  = true;
                dragGesture.onFinished += OnPanGestureFinished;
            }
        }
Ejemplo n.º 3
0
        private void OnUpdated(TwoFingerDragGesture gesture)
        {
            if (!m_IsManipulating)
            {
                return;
            }

            // Can only transform selected Items.
            if (ManipulationSystem.Instance.SelectedObject != gameObject)
            {
                m_IsManipulating = false;
                OnEndManipulation(gesture);
                return;
            }

            OnContinueManipulation(gesture);
        }
        void OnUpdated(TwoFingerDragGesture gesture)
        {
            if (!m_IsManipulating)
            {
                return;
            }

            // Can only transform selected Items.
            if (!IsGameObjectSelected())
            {
                m_IsManipulating = false;
                OnEndManipulation(gesture);
                return;
            }

            OnContinueManipulation(gesture);
        }
        void OnPanGestureStarted(InputAction.CallbackContext context)
        {
            if (m_ZoomGestureInProgress || m_PanGestureInProgress)
            {
                return;
            }

            TwoFingerDragGestureInteraction interaction = context.interaction as TwoFingerDragGestureInteraction;

            if (interaction?.currentGesture != null)
            {
                TwoFingerDragGesture dragGesture = interaction?.currentGesture as TwoFingerDragGesture;
                m_PanGestureInProgress  = true;
                dragGesture.onFinished += OnPanGestureFinished;

                Vector2 pos = Pointer.current.position.ReadValue();
                m_Camera.PanStart(pos);
            }
        }
Ejemplo n.º 6
0
 private void OnFinished(TwoFingerDragGesture gesture)
 {
     m_IsManipulating = false;
     OnEndManipulation(gesture);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Function called when the manipulation is ended.
 /// </summary>
 /// <param name="gesture">The current gesture.</param>
 protected virtual void OnEndManipulation(TwoFingerDragGesture gesture)
 {
     // Optional override.
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Returns true if the manipulation can be started for the given gesture.
 /// </summary>
 /// <param name="gesture">The current gesture.</param>
 /// <returns>True if the manipulation can be started.</returns>
 protected virtual bool CanStartManipulationForGesture(TwoFingerDragGesture gesture)
 {
     return(false);
 }
 /// <summary>
 /// Function called when the manipulation is ended.
 /// </summary>
 /// <param name="gesture">The current gesture.</param>
 protected virtual void OnEndManipulation(TwoFingerDragGesture gesture)
 {
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Function called when the manipulation is continued.
 /// </summary>
 /// <param name="gesture">The current gesture.</param>
 protected virtual void OnContinueManipulation(TwoFingerDragGesture gesture)
 {
 }
Ejemplo n.º 11
0
 void OnPanGestureFinished(TwoFingerDragGesture dragGesture)
 {
     m_PanGestureInProgress = false;
 }