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.
This commit is contained in:
@@ -73,6 +73,7 @@ class VideoEditor:
|
|||||||
CROP_SIZE_STEP = 5 # pixels to expand/contract crop
|
CROP_SIZE_STEP = 5 # pixels to expand/contract crop
|
||||||
CROP_MIN_SIZE = 10 # minimum crop width/height in pixels
|
CROP_MIN_SIZE = 10 # minimum crop width/height in pixels
|
||||||
CROP_BORDER_DETECTION_MAX_DISTANCE = 8000 # pixels - maximum distance for border hit detection
|
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
|
# Motion tracking settings
|
||||||
TRACKING_POINT_THRESHOLD = 10 # pixels for delete/snap radius
|
TRACKING_POINT_THRESHOLD = 10 # pixels for delete/snap radius
|
||||||
@@ -3156,6 +3157,11 @@ class VideoEditor:
|
|||||||
dx_r = curr_rx - start_rx
|
dx_r = curr_rx - start_rx
|
||||||
dy_r = curr_ry - start_ry
|
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)
|
# Determine primary direction (horizontal vs vertical)
|
||||||
abs_dx = abs(dx_r)
|
abs_dx = abs(dx_r)
|
||||||
abs_dy = abs(dy_r)
|
abs_dy = abs(dy_r)
|
||||||
|
|||||||
Reference in New Issue
Block a user