1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

fix holding shift not lowering animation snap

This commit is contained in:
UnfavorableEnhancer
2024-11-04 21:05:11 +03:00
parent 0f5f3bc954
commit d9a1e65d50

View File

@@ -7353,16 +7353,17 @@ void AnimationTrackEditor::_update_snap_unit() {
float AnimationTrackEditor::snap_time(float p_value, bool p_relative) { float AnimationTrackEditor::snap_time(float p_value, bool p_relative) {
if (is_snap_keys_enabled()) { if (is_snap_keys_enabled()) {
double current_snap = snap_unit;
if (Input::get_singleton()->is_key_pressed(Key::SHIFT)) { if (Input::get_singleton()->is_key_pressed(Key::SHIFT)) {
// Use more precise snapping when holding Shift. // Use more precise snapping when holding Shift.
snap_unit *= 0.25; current_snap *= 0.25;
} }
if (p_relative) { if (p_relative) {
double rel = Math::fmod(timeline->get_value(), snap_unit); double rel = Math::fmod(timeline->get_value(), current_snap);
p_value = Math::snapped(p_value + rel, snap_unit) - rel; p_value = Math::snapped(p_value + rel, current_snap) - rel;
} else { } else {
p_value = Math::snapped(p_value, snap_unit); p_value = Math::snapped(p_value, current_snap);
} }
} }