simplify code

This commit is contained in:
Ryan Di 2023-11-22 17:32:28 +08:00
parent 14eecf651f
commit ae88ea555c

View File

@ -8301,22 +8301,19 @@ class App extends React.Component<AppProps, AppState> {
) { ) {
this.maybeSuggestBindingForAll(selectedElements); this.maybeSuggestBindingForAll(selectedElements);
// only need to highlight elements in a single resizing frame // highlight frame children ONLY when resizing a single frame
if (resizingSingleFrameOnly) { if (resizingSingleFrameOnly) {
const elementsToHighlight = new Set<ExcalidrawElement>(); const selectedFrame = selectedFrames[0];
if (selectedFrame) {
selectedFrames.forEach((selectedFrame) => { this.setState({
getElementsInResizingFrame( elementsToHighlight: getElementsInResizingFrame(
this.scene.getNonDeletedElements(), this.scene.getNonDeletedElements(),
selectedFrame, selectedFrame,
this.state, this.state,
).forEach((element) => elementsToHighlight.add(element)); ),
});
this.setState({
elementsToHighlight: [...elementsToHighlight],
}); });
} }
}
return true; return true;
} }