remove redundant code
This commit is contained in:
parent
34cf71b0f4
commit
47d8fa542c
13
src/frame.ts
13
src/frame.ts
@ -370,7 +370,7 @@ export const getContainingFrame = (
|
|||||||
// --------------------------- Frame Operations -------------------------------
|
// --------------------------- Frame Operations -------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retains (or repairs for target frame) the ordering invriant where children
|
* Retains (or repairs for target frame) the ordering invariant where children
|
||||||
* elements come right before the parent frame:
|
* elements come right before the parent frame:
|
||||||
* [el, el, child, child, frame, el]
|
* [el, el, child, child, frame, el]
|
||||||
*/
|
*/
|
||||||
@ -437,25 +437,14 @@ export const removeElementsFromFrame = (
|
|||||||
ExcalidrawElement
|
ExcalidrawElement
|
||||||
>();
|
>();
|
||||||
|
|
||||||
const toRemoveElementsByFrame = new Map<
|
|
||||||
ExcalidrawFrameElement["id"],
|
|
||||||
ExcalidrawElement[]
|
|
||||||
>();
|
|
||||||
|
|
||||||
for (const element of elementsToRemove) {
|
for (const element of elementsToRemove) {
|
||||||
if (element.frameId) {
|
if (element.frameId) {
|
||||||
_elementsToRemove.set(element.id, element);
|
_elementsToRemove.set(element.id, element);
|
||||||
|
|
||||||
const arr = toRemoveElementsByFrame.get(element.frameId) || [];
|
|
||||||
arr.push(element);
|
|
||||||
|
|
||||||
const boundTextElement = getBoundTextElement(element);
|
const boundTextElement = getBoundTextElement(element);
|
||||||
if (boundTextElement) {
|
if (boundTextElement) {
|
||||||
_elementsToRemove.set(boundTextElement.id, boundTextElement);
|
_elementsToRemove.set(boundTextElement.id, boundTextElement);
|
||||||
arr.push(boundTextElement);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
toRemoveElementsByFrame.set(element.frameId, arr);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user