Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add RequiresHover field to StatefulInteractable #11394

Merged

Conversation

smarwecki
Copy link

Overview

Added a (default false) "RequiresHover" field to StatefulInteractable, of which the only inheritor in the package is PressableButton. Setting this field to true (through inspector or code) prevents basic (also non-MRTK) interactors to trigger a OnClick event when not hovering and ending the selection (on button release, etc.).

Changes

  • Added a (default false) "RequiresHover" field to StatefulInteractable, of which the only inheritor in the package is PressableButton.
  • Make that field accessible through the editor panel / inspector in Unity.
  • Made changes to CanClickOnLastSelectExited method in StatefulInteractable, so that a OnClick event is only invoked when the interactable is being hovered over when RequiresHover field is set.
  • Minor bugfix: add isCancelled check as well - when interactors/interactables get unregistered and XRInteractionManager sends a "cancelled" selectexit, the OnClick event is now not triggered.

Verification

This optional section is a place where you can detail the specific type of verification
you want from reviewers. For example, if you want reviewers to checkout the PR locally
and validate the functionality of specific scenarios, provide instructions
on the specific scenarios and what you want verified.

If there are specific areas of concern or question feel free to highlight them here so
that reviewers can watch out for those issues.

As a reviewer, it is possible to check out this change locally by using the following
commands (substituting {PR_ID} with the ID of this pull request):

git fetch origin pull/{PR_ID}/head:name_of_local_branch

git checkout name_of_local_branch

thalbern
thalbern previously approved these changes Jan 24, 2023
Copy link
Contributor

@thalbern thalbern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM.
Just for additional info - this change is needed to allow us triggering buttons in mb only if the button is still hovered (eg user presses button down, moves pointer out of interactable - button should not trigger).
@Zee2 / @davidkline-ms do you think this change makes sense or is there another way to get the same behaviour with existing mrtk functionality?

@thalbern
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@thalbern
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@thalbern thalbern enabled auto-merge (squash) January 27, 2023 07:37
@thalbern thalbern merged commit 5779f1f into microsoft:mrtk3 Jan 27, 2023
drusk-unity pushed a commit to drusk-unity/MixedRealityToolkit-Unity that referenced this pull request Jun 26, 2023
* add RequiresHover field to StatefulInteractable

* renaming, refactoring (accoring to PR comments)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants