mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
[skip ci] Binding refactor
This commit is contained in:
parent
76a782bd52
commit
ce10087edc
1 changed files with 9 additions and 19 deletions
|
@ -223,13 +223,17 @@ const bindOrUnbindLinearElementEdge = (
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getOriginalBindingIfStillCloseOfLinearElementEdge = (
|
const getOriginalBindingsIfStillCloseToArrowEnds = (
|
||||||
linearElement: NonDeleted<ExcalidrawLinearElement>,
|
linearElement: NonDeleted<ExcalidrawLinearElement>,
|
||||||
edge: "start" | "end",
|
|
||||||
elementsMap: NonDeletedSceneElementsMap,
|
elementsMap: NonDeletedSceneElementsMap,
|
||||||
zoom?: AppState["zoom"],
|
zoom?: AppState["zoom"],
|
||||||
): NonDeleted<ExcalidrawElement> | null => {
|
): (NonDeleted<ExcalidrawElement> | null)[] =>
|
||||||
const coors = getLinearElementEdgeCoors(linearElement, edge, elementsMap);
|
["start", "end"].map((edge) => {
|
||||||
|
const coors = getLinearElementEdgeCoors(
|
||||||
|
linearElement,
|
||||||
|
edge as "start" | "end",
|
||||||
|
elementsMap,
|
||||||
|
);
|
||||||
const elementId =
|
const elementId =
|
||||||
edge === "start"
|
edge === "start"
|
||||||
? linearElement.startBinding?.elementId
|
? linearElement.startBinding?.elementId
|
||||||
|
@ -245,21 +249,7 @@ const getOriginalBindingIfStillCloseOfLinearElementEdge = (
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
});
|
||||||
|
|
||||||
const getOriginalBindingsIfStillCloseToArrowEnds = (
|
|
||||||
linearElement: NonDeleted<ExcalidrawLinearElement>,
|
|
||||||
elementsMap: NonDeletedSceneElementsMap,
|
|
||||||
zoom?: AppState["zoom"],
|
|
||||||
): (NonDeleted<ExcalidrawElement> | null)[] =>
|
|
||||||
["start", "end"].map((edge) =>
|
|
||||||
getOriginalBindingIfStillCloseOfLinearElementEdge(
|
|
||||||
linearElement,
|
|
||||||
edge as "start" | "end",
|
|
||||||
elementsMap,
|
|
||||||
zoom,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
const getBindingStrategyForDraggingArrowEndpoints = (
|
const getBindingStrategyForDraggingArrowEndpoints = (
|
||||||
selectedElement: NonDeleted<ExcalidrawLinearElement>,
|
selectedElement: NonDeleted<ExcalidrawLinearElement>,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue