Update groupShapes.ts (#488)
This commit is contained in:
parent
225f312bd0
commit
24ece6b38a
1 changed files with 3 additions and 2 deletions
|
@ -10,6 +10,8 @@ export function groupShapes(
|
||||||
groupId: string,
|
groupId: string,
|
||||||
pageId: string
|
pageId: string
|
||||||
): TldrawCommand | undefined {
|
): TldrawCommand | undefined {
|
||||||
|
if (ids.length < 2) return
|
||||||
|
|
||||||
const beforeShapes: Record<string, Patch<TDShape | undefined>> = {}
|
const beforeShapes: Record<string, Patch<TDShape | undefined>> = {}
|
||||||
const afterShapes: Record<string, Patch<TDShape | undefined>> = {}
|
const afterShapes: Record<string, Patch<TDShape | undefined>> = {}
|
||||||
|
|
||||||
|
@ -30,10 +32,9 @@ export function groupShapes(
|
||||||
shapesToGroup.push(shape)
|
shapesToGroup.push(shape)
|
||||||
} else {
|
} else {
|
||||||
const childIds = shape.children.filter((id) => !app.getShape(id).isLocked)
|
const childIds = shape.children.filter((id) => !app.getShape(id).isLocked)
|
||||||
|
|
||||||
otherEffectedGroups.push(shape)
|
otherEffectedGroups.push(shape)
|
||||||
idsToGroup.push(...childIds)
|
idsToGroup.push(...childIds)
|
||||||
shapesToGroup.push(...childIds.map((id) => app.getShape(id)))
|
shapesToGroup.push(...childIds.map((id) => app.getShape(id)).filter(Boolean))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue