Enhance VideoEditor mouse wheel functionality for zoom and frame seeking

This commit updates the mouse wheel event handling in the VideoEditor class to allow for zooming in and out with Ctrl+scroll, while enabling frame seeking with plain scroll. The specification has been updated to reflect the new mouse wheel behavior, improving user navigation and control during video editing.
This commit is contained in:
2025-09-17 11:49:25 +02:00
parent b90b5e5725
commit fbac3b0dbb
3 changed files with 12 additions and 216 deletions

View File

@@ -2175,18 +2175,18 @@ class VideoEditor:
self.clear_transformation_cache()
self.save_state()
# Handle scroll wheel for zoom (Ctrl + scroll)
if flags & cv2.EVENT_FLAG_CTRLKEY:
if event == cv2.EVENT_MOUSEWHEEL:
if flags > 0: # Scroll up
self.zoom_factor = min(
self.MAX_ZOOM, self.zoom_factor + self.ZOOM_INCREMENT
)
else: # Scroll down
self.zoom_factor = max(
self.MIN_ZOOM, self.zoom_factor - self.ZOOM_INCREMENT
)
# Handle scroll wheel: Ctrl+scroll -> zoom; plain scroll -> seek ±1 frame (independent of multiplier)
if event == cv2.EVENT_MOUSEWHEEL:
if flags & cv2.EVENT_FLAG_CTRLKEY:
if flags > 0: # Scroll up -> zoom in
self.zoom_factor = min(self.MAX_ZOOM, self.zoom_factor + self.ZOOM_INCREMENT)
else: # Scroll down -> zoom out
self.zoom_factor = max(self.MIN_ZOOM, self.zoom_factor - self.ZOOM_INCREMENT)
self.clear_transformation_cache()
else:
if not self.is_image_mode:
direction = 1 if flags > 0 else -1
self.seek_video_exact_frame(direction)
def set_crop_from_screen_coords(self, screen_rect):
"""Convert screen coordinates to video frame coordinates and set crop"""