Browse Source

Merge pull request #113822 from kitbdev/fix-editor-distraction-free-sc-size

Fix distraction-free mode changing split offsets
Thaddeus Crews 5 days ago
parent
commit
5831c53ed6
2 changed files with 4 additions and 2 deletions
  1. 3 1
      editor/docks/editor_dock_manager.cpp
  2. 1 1
      scene/gui/split_container.cpp

+ 3 - 1
editor/docks/editor_dock_manager.cpp

@@ -932,7 +932,9 @@ void EditorDockManager::set_docks_visible(bool p_show) {
 	}
 	}
 	docks_visible = p_show;
 	docks_visible = p_show;
 	for (int i = 0; i < DockConstants::DOCK_SLOT_BOTTOM; i++) {
 	for (int i = 0; i < DockConstants::DOCK_SLOT_BOTTOM; i++) {
-		dock_slots[i].container->set_visible(docks_visible && dock_slots[i].container->get_tab_count() > 0);
+		// Show and hide in reverse order due to the SplitContainer prioritizing the last split offset.
+		TabContainer *container = dock_slots[docks_visible ? i : DockConstants::DOCK_SLOT_BOTTOM - i - 1].container;
+		container->set_visible(docks_visible && container->get_tab_count() > 0);
 	}
 	}
 	_update_layout();
 	_update_layout();
 }
 }

+ 1 - 1
scene/gui/split_container.cpp

@@ -993,7 +993,7 @@ void SplitContainer::_remove_valid_child(Control *p_control) {
 	}
 	}
 	// Only use desired sizes to change the split offset after the first time a child is removed.
 	// Only use desired sizes to change the split offset after the first time a child is removed.
 	// This allows adding children to not affect the split offsets when creating.
 	// This allows adding children to not affect the split offsets when creating.
-	can_use_desired_sizes = valid_children.size() > 1u;
+	can_use_desired_sizes = true;
 
 
 	_update_default_dragger_positions();
 	_update_default_dragger_positions();
 	queue_sort();
 	queue_sort();