mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
refactor: rename elementType to activeTool and make it an object (#4968)
* refactor: rename elementType to activeTool * update docs * fix snap * update activeToll to be an object and review fixes * fix tests * fix
This commit is contained in:
parent
2209e2c1e8
commit
127af9db23
25 changed files with 364 additions and 207 deletions
|
@ -30,8 +30,8 @@ type RestoredAppState = Omit<
|
|||
"offsetTop" | "offsetLeft" | "width" | "height"
|
||||
>;
|
||||
|
||||
export const AllowedExcalidrawElementTypes: Record<
|
||||
AppState["elementType"],
|
||||
export const AllowedExcalidrawActiveTools: Record<
|
||||
AppState["activeTool"]["type"],
|
||||
boolean
|
||||
> = {
|
||||
selection: true,
|
||||
|
@ -255,9 +255,9 @@ export const restoreAppState = (
|
|||
|
||||
return {
|
||||
...nextAppState,
|
||||
elementType: AllowedExcalidrawElementTypes[nextAppState.elementType]
|
||||
? nextAppState.elementType
|
||||
: "selection",
|
||||
activeTool: AllowedExcalidrawActiveTools[nextAppState.activeTool.type]
|
||||
? nextAppState.activeTool
|
||||
: { type: "selection" },
|
||||
// Migrates from previous version where appState.zoom was a number
|
||||
zoom:
|
||||
typeof appState.zoom === "number"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue