SubspaceModifier.Node

abstract class SubspaceModifier.Node : DelegatableSubspaceNode


The longer-lived object that is created for each SubspaceModifierNodeElement applied to a SubspaceLayout

Summary

Public constructors

Public functions

open Unit

Called when the node is attached to a SubspaceLayout which is part of the UI tree.

open Unit

Called when the node is not attached to a SubspaceLayout anymore.

Public properties

CoroutineScope

A CoroutineScope that can be used to launch tasks that should run while the node is attached.

Boolean

Indicates that the node is attached to a SubspaceLayout which is part of the UI tree.

open SubspaceModifier.Node

A reference of the SubspaceModifier.Node that holds this node's position in the node hierarchy.

open Boolean

If this property returns true, then nodes will be automatically invalidated after the modifier update completes.

Public constructors

Node

Added in 1.0.0-alpha09
Node()

Public functions

onAttach

Added in 1.0.0-alpha09
open fun onAttach(): Unit

Called when the node is attached to a SubspaceLayout which is part of the UI tree.

onDetach

Added in 1.0.0-alpha09
open fun onDetach(): Unit

Called when the node is not attached to a SubspaceLayout anymore. Note that the node can be reattached again.

Public properties

coroutineScope

Added in 1.0.0-alpha09
val coroutineScopeCoroutineScope

A CoroutineScope that can be used to launch tasks that should run while the node is attached.

The scope is accessible between onAttach and onDetach calls, and will be cancelled after the node is detached (after onDetach returns).

isAttached

Added in 1.0.0-alpha09
val isAttachedBoolean

Indicates that the node is attached to a SubspaceLayout which is part of the UI tree. This will get set to true right before onAttach is called, and set to false right after onDetach is called.

See also
onAttach
onDetach

node

open val nodeSubspaceModifier.Node

A reference of the SubspaceModifier.Node that holds this node's position in the node hierarchy. If the node is a delegate of another node, this will point to the root delegating node that is actually part of the node tree. Otherwise, this will point to itself.

shouldAutoInvalidate

Added in 1.0.0-alpha09
open val shouldAutoInvalidateBoolean

If this property returns true, then nodes will be automatically invalidated after the modifier update completes.

This is enabled by default, and provides a convenient mechanism to schedule invalidation and apply changes made to the modifier. You may choose to set this to false if your modifier has auto-invalidatable properties that do not frequently require invalidation to improve performance by skipping unnecessary invalidation. If shouldAutoInvalidate is set to false, you must call the appropriate invalidate functions manually when the modifier is updated or else the updates may not be reflected in the UI appropriately.