From c3bf49f30130474e2ee367e81128ed178bc7d9fc Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Fri, 26 Sep 2025 15:22:57 +0200 Subject: [PATCH] Implement fullscreen scaling for video display in VideoEditor This commit adds functionality to scale down the video display when in fullscreen mode if the video dimensions exceed the available screen size. This enhancement ensures that videos are properly displayed within the window dimensions, improving user experience during video editing. --- croppa/main.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/croppa/main.py b/croppa/main.py index ad40cca..8a7d97d 100644 --- a/croppa/main.py +++ b/croppa/main.py @@ -2906,6 +2906,18 @@ class VideoEditor: # Center the frame on canvas frame_height, frame_width = display_frame.shape[:2] available_height = self.window_height - (0 if self.is_image_mode else self.TIMELINE_HEIGHT) + + # Simple fullscreen fix: scale down if video is too large for screen + if self.is_fullscreen and (frame_height > available_height or frame_width > self.window_width): + scale_x = self.window_width / frame_width + scale_y = available_height / frame_height + scale = min(scale_x, scale_y) + if scale < 1.0: + new_width = int(frame_width * scale) + new_height = int(frame_height * scale) + display_frame = cv2.resize(display_frame, (new_width, new_height), interpolation=cv2.INTER_LINEAR) + frame_height, frame_width = display_frame.shape[:2] + start_y = (available_height - frame_height) // 2 start_x = (self.window_width - frame_width) // 2