mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
feat: support props.locked
for setActiveTool
(#7153)
Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com>
This commit is contained in:
parent
e7cc2337ea
commit
3697618266
4 changed files with 67 additions and 5 deletions
|
@ -363,18 +363,21 @@ export const distance = (x: number, y: number) => Math.abs(x - y);
|
|||
|
||||
export const updateActiveTool = (
|
||||
appState: Pick<AppState, "activeTool">,
|
||||
data: (
|
||||
data: ((
|
||||
| {
|
||||
type: ToolType;
|
||||
}
|
||||
| { type: "custom"; customType: string }
|
||||
) & { lastActiveToolBeforeEraser?: ActiveTool | null },
|
||||
) & { locked?: boolean }) & {
|
||||
lastActiveToolBeforeEraser?: ActiveTool | null;
|
||||
},
|
||||
): AppState["activeTool"] => {
|
||||
if (data.type === "custom") {
|
||||
return {
|
||||
...appState.activeTool,
|
||||
type: "custom",
|
||||
customType: data.customType,
|
||||
locked: data.locked ?? appState.activeTool.locked,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -386,6 +389,7 @@ export const updateActiveTool = (
|
|||
: data.lastActiveToolBeforeEraser,
|
||||
type: data.type,
|
||||
customType: null,
|
||||
locked: data.locked ?? appState.activeTool.locked,
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue