mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
chore: Refactor and remove scene from elbow arrow generation (#8342)
* Refactor and remove scene from elbow arrow generation
This commit is contained in:
parent
72d6ee48fc
commit
dd1370381d
18 changed files with 115 additions and 156 deletions
|
@ -25,6 +25,7 @@ const deleteSelectedElements = (
|
|||
appState: AppState,
|
||||
app: AppClassProperties,
|
||||
) => {
|
||||
const elementsMap = app.scene.getNonDeletedElementsMap();
|
||||
const framesToBeDeleted = new Set(
|
||||
getSelectedElements(
|
||||
elements.filter((el) => isFrameLikeElement(el)),
|
||||
|
@ -51,7 +52,7 @@ const deleteSelectedElements = (
|
|||
? null
|
||||
: bound.endBinding,
|
||||
});
|
||||
mutateElbowArrow(bound, app.scene, bound.points);
|
||||
mutateElbowArrow(bound, elementsMap, bound.points);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -159,7 +160,7 @@ export const actionDeleteSelected = register({
|
|||
LinearElementEditor.deletePoints(
|
||||
element,
|
||||
selectedPointsIndices,
|
||||
app.scene,
|
||||
elementsMap,
|
||||
);
|
||||
|
||||
return {
|
||||
|
|
|
@ -44,7 +44,7 @@ export const actionDuplicateSelection = register({
|
|||
if (appState.editingLinearElement) {
|
||||
const ret = LinearElementEditor.duplicateSelectedPoints(
|
||||
appState,
|
||||
app.scene,
|
||||
app.scene.getNonDeletedElementsMap(),
|
||||
);
|
||||
|
||||
if (!ret) {
|
||||
|
|
|
@ -120,7 +120,6 @@ const flipElements = (
|
|||
true,
|
||||
flipDirection === "horizontal" ? maxX : minX,
|
||||
flipDirection === "horizontal" ? minY : maxY,
|
||||
app.scene,
|
||||
);
|
||||
|
||||
bindOrUnbindLinearElements(
|
||||
|
|
|
@ -58,7 +58,6 @@ export const createUndoAction: ActionCreator = (history, store) => ({
|
|||
arrayToMap(elements) as SceneElementsMap, // TODO: #7348 refactor action manager to already include `SceneElementsMap`
|
||||
appState,
|
||||
store.snapshot,
|
||||
app.scene,
|
||||
),
|
||||
),
|
||||
keyTest: (event) =>
|
||||
|
@ -100,7 +99,6 @@ export const createRedoAction: ActionCreator = (history, store) => ({
|
|||
arrayToMap(elements) as SceneElementsMap, // TODO: #7348 refactor action manager to already include `SceneElementsMap`
|
||||
appState,
|
||||
store.snapshot,
|
||||
app.scene,
|
||||
),
|
||||
),
|
||||
keyTest: (event) =>
|
||||
|
|
|
@ -1648,7 +1648,7 @@ export const actionChangeArrowType = register({
|
|||
|
||||
mutateElbowArrow(
|
||||
newElement,
|
||||
app.scene,
|
||||
elementsMap,
|
||||
[finalStartPoint, finalEndPoint].map(
|
||||
(point) =>
|
||||
[point[0] - newElement.x, point[1] - newElement.y] as Point,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue