Encapsulate SceneHistory. A little. (#1016)
This commit is contained in:
parent
46e619d800
commit
dc618ab122
@ -2432,10 +2432,7 @@ export class App extends React.Component<any, AppState> {
|
|||||||
this.broadcastSceneUpdate();
|
this.broadcastSceneUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (history.isRecording()) {
|
history.record(this.state, globalSceneState.getAllElements());
|
||||||
history.pushEntry(this.state, globalSceneState.getAllElements());
|
|
||||||
history.skipRecording();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,17 +123,17 @@ export class SceneHistory {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
isRecording() {
|
// Suspicious that this is called so many places. Seems error-prone.
|
||||||
return this.recording;
|
|
||||||
}
|
|
||||||
|
|
||||||
skipRecording() {
|
|
||||||
this.recording = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
resumeRecording() {
|
resumeRecording() {
|
||||||
this.recording = true;
|
this.recording = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
record(state: AppState, elements: readonly ExcalidrawElement[]) {
|
||||||
|
if (this.recording) {
|
||||||
|
this.pushEntry(state, elements);
|
||||||
|
this.recording = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const createHistory: () => { history: SceneHistory } = () => {
|
export const createHistory: () => { history: SceneHistory } = () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user