Enhance tracking marker navigation in VideoEditor

This commit improves the navigation logic in the VideoEditor class for jumping to previous and next tracking markers. It ensures that when at the beginning of the tracking frames, the user jumps to the first marker, and when at the end, they jump to the last marker. Debug statements have been updated to reflect these changes, providing clearer insights during navigation. The specification has also been updated to document the new behavior.
This commit is contained in:
2025-09-17 19:55:31 +02:00
parent b123b12d0d
commit 83ef71934b
2 changed files with 13 additions and 7 deletions

View File

@@ -1076,9 +1076,14 @@ class VideoEditor:
return
current = self.current_frame
candidates = [f for f in tracking_frames if f < current]
target = candidates[-1] if candidates else tracking_frames[-1]
print(f"DEBUG: Jump prev tracking from {current} -> {target}; tracking_frames={tracking_frames}")
self.seek_to_frame(target)
if candidates:
target = candidates[-1]
print(f"DEBUG: Jump prev tracking from {current} -> {target}; tracking_frames={tracking_frames}")
self.seek_to_frame(target)
else:
target = tracking_frames[0]
print(f"DEBUG: Jump prev tracking to first marker from {current} -> {target}; tracking_frames={tracking_frames}")
self.seek_to_frame(target)
def jump_to_next_marker(self):
"""Jump to the next tracking marker (frame with tracking points)."""
@@ -1095,8 +1100,9 @@ class VideoEditor:
print(f"DEBUG: Jump next tracking from {current} -> {f}; tracking_frames={tracking_frames}")
self.seek_to_frame(f)
return
print(f"DEBUG: Jump next tracking wrap from {current} -> {tracking_frames[0]}; tracking_frames={tracking_frames}")
self.seek_to_frame(tracking_frames[0])
target = tracking_frames[-1]
print(f"DEBUG: Jump next tracking to last marker from {current} -> {target}; tracking_frames={tracking_frames}")
self.seek_to_frame(target)
def _get_previous_tracking_point(self):
"""Get the tracking point from the previous frame that has tracking points."""