StretchMode
Defines how an element should be stretched to fit a container.
| Type | Name | Interface Description |
|---|---|---|
| Enum | Fill = 4 | • Function: Scales the content to fill the container while maintaining its aspect ratio. The content may be cropped. |
| Enum | FillAndCut = 5 | • Function: Alias for Fill. Scales the content to fill the container and crops if necessary. |
| Enum | Fit = 0 | • Function: Scales the content to fit the container while maintaining its aspect ratio. The content is not cropped. |
| Enum | FitHeight = 2 | • Function: Scales the content to fit the container's height while maintaining its aspect ratio. |
| Enum | FitWidth = 1 | • Function: Scales the content to fit the container's width while maintaining its aspect ratio. |
| Enum | Stretch = 3 | • Function: Stretches the content to fill the container, which may not preserve the aspect ratio. |
| Enum | TextureSize = 6 | • Function: The content is not scaled and its original size is used. |
Examples
Fill = 4
let value = APJS.StretchMode.Fill;
FillAndCut = 5
let value = APJS.StretchMode.FillAndCut;
Fit = 0
let value = APJS.StretchMode.Fit;
FitHeight = 2
let value = APJS.StretchMode.FitHeight;
FitWidth = 1
let value = APJS.StretchMode.FitWidth;
Stretch = 3
let value = APJS.StretchMode.Stretch;
TextureSize = 6
let value = APJS.StretchMode.TextureSize;
Use Case
@component()
export class NewBehaviourScript extends APJS.BasicScriptComponent {
onStart() {
// TODO: instantiate / use StretchMode here
}
onUpdate(deltaTime: number) {
}
}