From e8a326a08fa334eb54a5a1ff09722caf90c160d8 Mon Sep 17 00:00:00 2001 From: Nicholas Huelin <62965063+SirQuartz@users.noreply.github.com> Date: Fri, 8 Apr 2022 05:18:43 -0400 Subject: [PATCH] Fix Visual Script's jump to function relative to zoom When double-clicking on a function name the graph will now correctly jump to the function relative to the zoom ratio. --- modules/visual_script/editor/visual_script_editor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/visual_script/editor/visual_script_editor.cpp b/modules/visual_script/editor/visual_script_editor.cpp index a2e59c9cdfd..495303d6c4f 100644 --- a/modules/visual_script/editor/visual_script_editor.cpp +++ b/modules/visual_script/editor/visual_script_editor.cpp @@ -2727,7 +2727,7 @@ void VisualScriptEditor::_center_on_node(int p_id) { if (gn) { gn->set_selected(true); - Vector2 new_scroll = gn->get_position_offset() - graph->get_size() * 0.5 + gn->get_size() * 0.5; + Vector2 new_scroll = gn->get_position_offset() * graph->get_zoom() - graph->get_size() * 0.5 + gn->get_size() * 0.5; graph->set_scroll_ofs(new_scroll); script->set_scroll(new_scroll / EDSCALE); script->set_edited(true);