Virtual whiteboard for sketching hand-drawn like diagrams
fix: using stale state when switching tools (#4989)
David Luzarf2d2f97546d9
diff --git a/src/components/Actions.tsx b/src/components/Actions.tsxindex 347e34537e..8806fe316c 100644--- a/src/components/Actions.tsx+++ b/src/components/Actions.tsx@@ -219,13 +219,17 @@ export const ShapesSwitcher = ({penMode: true,});}+ const nextActiveTool = { ...activeTool, type: activeToolType };setAppState({- activeTool: { ...activeTool, type: activeToolType },+ activeTool: nextActiveTool,multiElement: null,selectedElementIds: {},});- setCursorForShape(canvas, { ...appState, activeTool });- if (activeTool.type === "image") {+ setCursorForShape(canvas, {+ ...appState,+ activeTool: nextActiveTool,+ });+ if (activeToolType === "image") {onImageAction({ pointerType });}},