Refactor tracking point management in VideoEditor and MotionTracker to ensure accurate display coordinates
This commit modifies the handling of tracking points in the VideoEditor and MotionTracker classes by removing the storage of display coordinates. Instead, display coordinates are now calculated dynamically during rendering, ensuring accuracy regardless of crop or rotation states. The changes enhance the consistency of point transformations and improve logging for better debugging and verification of coordinate accuracy during mouse interactions.
This commit is contained in:
@@ -21,20 +21,19 @@ class MotionTracker:
|
||||
self.base_crop_rect = None # Original crop rect when tracking started
|
||||
self.base_zoom_center = None # Original zoom center when tracking started
|
||||
|
||||
def add_tracking_point(self, frame_number: int, x: float, y: float, display_coords: Optional[Tuple[float, float]] = None):
|
||||
def add_tracking_point(self, frame_number: int, x: float, y: float):
|
||||
"""Add a tracking point at the specified frame and coordinates
|
||||
|
||||
Args:
|
||||
frame_number: The frame number to add the point to
|
||||
x: Original x coordinate
|
||||
y: Original y coordinate
|
||||
display_coords: Optional display coordinates after transformation
|
||||
"""
|
||||
if frame_number not in self.tracking_points:
|
||||
self.tracking_points[frame_number] = []
|
||||
|
||||
# Store both original and display coordinates
|
||||
point = TrackingPoint(original=(float(x), float(y)), display=display_coords)
|
||||
# Store only the original coordinates - display coordinates will be calculated fresh each time
|
||||
point = TrackingPoint(original=(float(x), float(y)))
|
||||
print(f"Adding tracking point: {point}")
|
||||
self.tracking_points[frame_number].append(point)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user