Skip to main content

Hider

A component that manages visibility of fragments within a 3D scene. It extends the base Component class and provides methods to control fragment visibility and isolation. 📕 Tutorial. 📘 API.

Extends

Properties

enabled

enabled: boolean = true

Component.enabled

Overrides

Component . enabled


uuid

static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29"

A unique identifier for the component. This UUID is used to register the component within the Components system.

Methods

getVisibilityMap()

getVisibilityMap(state, modelIds?): Promise<Record<string, number[]>>

Asynchronously retrieves a map of model IDs to their corresponding item IDs based on visibility state.

Parameters

ParameterTypeDescription
statebooleanThe visibility state to filter items by.
modelIds?string[]Optional array of model IDs to filter the items. If not provided, all models will be considered.

Returns

Promise<Record<string, number[]>>

A promise that resolves to a ModelIdMap record where the keys are model IDs and the values are arrays of item IDs that match the visibility state.


isConfigurable()

isConfigurable(): this is Configurable<any, any>

Whether is component is Configurable.

Returns

this is Configurable<any, any>

Inherited from

Component . isConfigurable


isDisposeable()

isDisposeable(): this is Disposable

Whether is component is Disposable.

Returns

this is Disposable

Inherited from

Component . isDisposeable


isHideable()

isHideable(): this is Hideable

Whether is component is Hideable.

Returns

this is Hideable

Inherited from

Component . isHideable


isResizeable()

isResizeable(): this is Resizeable

Whether is component is Resizeable.

Returns

this is Resizeable

Inherited from

Component . isResizeable


isUpdateable()

isUpdateable(): this is Updateable

Whether is component is Updateable.

Returns

this is Updateable

Inherited from

Component . isUpdateable


isolate()

isolate(modelIdMap): Promise<void>

Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones. It calls the set method twice: first to hide all fragments, and then to show only the specified ones.

Parameters

ParameterTypeDescription
modelIdMapModelIdMapA map of model IDs and their corresponding itemIds to be isolated.

Returns

Promise<void>


set()

set(visible, modelIdMap?): Promise<void>

Sets the visibility of fragment items within the 3D scene. If no modelIdMap parameter is provided, all fragments will be set to the specified visibility. If it is provided, only the specified fragment items will be affected.

Parameters

ParameterTypeDescription
visiblebooleanThe visibility state to set for the items.
modelIdMap?ModelIdMapAn optional map of modelIds and their corresponding itemIds to be affected.
If not provided, all fragment items will be affected.

Returns

Promise<void>


toggle()

toggle(modelIdMap): Promise<void>

Toggles the visibility of specified items in the fragments.

Parameters

ParameterTypeDescription
modelIdMapModelIdMapAn object where the keys are model IDs and the values are arrays of local IDs representing the fragments to be toggled.

Returns

Promise<void>

A promise that resolves when all visibility toggles and the core update are complete.