diff --git a/croppa/main.py b/croppa/main.py index 36570ea..10c30b5 100644 --- a/croppa/main.py +++ b/croppa/main.py @@ -2262,11 +2262,22 @@ class VideoEditor: original_height, original_width = self.current_display_frame.shape[:2] available_height = self.window_height - (0 if self.is_image_mode else self.TIMELINE_HEIGHT) - # Step 1: Apply crop (subtract crop offset) + # Step 1: Apply crop (subtract crop offset, including motion tracking offset) display_x = video_x display_y = video_y if self.crop_rect: crop_x, crop_y, crop_w, crop_h = self.crop_rect + + # Apply motion tracking offset if enabled + if self.motion_tracker.tracking_enabled: + current_pos = self.motion_tracker.get_interpolated_position(self.current_frame) + if current_pos: + # Move crop center to tracked point (same logic as in apply_crop_zoom_and_rotation) + tracked_x, tracked_y = current_pos + new_x = int(tracked_x - crop_w // 2) + new_y = int(tracked_y - crop_h // 2) + crop_x, crop_y = new_x, new_y + display_x -= crop_x display_y -= crop_y