mirror of
https://github.com/godotengine/godot-docs.git
synced 2025-12-31 17:49:03 +03:00
214 lines
8.7 KiB
ReStructuredText
214 lines
8.7 KiB
ReStructuredText
:github_url: hide
|
|
|
|
.. DO NOT EDIT THIS FILE!!!
|
|
.. Generated automatically from Godot engine sources.
|
|
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
|
|
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AspectRatioContainer.xml.
|
|
|
|
.. _class_AspectRatioContainer:
|
|
|
|
AspectRatioContainer
|
|
====================
|
|
|
|
**Inherits:** :ref:`Container<class_Container>` **<** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
|
|
|
|
A container that preserves the proportions of its child controls.
|
|
|
|
.. rst-class:: classref-introduction-group
|
|
|
|
Description
|
|
-----------
|
|
|
|
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.
|
|
|
|
.. rst-class:: classref-introduction-group
|
|
|
|
Tutorials
|
|
---------
|
|
|
|
- :doc:`Using Containers <../tutorials/ui/gui_containers>`
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
Properties
|
|
----------
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+---------------------------------------------------------------+---------------------------------------------------------------------------------------+---------+
|
|
| :ref:`AlignmentMode<enum_AspectRatioContainer_AlignmentMode>` | :ref:`alignment_horizontal<class_AspectRatioContainer_property_alignment_horizontal>` | ``1`` |
|
|
+---------------------------------------------------------------+---------------------------------------------------------------------------------------+---------+
|
|
| :ref:`AlignmentMode<enum_AspectRatioContainer_AlignmentMode>` | :ref:`alignment_vertical<class_AspectRatioContainer_property_alignment_vertical>` | ``1`` |
|
|
+---------------------------------------------------------------+---------------------------------------------------------------------------------------+---------+
|
|
| :ref:`float<class_float>` | :ref:`ratio<class_AspectRatioContainer_property_ratio>` | ``1.0`` |
|
|
+---------------------------------------------------------------+---------------------------------------------------------------------------------------+---------+
|
|
| :ref:`StretchMode<enum_AspectRatioContainer_StretchMode>` | :ref:`stretch_mode<class_AspectRatioContainer_property_stretch_mode>` | ``2`` |
|
|
+---------------------------------------------------------------+---------------------------------------------------------------------------------------+---------+
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Enumerations
|
|
------------
|
|
|
|
.. _enum_AspectRatioContainer_StretchMode:
|
|
|
|
.. rst-class:: classref-enumeration
|
|
|
|
enum **StretchMode**: :ref:`🔗<enum_AspectRatioContainer_StretchMode>`
|
|
|
|
.. _class_AspectRatioContainer_constant_STRETCH_WIDTH_CONTROLS_HEIGHT:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`StretchMode<enum_AspectRatioContainer_StretchMode>` **STRETCH_WIDTH_CONTROLS_HEIGHT** = ``0``
|
|
|
|
The height of child controls is automatically adjusted based on the width of the container.
|
|
|
|
.. _class_AspectRatioContainer_constant_STRETCH_HEIGHT_CONTROLS_WIDTH:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`StretchMode<enum_AspectRatioContainer_StretchMode>` **STRETCH_HEIGHT_CONTROLS_WIDTH** = ``1``
|
|
|
|
The width of child controls is automatically adjusted based on the height of the container.
|
|
|
|
.. _class_AspectRatioContainer_constant_STRETCH_FIT:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`StretchMode<enum_AspectRatioContainer_StretchMode>` **STRETCH_FIT** = ``2``
|
|
|
|
The bounding rectangle of child controls is automatically adjusted to fit inside the container while keeping the aspect ratio.
|
|
|
|
.. _class_AspectRatioContainer_constant_STRETCH_COVER:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`StretchMode<enum_AspectRatioContainer_StretchMode>` **STRETCH_COVER** = ``3``
|
|
|
|
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 :ref:`Control.clip_contents<class_Control_property_clip_contents>` is enabled, this allows to show only the container's area restricted by its own bounding rectangle.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _enum_AspectRatioContainer_AlignmentMode:
|
|
|
|
.. rst-class:: classref-enumeration
|
|
|
|
enum **AlignmentMode**: :ref:`🔗<enum_AspectRatioContainer_AlignmentMode>`
|
|
|
|
.. _class_AspectRatioContainer_constant_ALIGNMENT_BEGIN:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`AlignmentMode<enum_AspectRatioContainer_AlignmentMode>` **ALIGNMENT_BEGIN** = ``0``
|
|
|
|
Aligns child controls with the beginning (left or top) of the container.
|
|
|
|
.. _class_AspectRatioContainer_constant_ALIGNMENT_CENTER:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`AlignmentMode<enum_AspectRatioContainer_AlignmentMode>` **ALIGNMENT_CENTER** = ``1``
|
|
|
|
Aligns child controls with the center of the container.
|
|
|
|
.. _class_AspectRatioContainer_constant_ALIGNMENT_END:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`AlignmentMode<enum_AspectRatioContainer_AlignmentMode>` **ALIGNMENT_END** = ``2``
|
|
|
|
Aligns child controls with the end (right or bottom) of the container.
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Property Descriptions
|
|
---------------------
|
|
|
|
.. _class_AspectRatioContainer_property_alignment_horizontal:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`AlignmentMode<enum_AspectRatioContainer_AlignmentMode>` **alignment_horizontal** = ``1`` :ref:`🔗<class_AspectRatioContainer_property_alignment_horizontal>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_alignment_horizontal**\ (\ value\: :ref:`AlignmentMode<enum_AspectRatioContainer_AlignmentMode>`\ )
|
|
- :ref:`AlignmentMode<enum_AspectRatioContainer_AlignmentMode>` **get_alignment_horizontal**\ (\ )
|
|
|
|
Specifies the horizontal relative position of child controls.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_AspectRatioContainer_property_alignment_vertical:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`AlignmentMode<enum_AspectRatioContainer_AlignmentMode>` **alignment_vertical** = ``1`` :ref:`🔗<class_AspectRatioContainer_property_alignment_vertical>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_alignment_vertical**\ (\ value\: :ref:`AlignmentMode<enum_AspectRatioContainer_AlignmentMode>`\ )
|
|
- :ref:`AlignmentMode<enum_AspectRatioContainer_AlignmentMode>` **get_alignment_vertical**\ (\ )
|
|
|
|
Specifies the vertical relative position of child controls.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_AspectRatioContainer_property_ratio:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`float<class_float>` **ratio** = ``1.0`` :ref:`🔗<class_AspectRatioContainer_property_ratio>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_ratio**\ (\ value\: :ref:`float<class_float>`\ )
|
|
- :ref:`float<class_float>` **get_ratio**\ (\ )
|
|
|
|
The aspect ratio to enforce on child controls. This is the width divided by the height. The ratio depends on the :ref:`stretch_mode<class_AspectRatioContainer_property_stretch_mode>`.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_AspectRatioContainer_property_stretch_mode:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`StretchMode<enum_AspectRatioContainer_StretchMode>` **stretch_mode** = ``2`` :ref:`🔗<class_AspectRatioContainer_property_stretch_mode>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_stretch_mode**\ (\ value\: :ref:`StretchMode<enum_AspectRatioContainer_StretchMode>`\ )
|
|
- :ref:`StretchMode<enum_AspectRatioContainer_StretchMode>` **get_stretch_mode**\ (\ )
|
|
|
|
The stretch mode used to align child controls.
|
|
|
|
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
|
|
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
|
|
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
|
|
.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
|
|
.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
|
|
.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
|
|
.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
|
|
.. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
|
|
.. |void| replace:: :abbr:`void (No return value.)`
|