Update groupShapes.ts (#488)

This commit is contained in:
Steve Ruiz 2022-01-06 07:35:32 +00:00 committed by GitHub
parent 225f312bd0
commit 24ece6b38a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -10,6 +10,8 @@ export function groupShapes(
groupId: string,
pageId: string
): TldrawCommand | undefined {
if (ids.length < 2) return
const beforeShapes: Record<string, Patch<TDShape | undefined>> = {}
const afterShapes: Record<string, Patch<TDShape | undefined>> = {}
@ -30,10 +32,9 @@ export function groupShapes(
shapesToGroup.push(shape)
} else {
const childIds = shape.children.filter((id) => !app.getShape(id).isLocked)
otherEffectedGroups.push(shape)
idsToGroup.push(...childIds)
shapesToGroup.push(...childIds.map((id) => app.getShape(id)))
shapesToGroup.push(...childIds.map((id) => app.getShape(id)).filter(Boolean))
}
}