hm
This commit is contained in:
parent
cefa2ace5a
commit
0e432c62ae
87 changed files with 4282 additions and 3066 deletions
|
|
@ -41,11 +41,11 @@
|
|||
return true;
|
||||
}
|
||||
|
||||
function restore(worldRef, entry, source) {
|
||||
function restore(worldRef, entry) {
|
||||
if (!worldRef || !entry?.snapshot || !global.TarinaiRestoreCoordinator?.restoreSnapshot) return false;
|
||||
worldRef._historyRestoring = true;
|
||||
try {
|
||||
global.TarinaiRestoreCoordinator.restoreSnapshot(cloneSnapshot(entry.snapshot), worldRef, { source, syncUi: true });
|
||||
global.TarinaiRestoreCoordinator.restoreSnapshot(cloneSnapshot(entry.snapshot), worldRef, { syncUi: true });
|
||||
worldRef._lastUndoSnapshotKey = snapshotKey(global.TarinaiSnapshot?.createSnapshot?.(worldRef));
|
||||
return true;
|
||||
} finally {
|
||||
|
|
@ -60,7 +60,7 @@
|
|||
const prev = world._undoStack.pop();
|
||||
if (current) world._redoStack.push({ snapshot: cloneSnapshot(current), key: snapshotKey(current), label: "redo", time: world.time || 0 });
|
||||
if (world._redoStack.length > MAX_HISTORY) world._redoStack.splice(0, world._redoStack.length - MAX_HISTORY);
|
||||
const ok = restore(world, prev, "undo");
|
||||
const ok = restore(world, prev);
|
||||
return { ok, label: prev.label || "" };
|
||||
}
|
||||
|
||||
|
|
@ -71,7 +71,7 @@
|
|||
const next = world._redoStack.pop();
|
||||
if (current) world._undoStack.push({ snapshot: cloneSnapshot(current), key: snapshotKey(current), label: "undo", time: world.time || 0 });
|
||||
if (world._undoStack.length > MAX_HISTORY) world._undoStack.splice(0, world._undoStack.length - MAX_HISTORY);
|
||||
const ok = restore(world, next, "redo");
|
||||
const ok = restore(world, next);
|
||||
return { ok, label: next.label || "" };
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue