mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
feat: introduce frames (#6123)
Co-authored-by: dwelle <luzar.david@gmail.com>
This commit is contained in:
parent
4d7d96eb7b
commit
81ebf82979
78 changed files with 4563 additions and 480 deletions
21
src/utils.ts
21
src/utils.ts
|
@ -10,7 +10,11 @@ import {
|
|||
THEME,
|
||||
WINDOWS_EMOJI_FALLBACK_FONT,
|
||||
} from "./constants";
|
||||
import { FontFamilyValues, FontString } from "./element/types";
|
||||
import {
|
||||
FontFamilyValues,
|
||||
FontString,
|
||||
NonDeletedExcalidrawElement,
|
||||
} from "./element/types";
|
||||
import { AppState, DataURL, LastActiveTool, Zoom } from "./types";
|
||||
import { unstable_batchedUpdates } from "react-dom";
|
||||
import { SHAPES } from "./shapes";
|
||||
|
@ -299,7 +303,7 @@ export const distance = (x: number, y: number) => Math.abs(x - y);
|
|||
export const updateActiveTool = (
|
||||
appState: Pick<AppState, "activeTool">,
|
||||
data: (
|
||||
| { type: typeof SHAPES[number]["value"] | "eraser" | "hand" }
|
||||
| { type: typeof SHAPES[number]["value"] | "eraser" | "hand" | "frame" }
|
||||
| { type: "custom"; customType: string }
|
||||
) & { lastActiveToolBeforeEraser?: LastActiveTool },
|
||||
): AppState["activeTool"] => {
|
||||
|
@ -824,3 +828,16 @@ export const composeEventHandlers = <E>(
|
|||
}
|
||||
};
|
||||
};
|
||||
|
||||
export const isOnlyExportingSingleFrame = (
|
||||
elements: readonly NonDeletedExcalidrawElement[],
|
||||
) => {
|
||||
const frames = elements.filter((element) => element.type === "frame");
|
||||
|
||||
return (
|
||||
frames.length === 1 &&
|
||||
elements.every(
|
||||
(element) => element.type === "frame" || element.frameId === frames[0].id,
|
||||
)
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue