Skip to content

Commit 8738aae

Browse files
committed
Merge pull request godotengine#94569 from Calinou/script-editor-tweak-zoom-presets
Tweak script editor zoom presets to be more useful
2 parents efc7c62 + 84e278c commit 8738aae

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

editor/code_editor.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,7 @@ FindReplaceBar::FindReplaceBar() {
820820

821821
/*** CODE EDITOR ****/
822822

823-
static constexpr float ZOOM_FACTOR_PRESETS[7] = { 0.25f, 0.5f, 0.75f, 1.0f, 1.5f, 2.0f, 3.0f };
823+
static constexpr float ZOOM_FACTOR_PRESETS[8] = { 0.5f, 0.75f, 0.9f, 1.0f, 1.1f, 1.25f, 1.5f, 2.0f };
824824

825825
// This function should be used to handle shortcuts that could otherwise
826826
// be handled too late if they weren't handled here.
@@ -1716,8 +1716,7 @@ void CodeTextEditor::_zoom_to(float p_zoom_factor) {
17161716
}
17171717

17181718
void CodeTextEditor::set_zoom_factor(float p_zoom_factor) {
1719-
int preset_count = sizeof(ZOOM_FACTOR_PRESETS) / sizeof(float);
1720-
zoom_factor = CLAMP(p_zoom_factor, ZOOM_FACTOR_PRESETS[0], ZOOM_FACTOR_PRESETS[preset_count - 1]);
1719+
zoom_factor = CLAMP(p_zoom_factor, 0.25f, 3.0f);
17211720
int neutral_font_size = int(EDITOR_GET("interface/editor/code_font_size")) * EDSCALE;
17221721
int new_font_size = Math::round(zoom_factor * neutral_font_size);
17231722

@@ -1843,7 +1842,8 @@ CodeTextEditor::CodeTextEditor() {
18431842
status_bar->add_child(zoom_button);
18441843
zoom_button->set_flat(true);
18451844
zoom_button->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER);
1846-
zoom_button->set_tooltip_text(TTR("Zoom factor"));
1845+
zoom_button->set_tooltip_text(
1846+
TTR("Zoom factor") + "\n" + vformat(TTR("%sMouse wheel, %s/%s: Finetune\n%s: Reset"), keycode_get_string((Key)KeyModifierMask::CMD_OR_CTRL), ED_GET_SHORTCUT("script_editor/zoom_in")->get_as_text(), ED_GET_SHORTCUT("script_editor/zoom_out")->get_as_text(), ED_GET_SHORTCUT("script_editor/reset_zoom")->get_as_text()));
18471847
zoom_button->set_text("100 %");
18481848

18491849
PopupMenu *zoom_menu = zoom_button->get_popup();

0 commit comments

Comments
 (0)