simplify code

This commit is contained in:
Ryan Di 2023-11-22 17:32:28 +08:00
parent 14eecf651f
commit ae88ea555c
1 changed files with 11 additions and 14 deletions

View File

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