From 53549ebee91091c3cd52465bfc4bd7400fa06dff Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Tue, 23 Dec 2025 09:40:55 +0100 Subject: [PATCH] Add minimum drag distance for crop adjustments in VideoEditor class Introduce a new constant, CROP_DRAG_MIN_DISTANCE, to define the minimum drag distance required before applying crop adjustments. This enhancement improves the responsiveness of the crop border dragging functionality, ensuring that minor movements do not trigger unintended adjustments. --- croppa/main.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/croppa/main.py b/croppa/main.py index 334a4fe..6357759 100644 --- a/croppa/main.py +++ b/croppa/main.py @@ -73,6 +73,7 @@ class VideoEditor: CROP_SIZE_STEP = 5 # pixels to expand/contract crop CROP_MIN_SIZE = 10 # minimum crop width/height in pixels CROP_BORDER_DETECTION_MAX_DISTANCE = 8000 # pixels - maximum distance for border hit detection + CROP_DRAG_MIN_DISTANCE = 10 # pixels - minimum drag distance before applying crop adjustment # Motion tracking settings TRACKING_POINT_THRESHOLD = 10 # pixels for delete/snap radius @@ -3156,6 +3157,11 @@ class VideoEditor: dx_r = curr_rx - start_rx dy_r = curr_ry - start_ry + # Check minimum drag distance + drag_distance = (dx_r ** 2 + dy_r ** 2) ** 0.5 + if drag_distance < self.CROP_DRAG_MIN_DISTANCE: + return + # Determine primary direction (horizontal vs vertical) abs_dx = abs(dx_r) abs_dy = abs(dy_r)