|
@@ -10,13 +10,15 @@ import {
|
|
|
import { bindLinearElement } from "./binding";
|
|
|
import { LinearElementEditor } from "./linearElementEditor";
|
|
|
import { newArrowElement, newElement } from "./newElement";
|
|
|
-import type {
|
|
|
- ElementsMap,
|
|
|
- ExcalidrawBindableElement,
|
|
|
- ExcalidrawElement,
|
|
|
- ExcalidrawFlowchartNodeElement,
|
|
|
- NonDeletedSceneElementsMap,
|
|
|
- OrderedExcalidrawElement,
|
|
|
+import type { SceneElementsMap } from "./types";
|
|
|
+import {
|
|
|
+ type ElementsMap,
|
|
|
+ type ExcalidrawBindableElement,
|
|
|
+ type ExcalidrawElement,
|
|
|
+ type ExcalidrawFlowchartNodeElement,
|
|
|
+ type NonDeletedSceneElementsMap,
|
|
|
+ type Ordered,
|
|
|
+ type OrderedExcalidrawElement,
|
|
|
} from "./types";
|
|
|
import { KEYS } from "../keys";
|
|
|
import type { AppState, PendingExcalidrawElements } from "../types";
|
|
@@ -28,9 +30,10 @@ import {
|
|
|
isFrameElement,
|
|
|
isFlowchartNodeElement,
|
|
|
} from "./typeChecks";
|
|
|
-import { invariant } from "../utils";
|
|
|
+import { invariant, toBrandedType } from "../utils";
|
|
|
import { pointFrom, type LocalPoint } from "../../math";
|
|
|
import { aabbForElement } from "../shapes";
|
|
|
+import { updateElbowArrowPoints } from "./elbowArrow";
|
|
|
|
|
|
type LinkDirection = "up" | "right" | "down" | "left";
|
|
|
|
|
@@ -467,7 +470,23 @@ const createBindingArrow = (
|
|
|
},
|
|
|
]);
|
|
|
|
|
|
- return bindingArrow;
|
|
|
+ const update = updateElbowArrowPoints(
|
|
|
+ bindingArrow,
|
|
|
+ toBrandedType<SceneElementsMap>(
|
|
|
+ new Map([
|
|
|
+ ...elementsMap.entries(),
|
|
|
+ [startBindingElement.id, startBindingElement],
|
|
|
+ [endBindingElement.id, endBindingElement],
|
|
|
+ [bindingArrow.id, bindingArrow],
|
|
|
+ ] as [string, Ordered<ExcalidrawElement>][]),
|
|
|
+ ),
|
|
|
+ { points: bindingArrow.points },
|
|
|
+ );
|
|
|
+
|
|
|
+ return {
|
|
|
+ ...bindingArrow,
|
|
|
+ ...update,
|
|
|
+ };
|
|
|
};
|
|
|
|
|
|
export class FlowChartNavigator {
|