summaryrefslogtreecommitdiffstats
path: root/editor
diff options
context:
space:
mode:
authorUnfavorableEnhancer <random.likes.apes@gmail.com>2024-11-04 21:05:11 +0300
committerUnfavorableEnhancer <random.likes.apes@gmail.com>2024-11-11 13:12:09 +0300
commitd9a1e65d5058678dbbd499194fef46c128f59b64 (patch)
tree5d6de43278bdec4ab2b6e1a837e1c3a0f3c5e998 /editor
parent0f5f3bc9546b46b2029fc8896dc859697f1eab97 (diff)
downloadredot-engine-d9a1e65d5058678dbbd499194fef46c128f59b64.tar.gz
fix holding shift not lowering animation snap
Diffstat (limited to 'editor')
-rw-r--r--editor/animation_track_editor.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index bc79b14d4a..cd97d2eb6a 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -7353,16 +7353,17 @@ void AnimationTrackEditor::_update_snap_unit() {
float AnimationTrackEditor::snap_time(float p_value, bool p_relative) {
if (is_snap_keys_enabled()) {
+ double current_snap = snap_unit;
if (Input::get_singleton()->is_key_pressed(Key::SHIFT)) {
// Use more precise snapping when holding Shift.
- snap_unit *= 0.25;
+ current_snap *= 0.25;
}
if (p_relative) {
- double rel = Math::fmod(timeline->get_value(), snap_unit);
- p_value = Math::snapped(p_value + rel, snap_unit) - rel;
+ double rel = Math::fmod(timeline->get_value(), current_snap);
+ p_value = Math::snapped(p_value + rel, current_snap) - rel;
} else {
- p_value = Math::snapped(p_value, snap_unit);
+ p_value = Math::snapped(p_value, current_snap);
}
}