diff --git a/app/routes/DragableBox.tsx b/app/routes/DragableBox.tsx index aabf442..e2138e2 100644 --- a/app/routes/DragableBox.tsx +++ b/app/routes/DragableBox.tsx @@ -34,13 +34,12 @@ const DraggableBox = ({ const parent = dragRef.current.parentElement; const parentRect = parent.getBoundingClientRect(); - const boxRect = dragRef.current.getBoundingClientRect(); const relativeX = e.clientX - parentRect.left - dragOffset.x; const relativeY = e.clientY - parentRect.top - dragOffset.y; - const maxX = parentRect.width - boxRect.width; - const maxY = parentRect.height - boxRect.height; + const maxX = parentRect.width; + const maxY = parentRect.height; let newX = (Math.max(0, Math.min(relativeX, maxX))); let newY = (Math.max(0, Math.min(relativeY, maxY)));