diff --git a/src/editor/PlayerDomains.ts b/src/editor/PlayerDomains.ts index 3168b8d..0473d72 100644 --- a/src/editor/PlayerDomains.ts +++ b/src/editor/PlayerDomains.ts @@ -94,17 +94,27 @@ export function computePhantomPositioning( const segments = action.segments const lastSegment = segments[segments.length - 1] const lastSegmentStart = segments[segments.length - 2]?.next - const pivotPoint = - lastSegment.controlPoint ?? - (lastSegmentStart - ? typeof lastSegmentStart === "string" - ? document - .getElementById(lastSegmentStart)! - .getBoundingClientRect() - : lastSegmentStart - : playerBeforePhantom.type === "phantom" - ? computePhantomPositioning(playerBeforePhantom, content, area) - : playerBeforePhantom.pos) + let pivotPoint = lastSegment.controlPoint + + if (!pivotPoint) { + if (lastSegmentStart) { + pivotPoint = + typeof lastSegmentStart === "string" + ? document + .getElementById(lastSegmentStart)! + .getBoundingClientRect() + : lastSegmentStart + } else { + pivotPoint = + playerBeforePhantom.type === "phantom" + ? computePhantomPositioning( + playerBeforePhantom, + content, + area, + ) + : playerBeforePhantom.pos + } + } const segment = posWithinBase(relativeTo(referentPos, pivotPoint), area) const segmentLength = norm(segment) diff --git a/src/model/tactic/Player.ts b/src/model/tactic/Player.ts index a22eaee..2dee897 100644 --- a/src/model/tactic/Player.ts +++ b/src/model/tactic/Player.ts @@ -10,10 +10,6 @@ export enum PlayerTeam { Opponents = "opponents", } -export interface Player extends PlayerInfo, Component<"player", Pos> { - readonly id: PlayerId -} - /** * All information about a player */