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.