feat: introduce frames (#6123)

Co-authored-by: dwelle <luzar.david@gmail.com>
This commit is contained in:
Ryan Di 2023-06-15 00:42:01 +08:00 committed by GitHub
parent 4d7d96eb7b
commit 81ebf82979
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
78 changed files with 4563 additions and 480 deletions

File diff suppressed because it is too large Load diff

View file

@ -10,6 +10,7 @@ Object {
"endArrowhead": "arrow",
"endBinding": null,
"fillStyle": "hachure",
"frameId": null,
"groupIds": Array [],
"height": 50,
"id": "id0",
@ -56,6 +57,7 @@ Object {
"backgroundColor": "transparent",
"boundElements": null,
"fillStyle": "hachure",
"frameId": null,
"groupIds": Array [],
"height": 50,
"id": "id0",
@ -89,6 +91,7 @@ Object {
"backgroundColor": "transparent",
"boundElements": null,
"fillStyle": "hachure",
"frameId": null,
"groupIds": Array [],
"height": 50,
"id": "id0",
@ -122,6 +125,7 @@ Object {
"endArrowhead": null,
"endBinding": null,
"fillStyle": "hachure",
"frameId": null,
"groupIds": Array [],
"height": 50,
"id": "id0",
@ -168,6 +172,7 @@ Object {
"backgroundColor": "transparent",
"boundElements": null,
"fillStyle": "hachure",
"frameId": null,
"groupIds": Array [],
"height": 50,
"id": "id0",

View file

@ -15,6 +15,7 @@ exports[`export exporting svg containing transformed images: svg export output 1
src: url(\\"https://excalidraw.com/Cascadia.woff2\\");
}
</style>
</defs>
<g transform=\\"translate(30.710678118654755 30.710678118654755) rotate(315 50 50)\\"><use href=\\"#image-file_A\\" width=\\"100\\" height=\\"100\\"></use></g><g transform=\\"translate(130.71067811865476 30.710678118654755) rotate(45 25 25)\\"><use href=\\"#image-file_A\\" width=\\"50\\" height=\\"50\\" transform=\\"scale(-1, 1) translate(-50 0)\\"></use></g><g transform=\\"translate(30.710678118654755 130.71067811865476) rotate(45 50 50)\\"><use href=\\"#image-file_A\\" width=\\"100\\" height=\\"100\\" transform=\\"scale(1, -1) translate(0 -100)\\"></use></g><g transform=\\"translate(130.71067811865476 130.71067811865476) rotate(315 25 25)\\"><use href=\\"#image-file_A\\" width=\\"50\\" height=\\"50\\" transform=\\"scale(-1, -1) translate(-50 -50)\\"></use></g></svg>"
<g transform=\\"translate(30.710678118654755 30.710678118654755) rotate(315 50 50)\\"><use href=\\"#image-file_A\\" width=\\"100\\" height=\\"100\\" opacity=\\"1\\"></use></g><g transform=\\"translate(130.71067811865476 30.710678118654755) rotate(45 25 25)\\"><use href=\\"#image-file_A\\" width=\\"50\\" height=\\"50\\" opacity=\\"1\\" transform=\\"scale(-1, 1) translate(-50 0)\\"></use></g><g transform=\\"translate(30.710678118654755 130.71067811865476) rotate(45 50 50)\\"><use href=\\"#image-file_A\\" width=\\"100\\" height=\\"100\\" opacity=\\"1\\" transform=\\"scale(1, -1) translate(0 -100)\\"></use></g><g transform=\\"translate(130.71067811865476 130.71067811865476) rotate(315 25 25)\\"><use href=\\"#image-file_A\\" width=\\"50\\" height=\\"50\\" opacity=\\"1\\" transform=\\"scale(-1, -1) translate(-50 -50)\\"></use></g></svg>"
`;

View file

@ -6,6 +6,7 @@ Object {
"backgroundColor": "transparent",
"boundElements": null,
"fillStyle": "hachure",
"frameId": null,
"groupIds": Array [],
"height": 50,
"id": "id0_copy",
@ -37,6 +38,7 @@ Object {
"backgroundColor": "transparent",
"boundElements": null,
"fillStyle": "hachure",
"frameId": null,
"groupIds": Array [],
"height": 50,
"id": "id0",
@ -68,6 +70,7 @@ Object {
"backgroundColor": "transparent",
"boundElements": null,
"fillStyle": "hachure",
"frameId": null,
"groupIds": Array [],
"height": 50,
"id": "id0",
@ -104,6 +107,7 @@ Object {
},
],
"fillStyle": "hachure",
"frameId": null,
"groupIds": Array [],
"height": 100,
"id": "id0",
@ -140,6 +144,7 @@ Object {
},
],
"fillStyle": "hachure",
"frameId": null,
"groupIds": Array [],
"height": 300,
"id": "id1",
@ -177,6 +182,7 @@ Object {
"gap": 10,
},
"fillStyle": "hachure",
"frameId": null,
"groupIds": Array [],
"height": 81.48231043525051,
"id": "id2",

View file

@ -8,6 +8,7 @@ Object {
"endArrowhead": "arrow",
"endBinding": null,
"fillStyle": "hachure",
"frameId": null,
"groupIds": Array [],
"height": 110,
"id": "id0",
@ -61,6 +62,7 @@ Object {
"endArrowhead": null,
"endBinding": null,
"fillStyle": "hachure",
"frameId": null,
"groupIds": Array [],
"height": 110,
"id": "id0",

File diff suppressed because it is too large Load diff

View file

@ -8,6 +8,7 @@ Object {
"endArrowhead": "arrow",
"endBinding": null,
"fillStyle": "hachure",
"frameId": null,
"groupIds": Array [],
"height": 50,
"id": "id0",
@ -54,6 +55,7 @@ Object {
"endArrowhead": null,
"endBinding": null,
"fillStyle": "hachure",
"frameId": null,
"groupIds": Array [],
"height": 50,
"id": "id0",
@ -98,6 +100,7 @@ Object {
"backgroundColor": "transparent",
"boundElements": null,
"fillStyle": "hachure",
"frameId": null,
"groupIds": Array [],
"height": 50,
"id": "id0",
@ -129,6 +132,7 @@ Object {
"backgroundColor": "transparent",
"boundElements": null,
"fillStyle": "hachure",
"frameId": null,
"groupIds": Array [],
"height": 50,
"id": "id0",
@ -160,6 +164,7 @@ Object {
"backgroundColor": "transparent",
"boundElements": null,
"fillStyle": "hachure",
"frameId": null,
"groupIds": Array [],
"height": 50,
"id": "id0",

View file

@ -8,6 +8,7 @@ Object {
"endArrowhead": null,
"endBinding": null,
"fillStyle": "hachure",
"frameId": null,
"groupIds": Array [],
"height": 100,
"id": "id-arrow01",
@ -52,6 +53,7 @@ Object {
"backgroundColor": "blue",
"boundElements": Array [],
"fillStyle": "cross-hatch",
"frameId": null,
"groupIds": Array [
"1",
"2",
@ -87,6 +89,7 @@ Object {
"backgroundColor": "blue",
"boundElements": Array [],
"fillStyle": "cross-hatch",
"frameId": null,
"groupIds": Array [
"1",
"2",
@ -122,6 +125,7 @@ Object {
"backgroundColor": "blue",
"boundElements": Array [],
"fillStyle": "cross-hatch",
"frameId": null,
"groupIds": Array [
"1",
"2",
@ -157,6 +161,7 @@ Object {
"backgroundColor": "transparent",
"boundElements": Array [],
"fillStyle": "hachure",
"frameId": null,
"groupIds": Array [],
"height": 0,
"id": "id-freedraw01",
@ -194,6 +199,7 @@ Object {
"endArrowhead": null,
"endBinding": null,
"fillStyle": "hachure",
"frameId": null,
"groupIds": Array [],
"height": 100,
"id": "id-line01",
@ -240,6 +246,7 @@ Object {
"endArrowhead": null,
"endBinding": null,
"fillStyle": "hachure",
"frameId": null,
"groupIds": Array [],
"height": 100,
"id": "id-draw01",
@ -288,6 +295,7 @@ Object {
"fillStyle": "hachure",
"fontFamily": 1,
"fontSize": 14,
"frameId": null,
"groupIds": Array [],
"height": 100,
"id": "id-text01",
@ -328,6 +336,7 @@ Object {
"fillStyle": "hachure",
"fontFamily": 1,
"fontSize": 10,
"frameId": null,
"groupIds": Array [],
"height": 100,
"id": "id-text01",

View file

@ -15,6 +15,7 @@ const elementBase: Omit<ExcalidrawElement, "type"> = {
roughness: 1,
opacity: 100,
groupIds: [],
frameId: null,
roundness: null,
seed: 1041657908,
version: 120,

View file

@ -37,8 +37,12 @@ export class API {
static getSelectedElements = (
includeBoundTextElement: boolean = false,
includeElementsInFrames: boolean = false,
): ExcalidrawElement[] => {
return getSelectedElements(h.elements, h.state, includeBoundTextElement);
return getSelectedElements(h.elements, h.state, {
includeBoundTextElement,
includeElementsInFrames,
});
};
static getSelectedElement = (): ExcalidrawElement => {
@ -141,6 +145,7 @@ export class API {
| "versionNonce"
| "isDeleted"
| "groupIds"
| "frameId"
| "link"
| "updated"
> = {

View file

@ -28,8 +28,10 @@ Object {
"defaultSidebarDockedPreference": false,
"draggingElement": null,
"editingElement": null,
"editingFrame": null,
"editingGroupId": null,
"editingLinearElement": null,
"elementsToHighlight": null,
"errorMessage": null,
"exportBackground": true,
"exportEmbedScene": false,
@ -37,6 +39,7 @@ Object {
"exportScale": 1,
"exportWithDarkMode": false,
"fileHandle": null,
"frameToHighlight": null,
"gridSize": null,
"isBindingEnabled": true,
"isLoading": false,
@ -62,10 +65,12 @@ Object {
"scrollY": 0,
"scrolledOutside": false,
"selectedElementIds": Object {},
"selectedElementsAreBeingDragged": false,
"selectedGroupIds": Object {},
"selectedLinearElement": null,
"selectionElement": null,
"shouldCacheIgnoreZoom": false,
"shouldRenderFrames": true,
"showHyperlinkPopup": false,
"showStats": false,
"showWelcomeScreen": false,

View file

@ -11,6 +11,7 @@ const toolMap = {
freedraw: "freedraw",
text: "text",
eraser: "eraser",
frame: "frame",
};
export type ToolName = keyof typeof toolMap;

File diff suppressed because one or more lines are too long