summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-11-16 22:54:17 +0100
committerGitHub <noreply@github.com>2019-11-16 22:54:17 +0100
commitc9782b0e97b4df764b0b9cfe443f6a261dc9b540 (patch)
treea498a99b69cb44de3473d41a48de34cca9103f92 /scene
parentf392c4ea7a778db6c5c73a1c6b9348b84707ee81 (diff)
parent72b31aafc4449f7b6838c3be7527bc3fe287ac49 (diff)
Merge pull request #33645 from Calinou/graphedit-ctrl-toggle-snapping
Make holding Ctrl toggle snapping in GraphEdit
Diffstat (limited to 'scene')
-rw-r--r--scene/gui/graph_edit.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index 7827c66841..ed9fc0ce51 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -819,8 +819,11 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
if (gn && gn->is_selected()) {
Vector2 pos = (gn->get_drag_from() * zoom + drag_accum) / zoom;
- if (is_using_snap()) {
- int snap = get_snap();
+
+ // Snapping can be toggled temporarily by holding down Ctrl.
+ // This is done here as to not toggle the grid when holding down Ctrl.
+ if (is_using_snap() ^ Input::get_singleton()->is_key_pressed(KEY_CONTROL)) {
+ const int snap = get_snap();
pos = pos.snapped(Vector2(snap, snap));
}