select single element on cmd-click (#2087)

This commit is contained in:
David Luzar
2020-08-27 20:59:46 +02:00
committed by GitHub
parent b8f8bc2e32
commit 4c2d34ffd7
4 changed files with 840 additions and 17 deletions

View File

@@ -86,6 +86,20 @@ export function selectGroupsForSelectedElements(
return nextAppState;
}
export const editGroupForSelectedElement = (
appState: AppState,
element: NonDeleted<ExcalidrawElement>,
): AppState => {
return {
...appState,
editingGroupId: element.groupIds.length ? element.groupIds[0] : null,
selectedGroupIds: {},
selectedElementIds: {
[element.id]: true,
},
};
};
export function isElementInGroup(element: ExcalidrawElement, groupId: string) {
return element.groupIds.includes(groupId);
}