mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
feat: support customType in activeTool (#5144)
* feat: support customType in activeTool * fix * rewrite types and handling * tweaks * fix Co-authored-by: dwelle <luzar.david@gmail.com>
This commit is contained in:
parent
1ed1529f96
commit
64d330a332
12 changed files with 210 additions and 51 deletions
28
src/types.ts
28
src/types.ts
|
@ -66,6 +66,16 @@ export type BinaryFileMetadata = Omit<BinaryFileData, "dataURL">;
|
|||
|
||||
export type BinaryFiles = Record<ExcalidrawElement["id"], BinaryFileData>;
|
||||
|
||||
export type LastActiveToolBeforeEraser =
|
||||
| {
|
||||
type: typeof SHAPES[number]["value"] | "eraser";
|
||||
customType: null;
|
||||
}
|
||||
| {
|
||||
type: "custom";
|
||||
customType: string;
|
||||
}
|
||||
| null;
|
||||
export type AppState = {
|
||||
isLoading: boolean;
|
||||
errorMessage: string | null;
|
||||
|
@ -80,11 +90,19 @@ export type AppState = {
|
|||
// (e.g. text element when typing into the input)
|
||||
editingElement: NonDeletedExcalidrawElement | null;
|
||||
editingLinearElement: LinearElementEditor | null;
|
||||
activeTool: {
|
||||
type: typeof SHAPES[number]["value"] | "eraser";
|
||||
lastActiveToolBeforeEraser: typeof SHAPES[number]["value"] | null;
|
||||
locked: boolean;
|
||||
};
|
||||
activeTool:
|
||||
| {
|
||||
type: typeof SHAPES[number]["value"] | "eraser";
|
||||
lastActiveToolBeforeEraser: LastActiveToolBeforeEraser;
|
||||
locked: boolean;
|
||||
customType: null;
|
||||
}
|
||||
| {
|
||||
type: "custom";
|
||||
customType: string;
|
||||
lastActiveToolBeforeEraser: LastActiveToolBeforeEraser;
|
||||
locked: boolean;
|
||||
};
|
||||
penMode: boolean;
|
||||
penDetected: boolean;
|
||||
exportBackground: boolean;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue