diff --git a/src/components/App.tsx b/src/components/App.tsx index fd27440a..cec088fd 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -4472,6 +4472,8 @@ class App extends React.Component { } this.eraseElements(pointerDownState); return; + } else if (Object.keys(pointerDownState.elementIdsToErase).length) { + this.restoreReadyToEraseElements(pointerDownState); } if ( @@ -4613,6 +4615,32 @@ class App extends React.Component { }); } + private restoreReadyToEraseElements = ( + pointerDownState: PointerDownState, + ) => { + const elements = this.scene.getElements().map((ele) => { + if ( + pointerDownState.elementIdsToErase[ele.id] && + pointerDownState.elementIdsToErase[ele.id].erase + ) { + return newElementWith(ele, { + opacity: pointerDownState.elementIdsToErase[ele.id].opacity, + }); + } else if ( + isBoundToContainer(ele) && + pointerDownState.elementIdsToErase[ele.containerId] && + pointerDownState.elementIdsToErase[ele.containerId].erase + ) { + return newElementWith(ele, { + opacity: pointerDownState.elementIdsToErase[ele.containerId].opacity, + }); + } + return ele; + }); + + this.scene.replaceAllElements(elements); + }; + private eraseElements = (pointerDownState: PointerDownState) => { const elements = this.scene.getElements().map((ele) => { if (