From 3367c19b9c77cd93e4295544a1b1fe1be0bcfca4 Mon Sep 17 00:00:00 2001 From: dnesov Date: Sun, 16 Feb 2025 22:15:16 +0100 Subject: [PATCH] Out of bounds correction on audio clip movement --- Scripts/AudioClip.gd | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Scripts/AudioClip.gd b/Scripts/AudioClip.gd index 33a27fb..5196e5e 100644 --- a/Scripts/AudioClip.gd +++ b/Scripts/AudioClip.gd @@ -60,9 +60,10 @@ func _input(event): if track != -1: track_idx = track + var clip_length = end_time - start_time + if event.is_command_or_control_pressed(): if not was_snapping: - var clip_length = end_time - start_time start_time = snapped(start_time, timeline.time_interval) end_time = start_time + clip_length accumulated_movement = 0 @@ -73,12 +74,16 @@ func _input(event): if snapped_movement != 0: if start_time + snapped_movement < 0: + start_time = 0 + end_time = start_time + clip_length return start_time += snapped_movement end_time += snapped_movement accumulated_movement -= snapped_movement else: if start_time + movement_time < 0: + start_time = 0 + end_time = start_time + clip_length return start_time += movement_time end_time += movement_time