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.

(cherry picked from commit e8a326a08f)
This commit is contained in:
Nicholas Huelin 2022-04-08 05:18:43 -04:00 committed by Rémi Verschelde
parent 6bf7e8e010
commit 861c5fe567
1 changed files with 1 additions and 1 deletions

View File

@ -2580,7 +2580,7 @@ void VisualScriptEditor::_center_on_node(const StringName &p_func, int p_id) {
if (gn) { if (gn) {
gn->set_selected(true); gn->set_selected(true);
Vector2 new_scroll = gn->get_offset() - graph->get_size() * 0.5 + gn->get_size() * 0.5; Vector2 new_scroll = gn->get_offset() * graph->get_zoom() - graph->get_size() * 0.5 + gn->get_size() * 0.5;
graph->set_scroll_ofs(new_scroll); graph->set_scroll_ofs(new_scroll);
script->set_function_scroll(p_func, new_scroll / EDSCALE); script->set_function_scroll(p_func, new_scroll / EDSCALE);
script->set_edited(true); script->set_edited(true);