diff --git a/app/routes/CropSelector.tsx b/app/routes/CropSelector.tsx index 12c3325..46efbe4 100644 --- a/app/routes/CropSelector.tsx +++ b/app/routes/CropSelector.tsx @@ -40,38 +40,36 @@ export default function CropSelector() { const deltaX = newPosition.x - selectorPosition.x; const deltaY = newPosition.y - selectorPosition.y; - setFirstDragable(prev => ({ + setFirstDragable({ x: Math.min(firstDragable.x, secondDragable.x) + deltaX, y: Math.min(firstDragable.y, secondDragable.y) + deltaY - })); + }); - setSecondDragable(prev => ({ + setSecondDragable({ x: Math.max(firstDragable.x, secondDragable.x) + deltaX, y: Math.max(firstDragable.y, secondDragable.y) + deltaY - })); + }); }; return (