suspense not needed
All checks were successful
Deploy to Cloudflare Pages / deploy (push) Successful in 28s

This commit is contained in:
christian 2024-11-03 22:41:10 +01:00
parent 86ba372227
commit 521dabe17a

View File

@ -40,20 +40,19 @@ export default function CropSelector() {
const deltaX = newPosition.x - selectorPosition.x; const deltaX = newPosition.x - selectorPosition.x;
const deltaY = newPosition.y - selectorPosition.y; const deltaY = newPosition.y - selectorPosition.y;
setFirstDragable(prev => ({ setFirstDragable({
x: Math.min(firstDragable.x, secondDragable.x) + deltaX, x: Math.min(firstDragable.x, secondDragable.x) + deltaX,
y: Math.min(firstDragable.y, secondDragable.y) + deltaY y: Math.min(firstDragable.y, secondDragable.y) + deltaY
})); });
setSecondDragable(prev => ({ setSecondDragable({
x: Math.max(firstDragable.x, secondDragable.x) + deltaX, x: Math.max(firstDragable.x, secondDragable.x) + deltaX,
y: Math.max(firstDragable.y, secondDragable.y) + deltaY y: Math.max(firstDragable.y, secondDragable.y) + deltaY
})); });
}; };
return ( return (
<div className="flex flex-col h-screen w-screen justify-center items-center"> <div className="flex flex-col h-screen w-screen justify-center items-center">
<Suspense fallback={<p>Loading...</p>}>
<div ref={containerRef} className="relative w-1/3 h-1/3 border-black border"> <div ref={containerRef} className="relative w-1/3 h-1/3 border-black border">
<DragableBox <DragableBox
position={selectorPosition} position={selectorPosition}
@ -71,7 +70,6 @@ export default function CropSelector() {
<PhAngle /> <PhAngle />
</DragableBox> </DragableBox>
</div> </div>
</Suspense>
</div> </div>
); );
} }