Function: addAspectRatioFitterComponent()
addAspectRatioFitterComponent(
world,entity,options?):AspectRatioFitterDefaultedOptions
Defined in: ui/components/aspect-ratio-fitter-component.ts:57
Attaches an AspectRatioFitterEcsComponent to entity, so
createUiAspectRatioFitterEcsSystem keeps its
RectTransformEcsComponent's own size at a constant aspectRatio every
frame - useful for a portrait/thumbnail image or a minimap whose
container might otherwise stretch it. fitInParent/envelopeParent read
the parent's own resolved rect (one frame stale, like every other
cross-entity read in this module - see createUiLayoutEcsSystem's own
doc comment) - entity needs a ParentEcsComponent for those two modes.
Parameters
world
The ECS world entity belongs to.
entity
number
The entity to attach the component to. Assumes a
point-anchored RectTransformEcsComponent (its x/y are each a
literal size, not a stretch margin).
options?
Partial<AspectRatioFitterEcsComponent> = {}
Options for configuring the fitter.
Returns
AspectRatioFitterDefaultedOptions
The attached component, for further tuning or runtime changes.