summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Huelin <62965063+SirQuartz@users.noreply.github.com>2022-04-08 05:18:43 -0400
committerRĂ©mi Verschelde <rverschelde@gmail.com>2022-04-12 15:27:49 +0200
commite8a326a08fa334eb54a5a1ff09722caf90c160d8 (patch)
tree32df97eb7c7326ee5605c597d85600ac60ae758b
parent43f94c95aa88d5fc0180bb4ee5c8ce44d27dbc0f (diff)
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.
-rw-r--r--modules/visual_script/editor/visual_script_editor.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/visual_script/editor/visual_script_editor.cpp b/modules/visual_script/editor/visual_script_editor.cpp
index a2e59c9cdf..495303d6c4 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);