fix zindex to account for group boundaries (#2065)

This commit is contained in:
David Luzar 2020-09-11 17:06:07 +02:00 committed by GitHub
parent ea020f2c50
commit d07099aadd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 1287 additions and 416 deletions

View file

@ -45,10 +45,17 @@ export function isSelectedViaGroup(
appState: AppState,
element: ExcalidrawElement,
) {
return !!element.groupIds
return getSelectedGroupForElement(appState, element) != null;
}
export const getSelectedGroupForElement = (
appState: AppState,
element: ExcalidrawElement,
) => {
return element.groupIds
.filter((groupId) => groupId !== appState.editingGroupId)
.find((groupId) => appState.selectedGroupIds[groupId]);
}
};
export function getSelectedGroupIds(appState: AppState): GroupId[] {
return Object.entries(appState.selectedGroupIds)