Out of bounds correction on audio clip movement

This commit is contained in:
2025-02-16 22:15:16 +01:00
parent 7301a65acd
commit 3367c19b9c

View File

@@ -60,9 +60,10 @@ func _input(event):
if track != -1: if track != -1:
track_idx = track track_idx = track
var clip_length = end_time - start_time
if event.is_command_or_control_pressed(): if event.is_command_or_control_pressed():
if not was_snapping: if not was_snapping:
var clip_length = end_time - start_time
start_time = snapped(start_time, timeline.time_interval) start_time = snapped(start_time, timeline.time_interval)
end_time = start_time + clip_length end_time = start_time + clip_length
accumulated_movement = 0 accumulated_movement = 0
@@ -73,12 +74,16 @@ func _input(event):
if snapped_movement != 0: if snapped_movement != 0:
if start_time + snapped_movement < 0: if start_time + snapped_movement < 0:
start_time = 0
end_time = start_time + clip_length
return return
start_time += snapped_movement start_time += snapped_movement
end_time += snapped_movement end_time += snapped_movement
accumulated_movement -= snapped_movement accumulated_movement -= snapped_movement
else: else:
if start_time + movement_time < 0: if start_time + movement_time < 0:
start_time = 0
end_time = start_time + clip_length
return return
start_time += movement_time start_time += movement_time
end_time += movement_time end_time += movement_time