fix history cancel button

This commit is contained in:
Val Erastov 2022-04-04 00:20:46 -07:00
parent 8a5eaf2422
commit 03c08b3875
2 changed files with 15 additions and 13 deletions

View file

@ -208,26 +208,28 @@ function isAdditiveChange({history:oldHistory, pointer:oldPointer}, {history, po
}
function historyTravel(modifications$) {
function setPointer(pointer, hints) {
let mod = modifications$.value;
if (pointer >= mod.history.length || pointer < -1) {
return;
}
modifications$.update(({history}) => ({history, pointer, hints}));
}
return {
setPointer: function(pointer, hints) {
let mod = modifications$.value;
if (pointer >= mod.history.length || pointer < -1) {
return;
}
modifications$.update(({history}) => ({history, pointer, hints}));
},
setPointer,
begin: function(hints) {
this.setPointer(-1, hints);
setPointer(-1, hints);
},
end: function(hints) {
this.setPointer(modifications$.value.history.length - 1, hints);
setPointer(modifications$.value.history.length - 1, hints);
},
forward: function(hints) {
this.setPointer(modifications$.value.pointer + 1, hints);
setPointer(modifications$.value.pointer + 1, hints);
},
backward: function (hints) {
this.setPointer(modifications$.value.pointer - 1, hints);
setPointer(modifications$.value.pointer - 1, hints);
},
}

View file

@ -14,7 +14,7 @@ export class OpenFaceShellView extends View {
}
get rootGroup() {
return this.openFace.rootGroup
return this.openFace?.rootGroup
}
dispose() {