@@ -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,14 +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- Point2 offset_pos = Point2 (edge_pos[0 ], edge_pos[1 ]) + (p_point - data.pos_cache );
1445- Size2 offset_size (edge_pos[2 ] - edge_pos[0 ], edge_pos[3 ] - edge_pos[1 ]);
14461435 if (p_keep_offsets) {
1447- _compute_anchors (Rect2 (offset_pos, offset_size ), data.offset , data.anchor );
1436+ _compute_anchors (Rect2 (p_point, data. size_cache ), data.offset , data.anchor );
14481437 } else {
1449- _compute_offsets (Rect2 (offset_pos, offset_size ), data.anchor , data.offset );
1438+ _compute_offsets (Rect2 (p_point, data. size_cache ), data.anchor , data.offset );
14501439 }
14511440 _size_changed ();
14521441}
@@ -1736,8 +1725,14 @@ Size2 Control::get_combined_minimum_size() const {
17361725
17371726void Control::_size_changed () {
17381727 Rect2 parent_rect = get_parent_anchorable_rect ();
1728+
17391729 real_t edge_pos[4 ];
1740- _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+
17411736 Point2 new_pos_cache = Point2 (edge_pos[0 ], edge_pos[1 ]);
17421737 Size2 new_size_cache = Point2 (edge_pos[2 ], edge_pos[3 ]) - new_pos_cache;
17431738
0 commit comments