fix: chat radar items positioning

This commit is contained in:
Mahyar Khanbolooki
2025-08-02 21:15:20 +03:30
parent 99e66e3cae
commit 9a39c84116
+4 -4
View File
@@ -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 (
<section ref={containerRef} className="h-full relative">
<section ref={containerRef} className="h-svh relative">s
<section className="relative h-full w-full mt-7">
<motion.div
className='size-[1145px] rounded-full fixed top-1/2 left-1/2 -translate-1/2'