private void OnGestureStarted(TwoFingerDragGesture gesture) { if (m_IsManipulating) { return; } if (CanStartManipulationForGesture(gesture)) { m_IsManipulating = true; gesture.onUpdated += OnUpdated; gesture.onFinished += OnFinished; OnStartManipulation(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; } }
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); } }
private void OnFinished(TwoFingerDragGesture gesture) { m_IsManipulating = false; OnEndManipulation(gesture); }
/// <summary> /// Function called when the manipulation is ended. /// </summary> /// <param name="gesture">The current gesture.</param> protected virtual void OnEndManipulation(TwoFingerDragGesture gesture) { // Optional override. }
/// <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) { }
/// <summary> /// Function called when the manipulation is continued. /// </summary> /// <param name="gesture">The current gesture.</param> protected virtual void OnContinueManipulation(TwoFingerDragGesture gesture) { }
void OnPanGestureFinished(TwoFingerDragGesture dragGesture) { m_PanGestureInProgress = false; }