From e97c3704eb8c6f66d3028d4e8d53f70f742e3747 Mon Sep 17 00:00:00 2001 From: Mark Tolmacs Date: Thu, 23 Apr 2026 19:38:05 +0000 Subject: [PATCH] fix: Z-orddering with frames Signed-off-by: Mark Tolmacs --- packages/element/src/zindex.ts | 43 ++++------------------------------ 1 file changed, 4 insertions(+), 39 deletions(-) diff --git a/packages/element/src/zindex.ts b/packages/element/src/zindex.ts index c4171c6bbd..739ec83e1c 100644 --- a/packages/element/src/zindex.ts +++ b/packages/element/src/zindex.ts @@ -499,10 +499,7 @@ function shiftElementsAccountingForFrames( }), ); - const frameAwareContiguousElementsToMove: { - regularElements: ExcalidrawElement[]; - frameChildren: Map; - } = { regularElements: [], frameChildren: new Map() }; + const regularElements: ExcalidrawElement[] = []; const fullySelectedFrames = new Set(); @@ -518,46 +515,14 @@ function shiftElementsAccountingForFrames( isFrameLikeElement(element) || (element.frameId && fullySelectedFrames.has(element.frameId)) ) { - frameAwareContiguousElementsToMove.regularElements.push(element); + regularElements.push(element); } else if (!element.frameId) { - frameAwareContiguousElementsToMove.regularElements.push(element); - } else { - const frameChildren = - frameAwareContiguousElementsToMove.frameChildren.get( - element.frameId, - ) || []; - frameChildren.push(element); - frameAwareContiguousElementsToMove.frameChildren.set( - element.frameId, - frameChildren, - ); + regularElements.push(element); } } } - let nextElements = allElements; - - const frameChildrenSets = Array.from( - frameAwareContiguousElementsToMove.frameChildren.entries(), - ); - - for (const [frameId, children] of frameChildrenSets) { - nextElements = shiftFunction( - allElements, - appState, - direction, - frameId, - children, - ); - } - - return shiftFunction( - nextElements, - appState, - direction, - null, - frameAwareContiguousElementsToMove.regularElements, - ); + return shiftFunction(allElements, appState, direction, null, regularElements); } // public API