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.
30 lines
804 B
30 lines
804 B
import { Action } from "../../tactic/Action"
|
|
import BendableArrow from "../../components/arrows/BendableArrow"
|
|
import { RefObject } from "react"
|
|
|
|
export interface CourtActionProps {
|
|
action: Action
|
|
onActionChanges: (a: Action) => void
|
|
courtRef: RefObject<HTMLElement>
|
|
}
|
|
|
|
export function CourtAction({
|
|
action,
|
|
onActionChanges,
|
|
courtRef,
|
|
}: CourtActionProps) {
|
|
return (
|
|
<BendableArrow
|
|
area={courtRef}
|
|
startPos={action.moveFrom}
|
|
segments={action.segments}
|
|
onSegmentsChanges={(edges) => {
|
|
onActionChanges({ ...action, segments: edges })
|
|
}}
|
|
//TODO place those magic values in constants
|
|
endRadius={action.toPlayerId ? 26 : 17}
|
|
startRadius={26}
|
|
/>
|
|
)
|
|
}
|