feat: box select frame & children to allow resizing at the same time (#9031)

* box select frame & children

* avoid selecting children twice to avoid double their moving

* do not show ele stats if frame and children selected together

* do not update frame membership if selected together

* do not group frame and its children

* comment and refactor code

* hide align altogether

* include frame children when selecting all

* simplify

---------

Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
This commit is contained in:
Ryan Di 2025-01-29 08:10:16 +11:00 committed by GitHub
parent 7028daa44a
commit 52eaf64591
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 122 additions and 44 deletions

View file

@ -3235,7 +3235,12 @@ class App extends React.Component<AppProps, AppState> {
newElements,
topLayerFrame,
);
addElementsToFrame(nextElements, eligibleElements, topLayerFrame);
addElementsToFrame(
nextElements,
eligibleElements,
topLayerFrame,
this.state,
);
}
this.scene.replaceAllElements(nextElements);
@ -4326,10 +4331,14 @@ class App extends React.Component<AppProps, AppState> {
}
selectedElements.forEach((element) => {
mutateElement(element, {
x: element.x + offsetX,
y: element.y + offsetY,
});
mutateElement(
element,
{
x: element.x + offsetX,
y: element.y + offsetY,
},
false,
);
updateBoundElements(element, this.scene.getNonDeletedElementsMap(), {
simultaneouslyUpdated: selectedElements,
@ -4346,6 +4355,8 @@ class App extends React.Component<AppProps, AppState> {
),
});
this.scene.triggerUpdate();
event.preventDefault();
} else if (event.key === KEYS.ENTER) {
const selectedElements = this.scene.getSelectedElements(this.state);
@ -8586,6 +8597,7 @@ class App extends React.Component<AppProps, AppState> {
elements,
this.state.selectionElement,
this.scene.getNonDeletedElementsMap(),
false,
)
: [];
@ -9014,6 +9026,7 @@ class App extends React.Component<AppProps, AppState> {
this.scene.getElementsMapIncludingDeleted(),
elementsInsideFrame,
newElement,
this.state,
),
);
}
@ -9131,6 +9144,7 @@ class App extends React.Component<AppProps, AppState> {
nextElements,
elementsToAdd,
topLayerFrame,
this.state,
);
} else if (!topLayerFrame) {
if (this.state.editingGroupId) {