Preparing search index...

    Represents a SphereButton component that extends the base Toggle class. This component initializes a SphereVisual instance and assigns it as the visual representation.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    Properties

    _colliderCenter: vec3 = ...
    _colliderFitElement: boolean = true
    _colliderSize: vec3 = ...
    _defaultToOn: boolean = false
    _hasError: boolean = false
    _initialized: boolean = false
    _interactableStateMachine: InteractableStateMachine
    _isDragged: boolean = false

    Indicates whether the element is currently being dragged. This property is used to track the drag state of the element.

    _renderOrder: number = 0
    _size: vec3 = ...
    _style: SnapOS2Styles = SnapOS2Styles.Custom
    _visual: Visual
    addCallbacks: boolean = false
    api: Record<string, any>

    Generic object accessible by other instances of ScriptComponent. Use this object to store references to properties and methods that need to be accessible from other ScriptComponents.

    colliderObject: SceneObject
    colliderShape: BoxShape
    colliderTransform: Transform
    currentPosition: vec3 = ...
    currentScale: vec3 = ...
    enabled: boolean

    If disabled, the Component will stop enacting its behavior.

    isEnabledInHierarchy: boolean

    Returns true if this Component, its SceneObject, and all of that SceneObjects parents are enabled.

    managedComponents: Set<Component> = ...
    managedSceneObjects: Set<SceneObject> = ...
    name: string
    onFinished: PublicApi<boolean> = ...

    Event that is triggered when the toggle finishes its action. The event data represents whether it's an explicit change.

    onFinishedCallbacks: Callback[] = []
    onHoverEnter: PublicApi<void> = ...

    An event that is triggered when a hover interaction starts on the element.

    onHoverExit: PublicApi<void> = ...

    An event that is triggered when a hover interaction ends on the element.

    onInitialized: PublicApi<void> = ...

    A public API event that is triggered when the element is initialized.

    onStateChanged: PublicApi<StateName> = ...

    An event that is triggered whenever the state of the element changes.

    onStateChangedEvent: ReplayEvent<StateName> = ...
    onTriggerDown: PublicApi<void> = ...

    An event that is triggered when a trigger interaction starts on the element.

    onTriggerUp: PublicApi<void> = ...

    An event that is triggered when a trigger interaction ends on the element.

    onValueChange: PublicApi<number> = ...

    Event that is triggered when the toggle value changes.

    onValueChangeCallbacks: Callback[] = []
    sceneObject: SceneObject

    The SceneObject this component is on.

    stateName: StateName = StateName.default
    uniqueIdentifier: string
    updatePriority: number
    visualEventHandlerUnsubscribes: unsubscribe[] = []

    Accessors

    • get collider(): ColliderComponent

      Gets the ColliderComponent instance associated with this element. The collider is used for detecting interactions or collisions with the element.

      Returns ColliderComponent

      The collider instance.

    • get colliderCenter(): vec3

      Gets the custom center position of the collider. This position is only used when colliderFitElement is false.

      Returns vec3

      The custom collider center position in local space coordinates.

    • set colliderCenter(center: vec3): void

      Sets the custom center position of the collider. This position is only applied when colliderFitElement is false.

      Parameters

      • center: vec3

        The custom collider center position in local space coordinates.

      Returns void

    • get colliderFitElement(): boolean

      Gets whether the collider automatically fits the element's size.

      Returns boolean

      True if the collider fits the element, false if using custom size/position.

    • set colliderFitElement(colliderFitElement: boolean): void

      Sets whether the collider should automatically fit the element's size.

      Parameters

      • colliderFitElement: boolean

        True to make the collider fit the element, false to use custom size/position.

      Returns void

    • get colliderSize(): vec3

      Gets the custom size of the collider. This size is only used when colliderFitElement is false.

      Returns vec3

      The custom collider size in local space coordinates.

    • set colliderSize(size: vec3): void

      Sets the custom size of the collider. This size is only applied when colliderFitElement is false.

      Parameters

      • size: vec3

        The custom collider size in local space coordinates.

      Returns void

    • get contentChildren(): SceneObject[]

      Gets the children of the element that are not managed by the element.

      Returns SceneObject[]

      The children of the element that are not managed by the element.

    • get contentChildrenCount(): number

      Gets the number of children of the element that are not managed by the element.

      Returns number

      The number of children of the element that are not managed by the element.

    • get deltaPosition(): vec3

      Returns vec3

    • get deltaScale(): vec3

      Returns vec3

    • get hasShadow(): boolean

      Gets whether the visual element has a shadow.

      Returns boolean

      Whether the visual element has a shadow.

    • set hasShadow(value: boolean): void

      Sets whether the visual element has a shadow. If the hasShadow is set to true, the shadowVisual object will be created and configured.

      Parameters

      • value: boolean

        Whether the visual element has a shadow.

      Returns void

    • get inactive(): boolean

      Returns boolean

      is inactive or not

    • set inactive(inactive: boolean): void

      Parameters

      • inactive: boolean

        set is inactive or is not inactive

      Returns void

    • get initialized(): boolean

      Indicates whether the element has been initialized.

      Returns boolean

      true if the element is initialized, otherwise false.

    • get interactable(): Interactable

      Gets the interactable property of the element.

      Returns Interactable

      The current interactable instance associated with this element.

    • get isDraggable(): boolean

      Determines whether the element is draggable.

      Returns boolean

      Always returns false, indicating that the element is not draggable.

    • get isOn(): boolean

      Gets the current state of the toggle.

      Returns boolean

      • Returns true if the toggle is on, otherwise false.
    • set isOn(on: boolean): void

      Sets the state of the toggle. If the new state is different from the current state, it updates the state, triggers the updateCheck method, and invokes the onValueChangeEvent.

      Parameters

      • on: boolean

        A boolean indicating the new state of the toggle.

      Returns void

    • get isToggle(): boolean

      Returns boolean

    • get playAudio(): boolean

      Gets the value indicating whether audio playback is enabled.

      Returns boolean

      true if audio playback is enabled; otherwise, false.

    • set playAudio(playAudio: boolean): void

      Sets the playAudio behavior and initializes the audio component if necessary.

      Parameters

      • playAudio: boolean

        A boolean indicating whether audio should be played. If set to true and the audio component is not already created, a new audio component will be instantiated and attached to the scene object.

      Returns void

    • get playTriggerDownAudio(): boolean

      Gets the value indicating whether trigger down audio playback is enabled.

      Returns boolean

      true if trigger down audio playback is enabled; otherwise, false.

    • set playTriggerDownAudio(playTriggerDownAudio: boolean): void

      Sets the playTriggerDownAudio behavior and initializes the audio component if necessary.

      Parameters

      • playTriggerDownAudio: boolean

        A boolean indicating whether trigger down audio should be played. If set to true and the audio component is not already created, a new audio component will be instantiated and attached to the scene object.

      Returns void

    • get playTriggerUpAudio(): boolean

      Gets the value indicating whether trigger up audio playback is enabled.

      Returns boolean

      true if trigger up audio playback is enabled; otherwise, false.

    • set playTriggerUpAudio(playTriggerUpAudio: boolean): void

      Sets the playTriggerUpAudio behavior and initializes the audio component if necessary.

      Parameters

      • playTriggerUpAudio: boolean

        A boolean indicating whether trigger up audio should be played. If set to true and the audio component is not already created, a new audio component will be instantiated and attached to the scene object.

      Returns void

    • get radius(): number

      Gets the radius of the sphere toggle.

      Returns number

      The radius of the sphere toggle in local space units.

    • set radius(radius: number): void

      Gets the radius of the sphere toggle.

      Parameters

      • radius: number

      Returns void

      The radius of the sphere toggle in local space units.

    • get renderOrder(): number

      Gets the render order of the visual element.

      Returns number

      The render order of the visual element.

    • set renderOrder(value: number): void

      Sets the render order of the visual element.

      Parameters

      • value: number

        The render order of the visual element.

      Returns void

    • get shadowPositionOffset(): vec3

      Gets the position offset of the shadow.

      Returns vec3

      The position offset of the shadow.

    • set shadowPositionOffset(value: vec3): void

      Sets the position offset of the shadow.

      Parameters

      • value: vec3

        The position offset of the shadow.

      Returns void

    • get shadowVisual(): DropShadowVisual

      Gets the associated DropShadowVisual instance for this component.

      Returns DropShadowVisual

      The DropShadowVisual instance linked to this component, if any.

    • get size(): vec3

      Gets the size of the sphere toggle as a 3D vector.

      Returns vec3

      The size of the sphere toggle.

    • set size(size: vec3): void

      Setter for the size property.

      The size property is not applicable for SphereToggle. Use the radius property instead to define the size of the toggle. A warning will be logged if this setter is used.

      Parameters

      • size: vec3

        The size value, which is ignored for SphereToggle.

      Returns void

    • get style(): string

      Gets the style of the visual element.

      Returns string

      The style of the visual element.

    • get transform(): Transform

      Gets the transform associated with this element.

      Returns Transform

      The transform of the element.

    • get triggerEndAudioTrack(): AudioTrackAsset

      Gets the audio track to be played at the end of a trigger event.

      Returns AudioTrackAsset

      The audio track asset associated with the trigger end event.

    • set triggerEndAudioTrack(audioTrack: AudioTrackAsset): void

      Sets the audio track to be played at the end of a trigger event.

      Parameters

      Returns void

    • get triggerEndAudioVolume(): number

      Gets the volume level for the trigger end audio.

      Returns number

      The volume level for the trigger end audio.

    • set triggerEndAudioVolume(volume: number): void

      Sets the volume level for the trigger end audio.

      Parameters

      • volume: number

        The desired volume level as a number.

      Returns void

    • get triggerStartAudioTrack(): AudioTrackAsset

      Gets the audio track to be played when the trigger starts.

      Returns AudioTrackAsset

      The audio track asset associated with the trigger start event.

    • set triggerStartAudioTrack(audioTrack: AudioTrackAsset): void

      Sets the audio track to be played when the trigger starts.

      Parameters

      Returns void

    • get triggerStartAudioVolume(): number

      Gets the volume level for the trigger start audio.

      Returns number

      The volume level for the trigger start audio.

    • set triggerStartAudioVolume(volume: number): void

      Sets the volume level for the trigger start audio.

      Parameters

      • volume: number

        The desired audio volume level as a number.

      Returns void

    • get typeString(): string

      Gets the type string of the visual element.

      Returns string

      The type string of the visual element.

    • get visual(): Visual

      Gets the associated Visual instance for this component.

      Returns Visual

      The Visual instance linked to this component.

    • set visual(value: Visual): void

      Sets the associated Visual instance for this component.

      Parameters

      • value: Visual

        The Visual instance to assign.

      Returns void

    • get zBackScale(): number

      Gets the z-axis back scale of the sphere toggle.

      Returns number

      The z-axis back scale of the sphere toggle.

    • set zBackScale(zBackScale: number): void

      Sets the z-axis back scale for the toggle's visual appearance. This value determines the depth scaling effect applied to the toggle.

      Parameters

      • zBackScale: number

        The new z-axis back scale value to be applied.

      Returns void

    Methods

    • Returns the name of this object's type.

      Returns string

    • Initializes the SphereToggle component. This method ensures that the component is only initialized once. If not already initialized, it creates a SphereVisual instance to bind as visual.

      Returns void

    • Returns true if the object matches or derives from the passed in type.

      Parameters

      • type: string

      Returns boolean

    • Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

      Parameters

      Returns boolean

    • Plays the specified audio track at the given volume.

      Parameters

      • audioTrack: AudioTrackAsset

        The audio track asset to be played.

      • volume: number

        The volume level at which the audio track should be played.

      Returns void

    • Registers a tooltip instance with the current component

      Parameters

      • tooltip: Tooltip

        The Tooltip instance to associate with this component.

      Returns void

    • Converts the component to a toggleable state.

      Parameters

      • isToggle: boolean

      Returns void

    • Parameters

      • on: boolean
      • explicit: boolean

      Returns void

    • Sets the tooltip text for the visual element.

      Parameters

      • text: string

        The text to be displayed in the tooltip.

      Returns void

    • Toggle on/off the toggle by setting its state

      Parameters

      • on: boolean

        A boolean value indicating the desired toggle state.

      Returns void