simplify code

frame-resizing
Ryan Di 1 year ago
parent 14eecf651f
commit ae88ea555c

@ -8301,21 +8301,18 @@ 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;

Loading…
Cancel
Save