Fix layout rectangle computations

Makes use of growth directions for all size changes, not just minimum ones.
This commit is contained in:
Enzo Novoselic
2026-06-18 15:45:32 -04:00
parent 5b4e0cb0fd
commit d7d7baee8a
3 changed files with 44 additions and 36 deletions
+5 -5
View File
@@ -1115,10 +1115,10 @@
The node's global position, relative to the world (usually to the [CanvasLayer]).
</member>
<member name="grow_horizontal" type="int" setter="set_h_grow_direction" getter="get_h_grow_direction" enum="Control.GrowDirection" default="1">
Controls the direction on the horizontal axis in which the control should grow if its horizontal minimum size is changed to be greater than its current size, as the control always has to be at least the minimum size.
Controls the direction on the horizontal axis in which the control should grow or shrink if its horizontal size is changed.
</member>
<member name="grow_vertical" type="int" setter="set_v_grow_direction" getter="get_v_grow_direction" enum="Control.GrowDirection" default="1">
Controls the direction on the vertical axis in which the control should grow if its vertical minimum size is changed to be greater than its current size, as the control always has to be at least the minimum size.
Controls the direction on the vertical axis in which the control should grow or shrink if its vertical size is changed.
</member>
<member name="layout_direction" type="int" setter="set_layout_direction" getter="get_layout_direction" enum="Control.LayoutDirection" default="0">
Controls layout direction and text writing direction. Right-to-left layouts are necessary for certain languages (e.g. Arabic and Hebrew). See also [method is_layout_rtl].
@@ -1568,13 +1568,13 @@
[b]Note:[/b] If the control has received [signal mouse_entered] but not [signal mouse_exited], changing the [member mouse_filter] to [constant MOUSE_FILTER_IGNORE] will cause [signal mouse_exited] to be emitted.
</constant>
<constant name="GROW_DIRECTION_BEGIN" value="0" enum="GrowDirection">
The control will grow to the left or top to make up if its minimum size is changed to be greater than its current size on the respective axis.
The control will grow/shrink to the left or top if its size is changed to be larger/smaller than its current size on the respective axis.
</constant>
<constant name="GROW_DIRECTION_END" value="1" enum="GrowDirection">
The control will grow to the right or bottom to make up if its minimum size is changed to be greater than its current size on the respective axis.
The control will grow/shrink to the right or bottom if its size is changed to be larger/smaller than its current size on the respective axis.
</constant>
<constant name="GROW_DIRECTION_BOTH" value="2" enum="GrowDirection">
The control will grow in both directions equally to make up if its minimum size is changed to be greater than its current size.
The control will grow/shrink in both directions equally if its size is changed to be larger/smaller than its current size.
</constant>
<constant name="ANCHOR_BEGIN" value="0" enum="Anchor">
Snaps one of the 4 anchor's sides to the origin of the node's [code]Rect[/code], in the top left. Use it with one of the [code]anchor_*[/code] member variables, like [member anchor_left]. To change all 4 anchors at once, use [method set_anchors_preset].