fix: increment history version on brush/eraser stroke completion for proper undo

This commit is contained in:
SnapOtter
2026-05-07 20:26:48 +08:00
parent a633eff788
commit fa3085aff9
2 changed files with 12 additions and 0 deletions
@@ -81,6 +81,12 @@ export function useBrushTool() {
}, []);
const handleMouseUp = useCallback(() => {
if (strokeRef.current) {
useEditorStore.setState({
lastAction: "Brush Stroke",
_historyVersion: useEditorStore.getState()._historyVersion + 1,
});
}
strokeRef.current = null;
}, []);
@@ -81,6 +81,12 @@ export function useEraserTool() {
}, []);
const handleMouseUp = useCallback(() => {
if (strokeRef.current) {
useEditorStore.setState({
lastAction: "Eraser Stroke",
_historyVersion: useEditorStore.getState()._historyVersion + 1,
});
}
strokeRef.current = null;
}, []);