remove AppState
assertion related to group actions
This commit is contained in:
parent
21d757c892
commit
40cc901d56
@ -149,11 +149,14 @@ export const actionGroup = register({
|
||||
];
|
||||
|
||||
return {
|
||||
appState: selectGroup(
|
||||
appState: {
|
||||
...appState,
|
||||
...selectGroup(
|
||||
newGroupId,
|
||||
{ ...appState, selectedGroupIds: {} },
|
||||
getNonDeletedElements(nextElements),
|
||||
) as AppState,
|
||||
),
|
||||
},
|
||||
elements: nextElements,
|
||||
commitToHistory: true,
|
||||
};
|
||||
@ -216,7 +219,7 @@ export const actionUngroup = register({
|
||||
getNonDeletedElements(nextElements),
|
||||
appState,
|
||||
null,
|
||||
) as AppState;
|
||||
);
|
||||
|
||||
frames.forEach((frame) => {
|
||||
if (frame) {
|
||||
@ -243,7 +246,7 @@ export const actionUngroup = register({
|
||||
);
|
||||
|
||||
return {
|
||||
appState: updateAppState,
|
||||
appState: { ...appState, ...updateAppState },
|
||||
elements: nextElements,
|
||||
commitToHistory: true,
|
||||
};
|
||||
|
@ -17,7 +17,10 @@ export const selectGroup = (
|
||||
groupId: GroupId,
|
||||
appState: InteractiveCanvasAppState,
|
||||
elements: readonly NonDeleted<ExcalidrawElement>[],
|
||||
): InteractiveCanvasAppState => {
|
||||
): Pick<
|
||||
InteractiveCanvasAppState,
|
||||
"selectedGroupIds" | "selectedElementIds" | "editingGroupId"
|
||||
> => {
|
||||
const elementsInGroup = elements.reduce((acc, element) => {
|
||||
if (element.groupIds.includes(groupId)) {
|
||||
acc[element.id] = true;
|
||||
@ -31,7 +34,7 @@ export const selectGroup = (
|
||||
appState.editingGroupId === groupId
|
||||
) {
|
||||
return {
|
||||
...appState,
|
||||
selectedElementIds: appState.selectedElementIds,
|
||||
selectedGroupIds: { ...appState.selectedGroupIds, [groupId]: false },
|
||||
editingGroupId: null,
|
||||
};
|
||||
@ -40,7 +43,7 @@ export const selectGroup = (
|
||||
}
|
||||
|
||||
return {
|
||||
...appState,
|
||||
editingGroupId: appState.editingGroupId,
|
||||
selectedGroupIds: { ...appState.selectedGroupIds, [groupId]: true },
|
||||
selectedElementIds: {
|
||||
...appState.selectedElementIds,
|
||||
@ -226,12 +229,13 @@ export const selectGroupsFromGivenElements = (
|
||||
}
|
||||
if (groupIds.length > 0) {
|
||||
const groupId = groupIds[groupIds.length - 1];
|
||||
nextAppState = selectGroup(groupId, nextAppState, elements);
|
||||
nextAppState = {
|
||||
...nextAppState,
|
||||
...selectGroup(groupId, nextAppState, elements),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// nextAppState = selectGroups(elements, elements, appState);
|
||||
|
||||
return nextAppState.selectedGroupIds;
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user