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.
25 lines
834 B
25 lines
834 B
import { Action, MovementActionKind } from "../../tactic/Action"
|
|
import Xarrow, { Xwrapper } from "react-xarrows"
|
|
import { xarrowPropsType } from "react-xarrows/lib/types"
|
|
import BendableArrow from "../../components/arrows/BendableArrow"
|
|
import { middlePos, Pos } from "../../components/arrows/Pos"
|
|
|
|
|
|
export function ActionRender({basePos, action}: {basePos: Pos, action: Action}) {
|
|
|
|
const from = action.moveFrom;
|
|
const to = action.moveTo;
|
|
|
|
const fromPos = document.getElementById(from)!.getBoundingClientRect()
|
|
const toPos = document.getElementById(to)!.getBoundingClientRect()
|
|
|
|
return (
|
|
<BendableArrow
|
|
key={`${action.type}-${from}-${to}`}
|
|
basePos={basePos}
|
|
startPos={middlePos(fromPos)}
|
|
endPos={middlePos(toPos)}
|
|
/>
|
|
)
|
|
}
|