import React, {useEffect, useRef, useState} from "react"; import "../../style/player.css"; import Draggable, {ControlPosition, DraggableBounds} from "react-draggable"; export default function Player({id, x, y, bounds}: { id: number, x: number, y: number, bounds: DraggableBounds }) { const ref = useRef(); useEffect(() => { const playerRect = ref.current?.getBoundingClientRect(); bounds.bottom -= playerRect.height / 2; bounds.right -= playerRect.width / 2; }, [ref]) return (

{id}

) }