fix: using stale state when switching tools (#4989)

pull/4990/head
David Luzar 3 years ago committed by GitHub
parent 2fa69ddc32
commit f2d2f97546
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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 });
}
},

Loading…
Cancel
Save