mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: stabilize selectedElementIds
when box selecting (#6912)
This commit is contained in:
parent
8101a351db
commit
9cd5e15917
4 changed files with 64 additions and 17 deletions
|
@ -71,6 +71,7 @@ export const selectGroupsForSelectedElements = (function () {
|
|||
selectedElements: readonly NonDeleted<ExcalidrawElement>[],
|
||||
elements: readonly NonDeleted<ExcalidrawElement>[],
|
||||
appState: Pick<AppState, "selectedElementIds" | "editingGroupId">,
|
||||
prevAppState: InteractiveCanvasAppState,
|
||||
): SelectGroupsReturnType => {
|
||||
if (
|
||||
lastReturnValue !== undefined &&
|
||||
|
@ -134,10 +135,13 @@ export const selectGroupsForSelectedElements = (function () {
|
|||
lastReturnValue = {
|
||||
editingGroupId: appState.editingGroupId,
|
||||
selectedGroupIds,
|
||||
selectedElementIds: {
|
||||
...appState.selectedElementIds,
|
||||
...selectedElementIdsInGroups,
|
||||
},
|
||||
selectedElementIds: makeNextSelectedElementIds(
|
||||
{
|
||||
...appState.selectedElementIds,
|
||||
...selectedElementIdsInGroups,
|
||||
},
|
||||
prevAppState,
|
||||
),
|
||||
};
|
||||
|
||||
return lastReturnValue;
|
||||
|
@ -181,7 +185,7 @@ export const selectGroupsForSelectedElements = (function () {
|
|||
};
|
||||
}
|
||||
|
||||
return _selectGroups(selectedElements, elements, appState);
|
||||
return _selectGroups(selectedElements, elements, appState, prevAppState);
|
||||
};
|
||||
|
||||
selectGroupsForSelectedElements.clearCache = () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue