Files
Igor AherneandClaude Opus 5.5 56d85f6eeb Spellcast3D 0.1.0
A free, open-source Windows app that takes an artist from an idea to game-ready 3D props on their own PC: pictures with Qwen-Image 2.1, 3D models with Pixal3D, an optional repaint of their textures, retopology with TriFlow, LATO.2 or Instant Meshes, and a baker for the final textures. See README.md, and DEVELOPERS.md for building from source.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-25 02:38:33 +01:00

26 lines
1.1 KiB
JavaScript

// Ctrl+Z takes back the newest change first, and only changes made in the stage on screen: a stage's undo lists live
// as long as its view, and the props column's deletions belong to the stage they were made in. Each list stamps its
// changes here and registers how to read its newest stamp, so on Ctrl+Z a list acts only when it holds the newest.
let clock = 0;
const lists = new Set();
/** The stamp of a change Ctrl+Z can take back: a later change has a larger one. */
export const undoStamp = () => ++clock;
/** Registers an undo list by `newest` (-> the stamp of its newest change still to undo; 0 or none: empty) -> its removal. */
export function undoList(newest) {
lists.add(newest);
return () => lists.delete(newest);
}
/** Whether the change stamped `stamp` is the newest one still to undo on the page. */
export function isNewest(stamp) {
if (!stamp) return false;
for (const newest of lists) if ((newest() || 0) > stamp) return false;
return true;
}
/** Ctrl+Z (Cmd+Z), without Shift (redo) or Alt. */
export const isUndoKey = (e) => !!(e.ctrlKey || e.metaKey) && !e.shiftKey && !e.altKey && e.key?.toLowerCase() === 'z';