Skip to content

Commit

Permalink
Decrease margins around the editor and project manager windows
Browse files Browse the repository at this point in the history
This increases the screen real estate available for Godot, especially
at smaller window sizes.

The editor icons for tab options were resized from 6×16 to 16×16
so they don't touch the window edge. Incindentally, this also makes them
easier to click.
  • Loading branch information
Calinou committed May 6, 2021
1 parent 758bccf commit e677f58
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 6 additions & 2 deletions editor/editor_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5933,8 +5933,12 @@ EditorNode::EditorNode() {

main_vbox = memnew(VBoxContainer);
gui_base->add_child(main_vbox);
main_vbox->set_anchors_and_offsets_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 8);
main_vbox->add_theme_constant_override("separation", 8 * EDSCALE);
// Add just one pixel of offset on all sides to prevent text or controls from touching the edges of the screen,
// and being partially occluded on some displays.
main_vbox->set_anchors_and_offsets_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, Math::round(EDSCALE));
// Add some offset at the top to avoid making text touch the window's top edge.
main_vbox->set_offset(SIDE_TOP, Math::round(4 * EDSCALE));
main_vbox->add_theme_constant_override("separation", Math::round(4 * EDSCALE));

menu_hb = memnew(HBoxContainer);
main_vbox->add_child(menu_hb);
Expand Down
6 changes: 5 additions & 1 deletion editor/project_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2472,7 +2472,11 @@ ProjectManager::ProjectManager() {

VBoxContainer *vb = memnew(VBoxContainer);
panel->add_child(vb);
vb->set_anchors_and_offsets_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 8 * EDSCALE);
// Add just one pixel of offset on all sides to prevent text or controls from touching the edges of the screen,
// and being partially occluded on some displays.
vb->set_anchors_and_offsets_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, Math::round(EDSCALE));
// Add some offset at the top to avoid making text touch the window's top edge.
vb->set_offset(SIDE_TOP, Math::round(4 * EDSCALE));

Control *center_box = memnew(Control);
center_box->set_v_size_flags(Control::SIZE_EXPAND_FILL);
Expand Down

0 comments on commit e677f58

Please sign in to comment.