Files
a0d3d9c701 feat(editor): door/window placement-feel polish + placement-state refactor (#411)
Round 8 of the opening-placement UX work. Make door/window placement feel
physical and predictable, and unify the validity/placement logic behind one
shared decision.

UX:
- Window default sill 0.5 m (DEFAULT_WINDOW_SILL_M) so fresh windows float
  slightly above the floor; existing windows keep their own sill.
- Dev-only floor "shadow" projection for windows during placement/move
  (footprint + dashed drop-line) so an elevated window's plan spot is legible.
- Move SFX: one soft grid-snap click per grid step — identical free-following
  over floor or sliding on a wall (keyed on the raw cursor; per-frame + step
  dedup), no separate snap cue (that was a "double"). Mirrored into the 2D
  floorplan-move so 2D and 3D match.
- Shift = force-place over a collision (commit allowed; ghost stays a red
  warning) + free-place (lands at the raw cursor but keeps the alignment guides
  visible). Tint flips green/red live when Shift is pressed/released stationary.
- On-wall preview is now the tinted ghost (green placeable / red colliding),
  matching the free-follow ghost, instead of a pale solid mesh + thin wireframe.
- R-flip fixes: always toggles (no initial no-op needing a second press),
  e.repeat filtered, ghost rebuilds with the live `side`, and the ghost's
  on-wall world yaw uses `itemRotation - wallAngle` so it faces exactly what
  commit places (cursorRotation was π off for the asymmetric ghost). R ownership
  follows the current pointer pane (capture-phase + stopImmediatePropagation in
  the 2D overlay) so 3D and 2D never double-flip or go dead.

Refactor / quality:
- New `resolveOpeningPlacement({collides,forcePlace}) -> {placeable,tint}` in
  shared/wall-attach-target.ts — the single source of truth the ghost tint AND
  the commit gates both consume, so they can't disagree under Shift.
- Consolidated the byte-identical `hasWallChildOverlap` into one shared impl
  (door-math/window-math re-export it).
- applyGhost gained a green "valid" tint.
- Removed dead `cursorRotation` from the move-tool targets after the yaw fix.

Docs: "2D <-> 3D behavioral parity" principle in wiki/architecture/tools.md
(+ README + AGENTS.md) — applicable behaviors must exist in both views.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-16 10:20:44 -04:00

3.5 KiB

Agent Instructions — pascalorg/editor

Public, open-source home of @pascal-app/{core,viewer,editor,mcp} and the standalone editor app. Consumed both as npm packages and (in pascalorg/private-editor) as a git submodule.

Repo Shape

Path Purpose
packages/core Scene graph, node schemas, stores, event bus, core systems — pure logic, no Three.js
packages/viewer Standalone 3D canvas: renderers, viewer systems, presentation state
packages/editor Editor UI components reused by the standalone app and embedders
packages/mcp MCP server and scene storage adapters
apps/editor Standalone editor app — composes viewer + editor + tools

Where to look

  • Architecture ruleswiki/architecture/ (read on demand; index in wiki/architecture/README.md).
  • Skills (ready workflows).agents/skills/<name>/SKILL.md. Same content is reachable as .claude/skills/, .cursor/skills/, .codex/skills/ (symlinks to .agents/skills/).
  • Repo orientation for humansREADME.md, SETUP.md, CONTRIBUTING.md.

CLAUDE.md, GEMINI.md, and .github/copilot-instructions.md are symlinks to this file. Codex reads this file directly.

Layer Boundaries (read once, internalise)

  • packages/core owns domain data and pure logic. It must not import Three.js, packages/viewer, apps/editor, rendering/UI concepts, tools, modes, phases, or view-specific concepts such as floorplan or paint preview.
  • packages/viewer owns the standalone 3D canvas, renderers, viewer systems, and genuine presentation state. It must not know about useEditor, editor tools, phases, modes, paint mode, floorplan state, or editor-only presentation vocabulary.
  • apps/editor owns the editing experience: tools, useEditor, panels, floorplan helpers, paint mode, keyboard shortcuts, command palette, action menus, cursor badges, and editor-only overlays. Editor features are injected into <Viewer> via props and children.

Details, examples, and rationale live in wiki/architecture/layers.md, wiki/architecture/viewer-isolation.md, wiki/architecture/systems.md, wiki/architecture/renderers.md, wiki/architecture/tools.md.

When making architecture-sensitive changes

Read the relevant page in wiki/architecture/ before writing code. The page list lives in wiki/architecture/README.md. As a minimum:

  • Adding a node type → node-schemas.md, renderers.md, systems.md
  • Adding a tool → tools.md, spatial-queries.md, events.md
  • Adding / changing a placement or move interaction → tools.md ("2D ↔ 3D behavioral parity": applicable behaviors must exist in both views; port the change to the sibling 2D/3D file in the same PR)
  • Adding a system → systems.md, scene-registry.md
  • Anything in packages/viewerviewer-isolation.md, layers.md
  • Anything touching selection → selection-managers.md, scene-registry.md, events.md

When reviewing a PR

Invoke the review-architecture skill (.agents/skills/review-architecture/SKILL.md). It loads the required architecture pages, fetches the diff, classifies each new file by layer, and reports findings grouped by severity.

Operating rules

  • Read the full file before editing. Plan all changes, then make one complete edit.
  • When the user corrects you, stop and re-read their message.
  • After two consecutive tool failures, stop and change approach.
  • Don't introduce backwards-compatibility shims, dead code, or speculative abstractions.
  • Don't write new comments unless they explain a non-obvious why.