chore: Refactor and remove scene from elbow arrow generation (#8342)

* Refactor and remove scene from elbow arrow generation
This commit is contained in:
Márk Tolmács 2024-08-08 14:06:26 +02:00 committed by GitHub
parent 72d6ee48fc
commit dd1370381d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 115 additions and 156 deletions

View file

@ -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 {

View file

@ -44,7 +44,7 @@ export const actionDuplicateSelection = register({
if (appState.editingLinearElement) {
const ret = LinearElementEditor.duplicateSelectedPoints(
appState,
app.scene,
app.scene.getNonDeletedElementsMap(),
);
if (!ret) {

View file

@ -120,7 +120,6 @@ const flipElements = (
true,
flipDirection === "horizontal" ? maxX : minX,
flipDirection === "horizontal" ? minY : maxY,
app.scene,
);
bindOrUnbindLinearElements(

View file

@ -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) =>

View file

@ -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,