import React, { useRef } from "react" import Draggable from "react-draggable" import { BallPiece, CourtBallProps } from "./BallPiece" export function CourtBall({ onMoved, ball, onRemove }: CourtBallProps) { const pieceRef = useRef(null) const x = ball.rightRatio const y = ball.bottomRatio return ( onMoved(pieceRef.current!.getBoundingClientRect())} nodeRef={pieceRef}>
{ if (e.key == "Delete") onRemove() }} style={{ position: "absolute", left: `${x * 100}%`, top: `${y * 100}%`, }}>
) }