| 1845 | } |
| 1846 | |
| 1847 | void CodeTextEditor::set_zoom_factor(float p_zoom_factor) { |
| 1848 | zoom_factor = CLAMP(p_zoom_factor, 0.25f, 3.0f); |
| 1849 | int neutral_font_size = int(EDITOR_GET("interface/editor/code_font_size")) * EDSCALE; |
| 1850 | int new_font_size = Math::round(zoom_factor * neutral_font_size); |
| 1851 | |
| 1852 | zoom_button->set_text(itos(Math::round(zoom_factor * 100)) + " %"); |
| 1853 | |
| 1854 | text_editor->add_theme_font_size_override(SceneStringName(font_size), new_font_size); |
| 1855 | } |
| 1856 | |
| 1857 | float CodeTextEditor::get_zoom_factor() { |
| 1858 | return zoom_factor; |
no test coverage detected