Modifier

Partager via


CompressableButton Class

Definition

A button that can be pushed via direct touch.

public ref class CompressableButton : Microsoft::MixedReality::Toolkit::Experimental::InteractiveElement::BaseInteractiveElement
[UnityEngine.RequireComponent(typeof(Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable))]
public class CompressableButton : Microsoft.MixedReality.Toolkit.Experimental.InteractiveElement.BaseInteractiveElement
[<UnityEngine.RequireComponent(typeof(Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable))>]
type CompressableButton = class
    inherit BaseInteractiveElement
Public Class CompressableButton
Inherits BaseInteractiveElement
Inheritance
UnityEngine.MonoBehaviour
CompressableButton
Attributes
UnityEngine.RequireComponentAttribute

Constructors

CompressableButton()

Fields

ClickedStateName (Inherited from BaseInteractiveElement)
DefaultStateName (Inherited from BaseInteractiveElement)
FocusFarStateName (Inherited from BaseInteractiveElement)
FocusNearStateName (Inherited from BaseInteractiveElement)
FocusStateName (Inherited from BaseInteractiveElement)
movingButtonVisuals

The object that is being pushed.

PressedNearStateName
SelectFarStateName (Inherited from BaseInteractiveElement)
SpeechKeywordStateName (Inherited from BaseInteractiveElement)
startPushDistance
ToggleOffStateName (Inherited from BaseInteractiveElement)
ToggleOnStateName (Inherited from BaseInteractiveElement)
TouchStateName (Inherited from BaseInteractiveElement)

Properties

Active

Whether or not this interactive element will react to input and update internally. If true, the object will react to input and update internally. If false, the object will not update internally and not react to input, i.e. state values will not be updated.

(Inherited from BaseInteractiveElement)
CompressableButtonVisuals

The visuals which become compressed (scaled) along the z-axis when pressed.

CurrentPushDistance

Current push distance relative to the start push plane.

DistanceSpaceMode

Describes in which coordinate space the plane distances are stored and calculated

EnforceFrontPush

Ensures that the button can only be pushed from the front. Touching the button from the back or side is prevented.

EventReceiverManager

Manages the associated state events contained in a state.

(Inherited from BaseInteractiveElement)
IsPressing

Represents the state of whether the button is currently being pressed.

IsTouching

Represents the state of whether or not a finger is currently touching this button.

LocalToWorldScale

Transform for local to world space in the world direction of a press Multiply local scale positions by this value to convert to world space

MaxPushDistance

Maximum push distance. Distance is relative to the pivot of either the moving visuals if there's any or the button itself.

MinCompressPercentage

The minimum percentage of the original scale the compressableButtonVisuals can be compressed to.

MovingButtonIconText

Public property to set the moving content part(icon and text) of the button. This content part moves 1/2 distance of the front cage

PressDistance

Distance the button must be pushed until it is considered pressed. Distance is relative to the pivot of either the moving visuals if there's any or the button itself.

ReleaseDistanceDelta

Withdraw amount needed to transition from Pressed to Released.

ReleaseOnTouchEnd

Button will send the release event on touch end after successful press even if release plane hasn't been passed.

StartPushDistance

The offset at which pushing starts. Offset is relative to the pivot of either the moving visuals if there's any or the button itself.

StateManager

Entry point for state management. Contains methods for state setting, getting and creating.

(Inherited from BaseInteractiveElement)
States

A list of the interaction states for this interactive element.

(Inherited from BaseInteractiveElement)

Methods

AddNewState(String)

Creates and adds a new state to track given the new state name.

(Inherited from BaseInteractiveElement)
AddNewStateWithEventConfiguration(String, BaseInteractionEventConfiguration)

Create and add a new state given the state name and the associated existing event configuration.

(Inherited from BaseInteractiveElement)
AddToggleStates()

Add the ToggleOn and ToggleOff state.

(Inherited from BaseInteractiveElement)
AnimateInHighlightPlate()

Animates in the highlight plate.

AnimateOutHighlightPlate()

Animates out the highlight plate and disables it when animated out.

ForceSetToggleStates(Boolean)

Force set the toggle states either on or off.

(Inherited from BaseInteractiveElement)
GetDistanceAlongPushDirection(Vector3)

Returns the local distance along the push direction for the passed in world position

GetLocalPositionAlongPushDirection(Single)

Returns local position along the push direction for the given local distance

GetState(String)

Gets a state by using the state name.

(Inherited from BaseInteractiveElement)
GetStateEvents<T>(String)

Get the events associated with a state given the type and the state name.

If the state to retrieve is a CoreInteractionState: The type name of a state's event configuration is the state name + "Events". For example, Touch state's event configuration is named TouchEvents. The Focus state's event configuration is named FocusEvents.

If the state is not a CoreInteractionState: The type is most likely StateEvents. The StateEvents type is the default type of a new state that is not a core state.

(Inherited from BaseInteractiveElement)
GetWorldPositionAlongPushDirection(Single)

Returns world space position along the push direction for the given local distance

IsStateActive(String)

Check if a state is currently active.

(Inherited from BaseInteractiveElement)
IsStatePresent(String)

Checks if a state is currently in the States list and is being tracked by the state manager.

(Inherited from BaseInteractiveElement)
OnFocusEnter(FocusEventData) (Inherited from BaseInteractiveElement)
OnFocusExit(FocusEventData) (Inherited from BaseInteractiveElement)
OnPointerClicked(MixedRealityPointerEventData) (Inherited from BaseInteractiveElement)
OnPointerDown(MixedRealityPointerEventData) (Inherited from BaseInteractiveElement)
OnPointerDragged(MixedRealityPointerEventData) (Inherited from BaseInteractiveElement)
OnPointerUp(MixedRealityPointerEventData) (Inherited from BaseInteractiveElement)
OnSpeechKeywordRecognized(SpeechEventData) (Inherited from BaseInteractiveElement)
OnTouchCompleted(HandTrackingInputEventData) (Inherited from BaseInteractiveElement)
OnTouchStarted(HandTrackingInputEventData) (Inherited from BaseInteractiveElement)
OnTouchUpdated(HandTrackingInputEventData) (Inherited from BaseInteractiveElement)
OnValidate()
RemoveState(String)

Removes a state. The state will no longer be tracked if it is removed.

(Inherited from BaseInteractiveElement)
ResetAllStates()

Reset all the state values in the list to 0. State values are reset when the Active property is set to false.

(Inherited from BaseInteractiveElement)
SetStateAndInvokeEvent(String, Int32, BaseEventData)

Sets a state to a given state value and invokes an event with associated event data.

(Inherited from BaseInteractiveElement)
SetStateOff(String)

Gets and sets a state to Off and invokes the OnStateDeactivated event. Setting a state off changes the state value to 0.

(Inherited from BaseInteractiveElement)
SetStateOn(String)

Gets and sets a state to On and invokes the OnStateActivated event. Setting a state on changes the state value to 1.

(Inherited from BaseInteractiveElement)
SetToggles(Boolean) (Inherited from BaseInteractiveElement)
SetToggleStates()

Set the toggle based on the current values of the ToggleOn and ToggleOff states.

(Inherited from BaseInteractiveElement)
Start()
TriggerClickedState()

Set the Clicked state which triggers the OnClicked event. The click behavior in the state management system is expressed by setting the Clicked state to on and then immediately setting it to off.

Note: Due to the fact that a click is triggered by setting the Clicked state to on and then immediately off, the cyan active state highlight in the inspector will not be visible.

(Inherited from BaseInteractiveElement)
UpdateMovingVisualsPosition()

Applies to