|
|
|
|
@ -14,7 +14,7 @@
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
class HistoryModel extends Listener {
|
|
|
|
|
constructor(playerModel) {
|
|
|
|
|
constructor(playerModel, idGenerator) {
|
|
|
|
|
super('onHistoryUpdate', () => this );
|
|
|
|
|
|
|
|
|
|
this._deep = 128;
|
|
|
|
|
@ -23,10 +23,15 @@ class HistoryModel extends Listener {
|
|
|
|
|
this._redo_stack = [];
|
|
|
|
|
this._locked = false;
|
|
|
|
|
this._player = playerModel;
|
|
|
|
|
this._idGenerator = idGenerator;
|
|
|
|
|
|
|
|
|
|
window.cvat.addAction = (name, undo, redo, frame) => this.addAction(name, undo, redo, frame);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
generateId() {
|
|
|
|
|
return this._idGenerator.next();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
undo() {
|
|
|
|
|
let frame = window.cvat.player.frames.current;
|
|
|
|
|
let undo = this._undo_stack.pop();
|
|
|
|
|
@ -42,7 +47,7 @@ class HistoryModel extends Listener {
|
|
|
|
|
this._player.shift(undo.frame, true);
|
|
|
|
|
}
|
|
|
|
|
this._locked = true;
|
|
|
|
|
undo.undo();
|
|
|
|
|
undo.undo(this);
|
|
|
|
|
}
|
|
|
|
|
catch(err) {
|
|
|
|
|
this.notify();
|
|
|
|
|
@ -73,7 +78,7 @@ class HistoryModel extends Listener {
|
|
|
|
|
this._player.shift(redo.frame, true);
|
|
|
|
|
}
|
|
|
|
|
this._locked = true;
|
|
|
|
|
redo.redo();
|
|
|
|
|
redo.redo(this);
|
|
|
|
|
}
|
|
|
|
|
catch(err) {
|
|
|
|
|
this.notify();
|
|
|
|
|
|