mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: remove scene from getElementAbsoluteCoords and dependent functions and use elementsMap (#7663)
* fix: remove scene from getElementAbsoluteCoords and dependent functions and use elementsMap * lint * fix * use non deleted elements where possible * use non deleted elements map in actions * pass elementsMap instead of array to elementOverlapsWithFrame * lint * fix * pass elementsMap to getElementsCorners * pass elementsMap to getEligibleElementsForBinding * pass elementsMap in bindOrUnbindSelectedElements and unbindLinearElements * pass elementsMap in elementsAreInFrameBounds,elementOverlapsWithFrame,isCursorInFrame,getElementsInResizingFrame * pass elementsMap in getElementsWithinSelection, getElementsCompletelyInFrame, isElementContainingFrame, getElementsInNewFrame * pass elementsMap to getElementWithTransformHandleType * pass elementsMap to getVisibleGaps, getMaximumGroups,getReferenceSnapPoints,snapDraggedElements * lint * pass elementsMap to bindTextToShapeAfterDuplication,bindLinearElementToElement,getTextBindableContainerAtPosition * revert changes for bindTextToShapeAfterDuplication
This commit is contained in:
parent
73bf50e8a8
commit
47f87f4ecb
36 changed files with 779 additions and 270 deletions
|
@ -222,7 +222,7 @@ const bindTextToContainer = (
|
|||
}),
|
||||
});
|
||||
|
||||
redrawTextBoundingBox(textElement, container);
|
||||
redrawTextBoundingBox(textElement, container, elementsMap);
|
||||
return [container, textElement] as const;
|
||||
};
|
||||
|
||||
|
@ -231,6 +231,7 @@ const bindLinearElementToElement = (
|
|||
start: ValidLinearElement["start"],
|
||||
end: ValidLinearElement["end"],
|
||||
elementStore: ElementStore,
|
||||
elementsMap: ElementsMap,
|
||||
): {
|
||||
linearElement: ExcalidrawLinearElement;
|
||||
startBoundElement?: ExcalidrawElement;
|
||||
|
@ -316,6 +317,7 @@ const bindLinearElementToElement = (
|
|||
linearElement,
|
||||
startBoundElement as ExcalidrawBindableElement,
|
||||
"start",
|
||||
elementsMap,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -390,6 +392,7 @@ const bindLinearElementToElement = (
|
|||
linearElement,
|
||||
endBoundElement as ExcalidrawBindableElement,
|
||||
"end",
|
||||
elementsMap,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -612,6 +615,7 @@ export const convertToExcalidrawElements = (
|
|||
}
|
||||
}
|
||||
|
||||
const elementsMap = arrayToMap(elementStore.getElements());
|
||||
// Add labels and arrow bindings
|
||||
for (const [id, element] of elementsWithIds) {
|
||||
const excalidrawElement = elementStore.getElement(id)!;
|
||||
|
@ -625,7 +629,7 @@ export const convertToExcalidrawElements = (
|
|||
let [container, text] = bindTextToContainer(
|
||||
excalidrawElement,
|
||||
element?.label,
|
||||
arrayToMap(elementStore.getElements()),
|
||||
elementsMap,
|
||||
);
|
||||
elementStore.add(container);
|
||||
elementStore.add(text);
|
||||
|
@ -653,6 +657,7 @@ export const convertToExcalidrawElements = (
|
|||
originalStart,
|
||||
originalEnd,
|
||||
elementStore,
|
||||
elementsMap,
|
||||
);
|
||||
container = linearElement;
|
||||
elementStore.add(linearElement);
|
||||
|
@ -677,6 +682,7 @@ export const convertToExcalidrawElements = (
|
|||
start,
|
||||
end,
|
||||
elementStore,
|
||||
elementsMap,
|
||||
);
|
||||
|
||||
elementStore.add(linearElement);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue