fix: filter out elements not overlapping frame on paste (#7591)

This commit is contained in:
David Luzar
2024-01-21 20:55:57 +01:00
committed by GitHub
parent 4997624a3a
commit 740a165452
3 changed files with 198 additions and 7 deletions

View File

@@ -349,6 +349,7 @@ import {
isElementInFrame,
getFrameLikeTitle,
getElementsOverlappingFrame,
filterElementsEligibleAsFrameChildren,
} from "../frame";
import {
excludeElementsInFramesFromSelection,
@@ -3107,7 +3108,11 @@ class App extends React.Component<AppProps, AppState> {
const topLayerFrame = this.getTopLayerFrameAtSceneCoords({ x, y });
if (topLayerFrame) {
addElementsToFrame(allElements, newElements, topLayerFrame);
const eligibleElements = filterElementsEligibleAsFrameChildren(
newElements,
topLayerFrame,
);
addElementsToFrame(allElements, eligibleElements, topLayerFrame);
}
this.scene.replaceAllElements(allElements);