/// <summary> /// Method called by Tobii XR when the gaze focus changes by implementing <see cref="IGazeFocusable"/>. /// </summary> /// <param name="hasFocus"></param> public void GazeFocusChanged(bool hasFocus) { // Don't use this method if the component is disabled. if (!enabled) { return; } _hasFocus = hasFocus; // When the user starts focusing on this slider. if (hasFocus) { // Set the first touch pad value. _padXLastFrame = ControllerManager.Instance.GetTouchpadAxis().x; // If the user is touching the touchpad, animate the slider handle to become visible. if (ControllerManager.Instance.GetButtonTouch(TouchpadButton)) { _sliderGraphics.StartHandleAnimation(true); } } // When the user stops focusing on this slider. else { // Start animating the handle to disappear. _sliderGraphics.StartHandleAnimation(false); } // Animate the visual feedback. _sliderGraphics.StartVisualFeedbackAnimation(hasFocus); }
/// <summary> /// Method for handling the user input. /// </summary> private void HandleInput() { // If the trigger button is pressed down when focusing on the slider. if (ControllerManager.Instance.GetButtonPressDown(TriggerButton) && _hasFocus) { _operatingSlider = true; _sliderGraphics.StartHandleAnimation(true); return; } // Update the slider as long as the trigger button is being pressed down. if (_operatingSlider) { UpdateSlider(); } // When the trigger button is released, stop operating the slider. if (ControllerManager.Instance.GetButtonPressUp(TriggerButton)) { _operatingSlider = false; _sliderGraphics.StartHandleAnimation(false); _sliderGraphics.StartVisualFeedbackAnimation(_hasFocus); } }