@@ -902,13 +902,6 @@ void Control::_compute_offsets(Rect2 p_rect, const real_t p_anchors[4], real_t (
902902 r_offsets[3 ] = p_rect.position .y + p_rect.size .y - (p_anchors[3 ] * parent_rect_size.y );
903903}
904904
905- void Control::_compute_edge_positions (Rect2 p_rect, real_t (&r_edge_positions)[4]) {
906- for (int i = 0 ; i < 4 ; i++) {
907- real_t area = p_rect.size [i & 1 ];
908- r_edge_positions[i] = data.offset [i] + (data.anchor [i] * area);
909- }
910- }
911-
912905// / Presets and layout modes.
913906
914907void Control::_set_layout_mode (LayoutMode p_mode) {
@@ -1439,13 +1432,10 @@ void Control::set_position(const Point2 &p_point, bool p_keep_offsets) {
14391432 }
14401433#endif // TOOLS_ENABLED
14411434
1442- real_t edge_pos[4 ];
1443- _compute_edge_positions (get_parent_anchorable_rect (), edge_pos);
1444- Size2 offset_size (edge_pos[2 ] - edge_pos[0 ], edge_pos[3 ] - edge_pos[1 ]);
14451435 if (p_keep_offsets) {
1446- _compute_anchors (Rect2 (p_point, offset_size ), data.offset , data.anchor );
1436+ _compute_anchors (Rect2 (p_point, data. size_cache ), data.offset , data.anchor );
14471437 } else {
1448- _compute_offsets (Rect2 (p_point, offset_size ), data.anchor , data.offset );
1438+ _compute_offsets (Rect2 (p_point, data. size_cache ), data.anchor , data.offset );
14491439 }
14501440 _size_changed ();
14511441}
@@ -1735,8 +1725,14 @@ Size2 Control::get_combined_minimum_size() const {
17351725
17361726void Control::_size_changed () {
17371727 Rect2 parent_rect = get_parent_anchorable_rect ();
1728+
17381729 real_t edge_pos[4 ];
1739- _compute_edge_positions (parent_rect, edge_pos);
1730+
1731+ for (int i = 0 ; i < 4 ; i++) {
1732+ real_t area = parent_rect.size [i & 1 ];
1733+ edge_pos[i] = data.offset [i] + (data.anchor [i] * area);
1734+ }
1735+
17401736 Point2 new_pos_cache = Point2 (edge_pos[0 ], edge_pos[1 ]);
17411737 Size2 new_size_cache = Point2 (edge_pos[2 ], edge_pos[3 ]) - new_pos_cache;
17421738
0 commit comments