feat: support frames via programmatic API (#7205)

* update frame id post generation

* support frames via programmatic API

* fix types

* add test for frames

* throw error when element doesn't exist

* naming tweaks

* update the api to use children

* consider max of frame dimensions and calculated bounds of elements

* consider bound elements in frame api
This commit is contained in:
Aakansha Doshi 2023-11-01 17:14:04 +05:30 committed by GitHub
parent 9b8de8a12e
commit f5c91c3a0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 1398 additions and 187 deletions

View file

@ -144,13 +144,15 @@ export const newEmbeddableElement = (
};
export const newFrameElement = (
opts: ElementConstructorOpts,
opts: {
name?: string;
} & ElementConstructorOpts,
): NonDeleted<ExcalidrawFrameElement> => {
const frameElement = newElementWith(
{
..._newElementBase<ExcalidrawFrameElement>("frame", opts),
type: "frame",
name: null,
name: opts?.name || null,
},
{},
);