Skip to content

Commit

Permalink
Make ButtonCursorFeedback to ignore gaze focus by default
Browse files Browse the repository at this point in the history
  • Loading branch information
sescalada committed Jul 25, 2024
1 parent 43be8b9 commit a6edd82
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 13 additions & 1 deletion src/core/Evergine.Xrv.Core/UI/Buttons/ButtonCursorFeedback.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Evergine.Framework.Graphics;
using Evergine.Framework.Services;
using Evergine.Mathematics;
using Evergine.MRTK.Emulation;
using Evergine.MRTK.SDK.Features.UX.Components.PressableButtons;
using Evergine.Xrv.Core.Extensions;
using System;
Expand Down Expand Up @@ -41,14 +42,25 @@ public class ButtonCursorFeedback : Component, IPressableButtonFeedback
/// </summary>
public bool HideTextOnCursorLeave { get; set; } = true;

/// <summary>
/// Gets or sets a value indicating whether feedback should be applied on gaze.
/// </summary>
public bool ApplyFeedbackOnGaze { get; set; } = false;

/// <inheritdoc/>
void IPressableButtonFeedback.Feedback(Vector3 pushVector, float pressRatio, bool pressed)
{
}

/// <inheritdoc/>
void IPressableButtonFeedback.FocusChanged(bool focus)
void IPressableButtonFeedback.FocusChanged(Cursor cursor, bool focus)
{
// When gaze acts as focus origin, cursor parameter is passed as null
if (cursor == null && !this.ApplyFeedbackOnGaze)
{
return;
}

if (focus)
{
this.AnimateHover(animationDuration);
Expand Down

0 comments on commit a6edd82

Please sign in to comment.