Skip to content

Commit

Permalink
Add RootGroup
Browse files Browse the repository at this point in the history
  • Loading branch information
tuanchauict committed Dec 11, 2024
1 parent f8b8808 commit c614b95
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions monosketch-svelte/src/lib/mono/shape/shape/group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,19 @@ export class Group extends AbstractShape {
return Array.from(this.items).map(callback);
}
}

/**
* A special [Group] for the root group of the file.
* This group contains some extra information for storing and restoring from file.
*/
export function RootGroup(id: string | null): Group;
export function RootGroup(serializableGroup: SerializableGroup): Group;

export function RootGroup(idOrSerializableGroup: string | null | SerializableGroup = null): Group {
if (idOrSerializableGroup instanceof SerializableGroup) {
return Group.fromSerializable(idOrSerializableGroup);
} else {
return new Group(idOrSerializableGroup, null);
}
}

0 comments on commit c614b95

Please sign in to comment.