mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-19 08:05:20 +00:00
Six self-contained classes under engine/editor/actions/, one per action kind. Each implements UndoableAction, captures its own state in the constructor, and runs apply/revert against subsystem refs held privately. Adding a new kind = a new file here, no edits elsewhere. - CreateAction: snapshots an obj, recreates on apply (redo), removes via utils.deleteObject on revert (undo). Uses the non-recording delete path so undo of create can't recurse. - DeleteAction: mirror — removes on apply, recreates on revert. - TransformAction: encapsulates begin/end transaction state. Caller constructs at dragstart (captures before), calls commit() at dragend to capture after + check for a no-op move. records only if commit() returns true. - ColorAction: simple before/after pair, routes through activeScene.setColor. - LockAction: routes through SelectionBridge.setLockState so the gizmo attach/detach side effects fire on undo. - VisibilityAction: writes obj.visible + userData.visible directly. No call sites use these yet — that's the next commit. HistoryManager is unchanged; it already accepts UndoableAction via record().
Frontend
This is an nx monorepo that can contain multiple apps and shared libraries.
All commands to run these projects are performed from this directory.
Install dependencies
npm install
Editor2d
Run dev server:
nx dev editor2d
artcraft
Run dev server:
nx dev artcraft
call when starting on main or a new branch:
./clean_modules
The names for @frontend and @storyteller come from the package.json file in the libs folder.
import { Login } from "@frontend/login";
import { api } from "@storyteller/api";
For shared UI components, import from @storyteller/ui-[componentname].
import { Button } from "@storyteller/ui-button";
import { Modal } from "@storyteller/ui-modal";
building:
npx nx build artcraft
npx nx build editor2d
dev:
npx nx dev artcraft
npx nx dev editor2d
# component build
1.
npx nx g @nx/react:library libs/components/toaster --import-path=@storyteller/ui-toaster --bundler=vite
npm install
2.import it first in code
3.nx sync
4.nx build
or
# frontend build
in frontend folder
% nx build -project type
% nx build artcraft
% nx dev artcraft