From bd1c00014bc8c8b8379a1237eb57d07c95b3a936 Mon Sep 17 00:00:00 2001 From: David Luzar Date: Thu, 30 Jan 2020 15:39:17 +0100 Subject: [PATCH] fix not resuming recording (#614) --- src/index.tsx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index f022f945..3f7ff686 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -791,6 +791,7 @@ export class App extends React.Component { const onMouseUp = (lastMouseUp = (e: MouseEvent) => { lastMouseUp = null; resetCursor(); + history.resumeRecording(); window.removeEventListener("mousemove", onMouseMove); window.removeEventListener("mouseup", onMouseUp); }); @@ -1209,6 +1210,7 @@ export class App extends React.Component { this.setState({ draggingElement: null, }); + history.resumeRecording(); return; } @@ -1250,6 +1252,7 @@ export class App extends React.Component { // if no element is clicked, clear the selection and redraw elements = clearSelection(elements); this.setState({}); + history.resumeRecording(); return; } @@ -1427,10 +1430,15 @@ export class App extends React.Component { const { deltaX, deltaY } = e; // We don't want to save history when panning around history.skipRecording(); - this.setState(state => ({ - scrollX: state.scrollX - deltaX, - scrollY: state.scrollY - deltaY, - })); + this.setState( + state => ({ + scrollX: state.scrollX - deltaX, + scrollY: state.scrollY - deltaY, + }), + () => { + history.resumeRecording(); + }, + ); }; private addElementsFromPaste = (paste: string) => {