mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-04 17:38:10 +00:00
DndAsset.onPointerUp captured event.pageX/Y but threw them away; both add* actions then defaulted position to origin. PageEditor's gallery onImageDrop tried an NDC unproject but gated on editorEngine.camera, which Phase 1's CameraController extraction left undefined — the guard short-circuited and worldPosition stayed undefined. Add pickDropPosition: a deps-pattern helper that mirrors the pre-refactor timeline.getPos() — raycasts from the camera through the cursor against scene children and returns the first hit (or origin if the ray misses or the camera/canvas isn't ready). Same idiom as CameraControllerDeps / GizmoControllerDeps from Phase 2; callers build the deps inline so the helper stays decoupled from Editor and any subsystem's import surface. Both drop sites — DndAsset.onPointerUp and PageEditor's 3D gallery onImageDrop — now call the helper and forward worldPosition to addCharacter / addObject / addShape.
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