Browse Source

Fix zoom display in the script editor on hiDPI displays

Hugo Locurcio 7 years ago
parent
commit
cbe9597021
1 changed files with 2 additions and 2 deletions
  1. 2 2
      editor/code_editor.cpp

+ 2 - 2
editor/code_editor.cpp

@@ -745,7 +745,7 @@ bool CodeTextEditor::_add_font_size(int p_delta) {
 	if (font.is_valid()) {
 	if (font.is_valid()) {
 		int new_size = CLAMP(font->get_size() + p_delta, 8 * EDSCALE, 96 * EDSCALE);
 		int new_size = CLAMP(font->get_size() + p_delta, 8 * EDSCALE, 96 * EDSCALE);
 
 
-		zoom_nb->set_text(itos(100 * new_size / 14) + "%");
+		zoom_nb->set_text(itos(100 * new_size / (14 * EDSCALE)) + "%");
 
 
 		if (new_size != font->get_size()) {
 		if (new_size != font->get_size()) {
 			EditorSettings::get_singleton()->set("interface/editor/code_font_size", new_size / EDSCALE);
 			EditorSettings::get_singleton()->set("interface/editor/code_font_size", new_size / EDSCALE);
@@ -1318,7 +1318,7 @@ CodeTextEditor::CodeTextEditor() {
 
 
 	font_resize_val = 0;
 	font_resize_val = 0;
 	font_size = EditorSettings::get_singleton()->get("interface/editor/code_font_size");
 	font_size = EditorSettings::get_singleton()->get("interface/editor/code_font_size");
-	zoom_nb->set_text(itos(100 * font_size / 14) + "%");
+	zoom_nb->set_text(itos(100 * font_size / (14 * EDSCALE)) + "%");
 	font_resize_timer = memnew(Timer);
 	font_resize_timer = memnew(Timer);
 	add_child(font_resize_timer);
 	add_child(font_resize_timer);
 	font_resize_timer->set_one_shot(true);
 	font_resize_timer->set_one_shot(true);