fix not resuming recording (#614)

This commit is contained in:
David Luzar 2020-01-30 15:39:17 +01:00 committed by GitHub
parent 023400c3cc
commit bd1c00014b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -791,6 +791,7 @@ export class App extends React.Component<any, AppState> {
const onMouseUp = (lastMouseUp = (e: MouseEvent) => { const onMouseUp = (lastMouseUp = (e: MouseEvent) => {
lastMouseUp = null; lastMouseUp = null;
resetCursor(); resetCursor();
history.resumeRecording();
window.removeEventListener("mousemove", onMouseMove); window.removeEventListener("mousemove", onMouseMove);
window.removeEventListener("mouseup", onMouseUp); window.removeEventListener("mouseup", onMouseUp);
}); });
@ -1209,6 +1210,7 @@ export class App extends React.Component<any, AppState> {
this.setState({ this.setState({
draggingElement: null, draggingElement: null,
}); });
history.resumeRecording();
return; return;
} }
@ -1250,6 +1252,7 @@ export class App extends React.Component<any, AppState> {
// if no element is clicked, clear the selection and redraw // if no element is clicked, clear the selection and redraw
elements = clearSelection(elements); elements = clearSelection(elements);
this.setState({}); this.setState({});
history.resumeRecording();
return; return;
} }
@ -1427,10 +1430,15 @@ export class App extends React.Component<any, AppState> {
const { deltaX, deltaY } = e; const { deltaX, deltaY } = e;
// We don't want to save history when panning around // We don't want to save history when panning around
history.skipRecording(); history.skipRecording();
this.setState(state => ({ this.setState(
state => ({
scrollX: state.scrollX - deltaX, scrollX: state.scrollX - deltaX,
scrollY: state.scrollY - deltaY, scrollY: state.scrollY - deltaY,
})); }),
() => {
history.resumeRecording();
},
);
}; };
private addElementsFromPaste = (paste: string) => { private addElementsFromPaste = (paste: string) => {