SceneCoreEntitySizeAdapter

class SceneCoreEntitySizeAdapter<T : Entity>


The sizing strategy used by SceneCoreEntity to control and read the size of an entity.

The developer should use onLayoutSizeChanged to apply compose layout size changes to the entity. Compose will not inherently affect the size of the Entity.

If the developer uses onLayoutSizeChanged to change the size of the entity, but intrinsicSize is not provided, then the intrinsic size of the entity will be ignored and the layout size as determined solely by compose will be used to size the entity. If the SceneCoreEntity has no children or size modifiers then compose doesn't know how to size this node and it will be size 0, causing it not to render at all. In such a case, please do one of the following: (1) provide intrinsicSize so compose can infer the size from the entity, (2) add a sizing modifier to control the size of the entity, or (3) remove the adapter from the SceneCoreEntity as without an adapter compose will not try to control the size of this entity.

Note that many SceneCore entities accept sizes in meter units instead of pixels. The Meter type may be used to convert from pixels to meters.

Meter.fromPixel(px, density).toM()

Summary

Public constructors

<T : Entity> SceneCoreEntitySizeAdapter(
    onLayoutSizeChanged: T.(IntVolumeSize) -> Unit,
    intrinsicSize: (T.() -> IntVolumeSize)?
)

Public functions

open operator Boolean
equals(other: Any?)
open Int

Public properties

(T.() -> IntVolumeSize)?

a getter method that returns the current IntVolumeSize in pixels of the entity.

T.(IntVolumeSize) -> Unit

a callback that is invoked with the final layout size of the composable in pixels.

Public constructors

SceneCoreEntitySizeAdapter

<T : Entity> SceneCoreEntitySizeAdapter(
    onLayoutSizeChanged: T.(IntVolumeSize) -> Unit,
    intrinsicSize: (T.() -> IntVolumeSize)? = null
)
Parameters
onLayoutSizeChanged: T.(IntVolumeSize) -> Unit

a callback that is invoked with the final layout size of the composable in pixels.

intrinsicSize: (T.() -> IntVolumeSize)? = null

a getter method that returns the current IntVolumeSize in pixels of the entity. This isn't as critical for compose as onLayoutSizeChanged; however, this can help to inform compose of the intrinsic size of the entity.

Public functions

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

Public properties

intrinsicSize

Added in 1.0.0-alpha05
val intrinsicSize: (T.() -> IntVolumeSize)?

a getter method that returns the current IntVolumeSize in pixels of the entity. This isn't as critical for compose as onLayoutSizeChanged; however, this can help to inform compose of the intrinsic size of the entity.

onLayoutSizeChanged

Added in 1.0.0-alpha05
val onLayoutSizeChanged: T.(IntVolumeSize) -> Unit

a callback that is invoked with the final layout size of the composable in pixels.