Skip to content

Commit 204e784

Browse files
committed
Merge pull request #113587 from syntaxerror247/popup-menu-seperation
Increase PopupMenu vertical separation to improve touch usability
2 parents 9706b4e + df4f9d0 commit 204e784

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

doc/classes/EditorSettings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1239,7 +1239,7 @@
12391239
[b]Note:[/b] Defaults to [code]true[/code] on touchscreen devices.
12401240
</member>
12411241
<member name="interface/touchscreen/enable_touch_optimizations" type="bool" setter="" getter="">
1242-
If [code]true[/code], increases the scrollbar touch area and enables a larger dragger for split containers to improve usability on touchscreen devices
1242+
If [code]true[/code], increases the scrollbar touch area, enables a larger dragger for split containers, and increases PopupMenu vertical separation to improve usability on touchscreen devices.
12431243
[b]Note:[/b] Defaults to [code]true[/code] on touchscreen devices.
12441244
</member>
12451245
<member name="interface/touchscreen/scale_gizmo_handles" type="float" setter="" getter="">

editor/editor_node.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7764,7 +7764,6 @@ void EditorNode::_update_main_menu_type() {
77647764

77657765
#ifdef ANDROID_ENABLED
77667766
// Align main menu icon visually with TouchActionsPanel buttons.
7767-
main_menu_button->get_popup()->add_theme_constant_override("v_separation", 16 * EDSCALE);
77687767
menu_btn_spacer = memnew(Control);
77697768
menu_btn_spacer->set_custom_minimum_size(Vector2(8, 0) * EDSCALE);
77707769
title_bar->add_child(menu_btn_spacer);

editor/themes/theme_classic.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1107,7 +1107,8 @@ void ThemeClassic::populate_standard_styles(const Ref<EditorTheme> &p_theme, Edi
11071107
p_theme->set_icon("submenu", "PopupMenu", p_theme->get_icon(SNAME("ArrowRight"), EditorStringName(EditorIcons)));
11081108
p_theme->set_icon("submenu_mirrored", "PopupMenu", p_theme->get_icon(SNAME("ArrowLeft"), EditorStringName(EditorIcons)));
11091109

1110-
p_theme->set_constant("v_separation", "PopupMenu", p_config.forced_even_separation * EDSCALE);
1110+
int v_sep = (p_config.enable_touch_optimizations ? 12 : p_config.forced_even_separation) * EDSCALE;
1111+
p_theme->set_constant("v_separation", "PopupMenu", v_sep);
11111112
p_theme->set_constant("outline_size", "PopupMenu", 0);
11121113
p_theme->set_constant("item_start_padding", "PopupMenu", p_config.separation_margin);
11131114
p_theme->set_constant("item_end_padding", "PopupMenu", p_config.separation_margin);

editor/themes/theme_modern.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1046,7 +1046,8 @@ void ThemeModern::populate_standard_styles(const Ref<EditorTheme> &p_theme, Edit
10461046
p_theme->set_icon("submenu_mirrored", "PopupMenu", p_theme->get_icon(SNAME("ArrowLeft"), EditorStringName(EditorIcons)));
10471047

10481048
p_theme->set_constant("h_separation", "PopupMenu", p_config.base_margin * 1.75 * EDSCALE);
1049-
p_theme->set_constant("v_separation", "PopupMenu", p_config.base_margin * 1.75 * EDSCALE);
1049+
int v_sep = (p_config.enable_touch_optimizations ? 12 : p_config.base_margin * 1.75) * EDSCALE;
1050+
p_theme->set_constant("v_separation", "PopupMenu", v_sep);
10501051
p_theme->set_constant("outline_size", "PopupMenu", 0);
10511052
p_theme->set_constant("item_start_padding", "PopupMenu", p_config.popup_margin);
10521053
p_theme->set_constant("item_end_padding", "PopupMenu", p_config.popup_margin);

0 commit comments

Comments
 (0)