Inheritance #
- AudioServer
- CameraServer
- ClassDB
- DisplayServer
- EditorFileSystemDirectory
- EditorInterface
- EditorPaths
- EditorSelection
- EditorUndoRedoManager
- EditorVCSInterface
- Engine
- EngineDebugger
- FramebufferCacheRD
- GDExtensionManager
- Geometry2D
- Geometry3D
- IP
- Input
- InputMap
- JNISingleton
- JSONRPC
- JavaClassWrapper
- JavaScriptBridge
- MainLoop (1)
- Marshalls
- MovieWriter
- NativeMenu
- NavigationMeshGenerator
- NavigationServer2D
- NavigationServer3D
- Node (21)
- OS
- OpenXRExtensionWrapperExtension
- OpenXRInteractionProfileMetadata
- Performance
- PhysicsDirectBodyState2D (1)
- PhysicsDirectBodyState3D (1)
- PhysicsDirectSpaceState2D (1)
- PhysicsDirectSpaceState3D (1)
- PhysicsServer2D (1)
- PhysicsServer2DManager
- PhysicsServer3D (1)
- PhysicsServer3DManager
- PhysicsServer3DRendering
ServerHandler
- ProjectSettings
- RefCounted (121)
- RenderData (2)
- RenderSceneData (2)
- RenderingDevice
- RenderingServer
- ResourceLoader
- ResourceSaver
- ResourceUID
- ScriptLanguage (1)
- ShaderIncludeDB
- TextServerManager
- ThemeDB
- TileData
- Time
- TranslationServer
- TreeItem
- UndoRedo
- UniformSetCacheRD
- WorkerThreadPool
- XRServer
- XRVRS
- AnimationMixer (2)
- AudioStreamPlayer
- CanvasItem (2)
- CanvasLayer (1)
- EditorFileSystem
- EditorPlugin (1)
- EditorResourcePreview
- HTTPRequest
- InstancePlaceholder
- MissingNode
- MultiplayerSpawner
- MultiplayerSynchronizer
- NavigationAgent2D
- NavigationAgent3D
- Node3D (31)
- ResourcePreloader
- ShaderGlobalsOverride
- StatusIndicator
- Timer
- Viewport (2)
- WorldEnvironment
- BaseButton (3)
- ColorRect
- Container (13)
- GraphEdit
- ItemList
- Label
- LineEdit
- MenuBar
- NinePatchRect
- Panel
- Range (6)
- ReferenceRect
- RichTextLabel
- Separator (2)
- TabBar
- TextEdit (1)
- TextureRect
- Tree
- VideoStreamPlayer
- AspectRatioContainer
- BoxContainer (2)
- CenterContainer
- EditorProperty
- FlowContainer (2)
- GraphElement (2)
- GridContainer
- MarginContainer
- PanelContainer (2)
- ScrollContainer (1)
- SplitContainer (2)
- SubViewportContainer
- TabContainer
Table of contents
-
var alignment_horizontal = ALIGNMENT_CENTER -
var alignment_vertical = ALIGNMENT_CENTER -
var ratio: float = 1.0 -
var stretch_mode = STRETCH_FIT -
const STRETCH_WIDTH_CONTROLS_HEIGHT = 0 enum StretchMode -
const STRETCH_HEIGHT_CONTROLS_WIDTH = 1 enum StretchMode -
const STRETCH_FIT = 2 enum StretchMode -
const STRETCH_COVER = 3 enum StretchMode -
const ALIGNMENT_BEGIN = 0 enum AlignmentMode -
const ALIGNMENT_CENTER = 1 enum AlignmentMode -
const ALIGNMENT_END = 2 enum AlignmentMode -
enum StretchMode -
enum AlignmentMode
AspectRatioContainer #
is_instantiable, Node, core, not_builtin_classes
A container that preserves the proportions of its child controls.
A container type that arranges its child controls in a way that preserves their proportions automatically when the container is resized. Useful when a container has a dynamic size and the child nodes must adjust their sizes accordingly without losing their aspect ratios.
Members #
var alignment_horizontal = ALIGNMENT_CENTER#
Specifies the horizontal relative position of child controls.
var alignment_vertical = ALIGNMENT_CENTER#
Specifies the vertical relative position of child controls.
var ratio: float = 1.0#
The aspect ratio to enforce on child controls. This is the width divided by the height. The ratio depends on the stretch_mode.
var stretch_mode = STRETCH_FIT#
The stretch mode used to align child controls.
Methods #
Annotations #
Constants #
const STRETCH_WIDTH_CONTROLS_HEIGHT = 0 enum StretchMode#
The height of child controls is automatically adjusted based on the width of the container.
const STRETCH_HEIGHT_CONTROLS_WIDTH = 1 enum StretchMode#
The width of child controls is automatically adjusted based on the height of the container.
const STRETCH_FIT = 2 enum StretchMode#
The bounding rectangle of child controls is automatically adjusted to fit inside the container while keeping the aspect ratio.
const STRETCH_COVER = 3 enum StretchMode#
The width and height of child controls is automatically adjusted to make their bounding rectangle cover the entire area of the container while keeping the aspect ratio.
When the bounding rectangle of child controls exceed the container's size and Control.clip_contents is enabled, this allows to show only the container's area restricted by its own bounding rectangle.
const ALIGNMENT_BEGIN = 0 enum AlignmentMode#
Aligns child controls with the beginning (left or top) of the container.
const ALIGNMENT_CENTER = 1 enum AlignmentMode#
Aligns child controls with the center of the container.
const ALIGNMENT_END = 2 enum AlignmentMode#
Aligns child controls with the end (right or bottom) of the container.
Constructors #
Enums #
StretchMode#
enum StretchMode {
STRETCH_WIDTH_CONTROLS_HEIGHT = 0,
STRETCH_HEIGHT_CONTROLS_WIDTH = 1,
STRETCH_FIT = 2,
STRETCH_COVER = 3,
}AlignmentMode#
enum AlignmentMode {
ALIGNMENT_BEGIN = 0,
ALIGNMENT_CENTER = 1,
ALIGNMENT_END = 2,
}