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.
This commit is contained in:
2025-09-26 15:22:57 +02:00
parent 192a5c7124
commit c3bf49f301

View File

@@ -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