Increase window dimensions in ProjectView and VideoEditor to accommodate 1080p videos. Adjust resizing logic to maintain original video quality by resizing the window instead of downscaling the video. Ensure frames fit within canvas bounds for better display.
This commit is contained in:
@@ -109,8 +109,8 @@ class ProjectView:
|
||||
self.selected_index = 0
|
||||
self.scroll_offset = 0
|
||||
self.items_per_row = 2 # Default to 2 items per row
|
||||
self.window_width = 1200
|
||||
self.window_height = 800
|
||||
self.window_width = 1920 # Increased to accommodate 1080p videos
|
||||
self.window_height = 1200
|
||||
|
||||
self._load_video_files()
|
||||
self._load_progress_data()
|
||||
@@ -511,8 +511,8 @@ class VideoEditor:
|
||||
# Mouse and keyboard interaction
|
||||
self.mouse_dragging = False
|
||||
self.timeline_rect = None
|
||||
self.window_width = 1200
|
||||
self.window_height = 800
|
||||
self.window_width = 1920 # Increased to accommodate 1080p videos
|
||||
self.window_height = 1200
|
||||
|
||||
# Auto-repeat seeking state
|
||||
self.auto_repeat_active = False
|
||||
@@ -1872,23 +1872,39 @@ class VideoEditor:
|
||||
height, width = display_frame.shape[:2]
|
||||
available_height = self.window_height - (0 if self.is_image_mode else self.TIMELINE_HEIGHT)
|
||||
|
||||
# Don't downscale - keep original video quality
|
||||
# If video is larger than window, we'll handle it by resizing the window
|
||||
scale = min(self.window_width / width, available_height / height)
|
||||
if scale < 1.0:
|
||||
new_width = int(width * scale)
|
||||
new_height = int(height * scale)
|
||||
display_frame = cv2.resize(display_frame, (new_width, new_height))
|
||||
# Resize window to fit video instead of downscaling video
|
||||
new_window_width = int(width * 1.1) # Add 10% padding
|
||||
new_window_height = int(height * 1.1) + (0 if self.is_image_mode else self.TIMELINE_HEIGHT)
|
||||
|
||||
# Update window size
|
||||
self.window_width = new_window_width
|
||||
self.window_height = new_window_height
|
||||
|
||||
# Resize the OpenCV window
|
||||
window_title = "Image Editor" if self.is_image_mode else "Video Editor"
|
||||
cv2.resizeWindow(window_title, self.window_width, self.window_height)
|
||||
|
||||
# Create canvas with timeline space
|
||||
canvas = np.zeros((self.window_height, self.window_width, 3), dtype=np.uint8)
|
||||
|
||||
# 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)
|
||||
start_y = (available_height - frame_height) // 2
|
||||
start_x = (self.window_width - frame_width) // 2
|
||||
|
||||
canvas[start_y : start_y + frame_height, start_x : start_x + frame_width] = (
|
||||
display_frame
|
||||
)
|
||||
# Ensure frame fits within canvas bounds
|
||||
end_y = min(start_y + frame_height, available_height)
|
||||
end_x = min(start_x + frame_width, self.window_width)
|
||||
actual_frame_height = end_y - start_y
|
||||
actual_frame_width = end_x - start_x
|
||||
|
||||
if actual_frame_height > 0 and actual_frame_width > 0:
|
||||
canvas[start_y:end_y, start_x:end_x] = display_frame[:actual_frame_height, :actual_frame_width]
|
||||
|
||||
# Draw crop selection preview during Shift+Click+Drag
|
||||
if self.crop_preview_rect:
|
||||
|
Reference in New Issue
Block a user