fix typescript
This commit is contained in:
parent
5b78f50fe3
commit
2337842f57
@ -304,34 +304,42 @@ export const actionToggleTheme = register({
|
|||||||
export const actionErase = register({
|
export const actionErase = register({
|
||||||
name: "eraser",
|
name: "eraser",
|
||||||
trackEvent: { category: "toolbar" },
|
trackEvent: { category: "toolbar" },
|
||||||
//@ts-ignore
|
|
||||||
perform: (elements, appState) => {
|
perform: (elements, appState) => {
|
||||||
let lastActiveToolBeforeEraser: AppState["activeTool"]["lastActiveToolBeforeEraser"] =
|
const activeTool: any = {};
|
||||||
undefined;
|
|
||||||
if (appState.activeTool.type !== "eraser") {
|
if (appState.activeTool.type !== "eraser") {
|
||||||
if (appState.activeTool.type === "custom") {
|
if (appState.activeTool.type === "custom") {
|
||||||
lastActiveToolBeforeEraser = {
|
activeTool.lastActiveToolBeforeEraser = {
|
||||||
type: "custom",
|
type: "custom",
|
||||||
customType: appState.activeTool.customType,
|
customType: appState.activeTool.customType,
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
lastActiveToolBeforeEraser = appState.activeTool.type;
|
activeTool.lastActiveToolBeforeEraser = appState.activeTool.type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (isEraserActive(appState)) {
|
||||||
|
if (appState.activeTool.lastActiveToolBeforeEraser) {
|
||||||
|
if (
|
||||||
|
typeof appState.activeTool.lastActiveToolBeforeEraser === "object" &&
|
||||||
|
appState.activeTool.lastActiveToolBeforeEraser?.type === "custom"
|
||||||
|
) {
|
||||||
|
activeTool.type = "custom";
|
||||||
|
activeTool.customType =
|
||||||
|
appState.activeTool.lastActiveToolBeforeEraser.customType;
|
||||||
|
} else {
|
||||||
|
activeTool.type = appState.activeTool.type;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
activeTool.type = "selection";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
activeTool.type = "eraser";
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
appState: {
|
appState: {
|
||||||
...appState,
|
...appState,
|
||||||
selectedElementIds: {},
|
selectedElementIds: {},
|
||||||
selectedGroupIds: {},
|
selectedGroupIds: {},
|
||||||
activeTool: {
|
activeTool,
|
||||||
...appState.activeTool,
|
|
||||||
type: isEraserActive(appState)
|
|
||||||
? appState.activeTool.lastActiveToolBeforeEraser ?? "selection"
|
|
||||||
: "eraser",
|
|
||||||
|
|
||||||
lastActiveToolBeforeEraser,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
commitToHistory: true,
|
commitToHistory: true,
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user