You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
1.0 KiB
2 lines
1.0 KiB
import{r as h,j as e}from"../../../jsx-runtime-2e2d9038.js";import{PlayerPiece as p}from"./PlayerPiece.tsx-964e2db3.js";import{D as R}from"../../../cjs-ff7eb0e1.js";import{NULL_POS as B,ratioWithinBase as g}from"../arrows/Pos.ts-9fe07952.js";import"../../../index-ca121481.js";function y({player:t,onDrag:n,onChange:s,onRemove:a,courtRef:r,availableActions:c}){const l=t.hasBall,d=t.rightRatio,m=t.bottomRatio,o=h.useRef(null);return e.jsx(R,{handle:".player-piece",nodeRef:o,onDrag:n,position:B,onStop:()=>{const i=o.current.getBoundingClientRect(),u=r.current.getBoundingClientRect(),{x,y:f}=g(i,u);s({id:t.id,rightRatio:x,bottomRatio:f,team:t.team,role:t.role,hasBall:t.hasBall})},children:e.jsx("div",{id:t.id,ref:o,className:"player",style:{position:"absolute",left:`${d*100}%`,top:`${m*100}%`},children:e.jsxs("div",{tabIndex:0,className:"player-content",onKeyUp:i=>{i.key=="Delete"&&a()},children:[e.jsx("div",{className:"player-actions",children:c(o.current)}),e.jsx(p,{team:t.team,text:t.role,hasBall:l})]})})})}export{y as default};
|