mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: using stale state when switching tools (#4989)
This commit is contained in:
parent
2fa69ddc32
commit
f2d2f97546
1 changed files with 7 additions and 3 deletions
|
@ -219,13 +219,17 @@ export const ShapesSwitcher = ({
|
||||||
penMode: true,
|
penMode: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
const nextActiveTool = { ...activeTool, type: activeToolType };
|
||||||
setAppState({
|
setAppState({
|
||||||
activeTool: { ...activeTool, type: activeToolType },
|
activeTool: nextActiveTool,
|
||||||
multiElement: null,
|
multiElement: null,
|
||||||
selectedElementIds: {},
|
selectedElementIds: {},
|
||||||
});
|
});
|
||||||
setCursorForShape(canvas, { ...appState, activeTool });
|
setCursorForShape(canvas, {
|
||||||
if (activeTool.type === "image") {
|
...appState,
|
||||||
|
activeTool: nextActiveTool,
|
||||||
|
});
|
||||||
|
if (activeToolType === "image") {
|
||||||
onImageAction({ pointerType });
|
onImageAction({ pointerType });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue