fix: chat radar items positioning
This commit is contained in:
@@ -21,7 +21,7 @@ function ChatNearby() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (containerRef.current) {
|
if (containerRef.current) {
|
||||||
const maxW = containerRef.current.offsetWidth - 50;
|
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 elementSize = 110; // approximate size of each user element
|
||||||
const padding = 80; // minimum distance between elements
|
const padding = 80; // minimum distance between elements
|
||||||
|
|
||||||
@@ -42,8 +42,8 @@ function ChatNearby() {
|
|||||||
let tries = 0;
|
let tries = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
top = Math.random() * (maxH - elementSize);
|
top = Math.random() * Math.abs(maxH - elementSize);
|
||||||
left = Math.random() * (maxW - elementSize);
|
left = Math.random() * Math.abs(maxW - elementSize);
|
||||||
tries++;
|
tries++;
|
||||||
} while (isTooClose(top, left) && tries < 100);
|
} while (isTooClose(top, left) && tries < 100);
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ function ChatNearby() {
|
|||||||
|
|
||||||
|
|
||||||
return (
|
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">
|
<section className="relative h-full w-full mt-7">
|
||||||
<motion.div
|
<motion.div
|
||||||
className='size-[1145px] rounded-full fixed top-1/2 left-1/2 -translate-1/2'
|
className='size-[1145px] rounded-full fixed top-1/2 left-1/2 -translate-1/2'
|
||||||
|
|||||||
Reference in New Issue
Block a user