mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-14 12:23:03 +01:00
fix history cancel button
This commit is contained in:
parent
8a5eaf2422
commit
03c08b3875
2 changed files with 15 additions and 13 deletions
|
|
@ -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);
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ export class OpenFaceShellView extends View {
|
|||
}
|
||||
|
||||
get rootGroup() {
|
||||
return this.openFace.rootGroup
|
||||
return this.openFace?.rootGroup
|
||||
}
|
||||
|
||||
dispose() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue