diff --git a/src/app/[name]/(Main)/chat/nearby/page.tsx b/src/app/[name]/(Main)/chat/nearby/page.tsx index 84500e4..6b12647 100644 --- a/src/app/[name]/(Main)/chat/nearby/page.tsx +++ b/src/app/[name]/(Main)/chat/nearby/page.tsx @@ -21,7 +21,7 @@ function ChatNearby() { useEffect(() => { if (containerRef.current) { const maxW = containerRef.current.offsetWidth - 50; - const maxH = containerRef.current.offsetHeight - 80; + const maxH = containerRef.current.offsetHeight - 180; const elementSize = 110; // approximate size of each user element const padding = 80; // minimum distance between elements @@ -42,8 +42,8 @@ function ChatNearby() { let tries = 0; do { - top = Math.random() * (maxH - elementSize); - left = Math.random() * (maxW - elementSize); + top = Math.random() * Math.abs(maxH - elementSize); + left = Math.random() * Math.abs(maxW - elementSize); tries++; } while (isTooClose(top, left) && tries < 100); @@ -56,7 +56,7 @@ function ChatNearby() { return ( -
+
s