소스 검색

Invalidate Control global transform before notifying about resize / rect change

kleonc 1 년 전
부모
커밋
22b6f962d9
1개의 변경된 파일7개의 추가작업 그리고 4개의 파일을 삭제
  1. 7 4
      scene/gui/control.cpp

+ 7 - 4
scene/gui/control.cpp

@@ -1739,12 +1739,15 @@ void Control::_size_changed() {
 	data.size_cache = new_size_cache;
 	data.size_cache = new_size_cache;
 
 
 	if (is_inside_tree()) {
 	if (is_inside_tree()) {
-		if (size_changed) {
-			notification(NOTIFICATION_RESIZED);
-		}
 		if (pos_changed || size_changed) {
 		if (pos_changed || size_changed) {
-			item_rect_changed(size_changed);
+			// Ensure global transform is marked as dirty before `NOTIFICATION_RESIZED` / `item_rect_changed` signal
+			// so an up to date global transform could be obtained when handling these.
 			_notify_transform();
 			_notify_transform();
+
+			if (size_changed) {
+				notification(NOTIFICATION_RESIZED);
+			}
+			item_rect_changed(size_changed);
 		}
 		}
 
 
 		if (pos_changed && !size_changed) {
 		if (pos_changed && !size_changed) {