Skip to content

editor: green/red placement box for shelf + tool sync for presets#366

Merged
wass08 merged 2 commits into
mainfrom
shelf-placement-box
Jun 3, 2026
Merged

editor: green/red placement box for shelf + tool sync for presets#366
wass08 merged 2 commits into
mainfrom
shelf-placement-box

Conversation

@wass08
Copy link
Copy Markdown
Collaborator

@wass08 wass08 commented Jun 3, 2026

What does this PR do?

Adds an item-style green/red footprint box to the generic move tool for shelf placement, replacing the vertical-arrow cursor, plus a few correctness fixes around positioned-preset placement.

  • MoveRegistryNodeTool now renders a PlacementBox (instead of CursorSphere) when moving a shelf. Box colour comes from canPlaceOnFloor — green = placeable, red = overlaps a floor item. An invalid (red) drop is refused unless Shift is held to force it, matching the GLB item tool.
  • R/T rotate the shelf + box together and now play the rotate sfx (sfx:item-rotate).
  • The box transform re-syncs on node change, so a re-armed clone (or a different selection) no longer keeps the previous rotation/position until the next keypress.
  • Exposes the Tool type from the package entry so host apps can set the active tool for a positioned preset (drives the build cursor badge icon).
  • Extracts the box wireframe geometry helpers into a shared placement-box-geometry module reused by both the item placement coordinator and the new declarative PlacementBox component — no behaviour change to item placement.

Also a separate chore commit: applies biome formatting to files that predated the current config (lineWidth 100 / single quotes / semicolons-as-needed) so they stop showing dirty, and excludes the Next-generated **/next-env.d.ts from biome (Next rewrites it every build, so biome kept reformatting it into a perpetual diff).

Note: the catalog auto-select + placePresetSubtree flow that arms these placements lives in the downstream community app, not this repo.

How to test

  1. bun dev and open the standalone editor.
  2. Build a shelf, then select it and start a Move.
  3. Confirm a green footprint box follows the cursor (not the vertical-arrow cursor).
  4. Move the shelf so its footprint overlaps another floor item → box turns red and a click won't drop it. Hold Shift and click → it drops anyway.
  5. Press R / T → the shelf and box rotate together in 90° steps and the rotate sfx plays.
  6. Sanity: moving a non-shelf kind (e.g. spawn) still shows the original cursor — unchanged.

Screenshots / screen recording

Visual change — the green/red footprint box replaces the vertical-arrow cursor when moving a shelf.
image

Checklist

  • I've tested this locally with bun dev
  • My code follows the existing code style (run bun check to verify)
  • I've updated relevant documentation (if applicable)
  • This PR targets the main branch

wass08 and others added 2 commits June 3, 2026 09:27
… presets

Give the generic move tool a green/red footprint box for shelf placement,
matching the GLB item cursor, and drop the vertical-arrow CursorSphere for
shelves. Box colour comes from canPlaceOnFloor; an invalid (red) drop is
refused unless Shift forces it, and R/T play the rotate sfx. Re-sync the box
transform on node change so a re-armed clone isn't left at the previous
rotation/position.

Extract the box wireframe geometry helpers into a shared
placement-box-geometry module reused by the item coordinator and the new
declarative PlacementBox component. Export the Tool type so host apps can set
the active tool for a positioned preset.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Format files that predate the current biome config (lineWidth 100, single
quotes, semicolons as-needed) so they stop showing as dirty on every checkout.
Formatting only — no behavior change.

Also exclude **/next-env.d.ts from biome: Next regenerates it (double quotes +
semicolon) on every build, so biome kept reformatting it into a perpetual dirty
diff. Ignoring it lets Next own the file.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@wass08 wass08 merged commit c3199e7 into main Jun 3, 2026
2 checks passed
@mintlify
Copy link
Copy Markdown

mintlify Bot commented Jun 3, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
pascal 🔴 Failed Jun 3, 2026, 1:53 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

Aymericr pushed a commit that referenced this pull request Jun 3, 2026
…323)

Guards every `cursorGroupRef.current` dereference in the placement coordinator against the null window where mitt listeners are live but the `<group>` is unmounted (mount/teardown race) — the EDITOR-BC/BD crash family.

`getContext()` falls back to the draft's rotation, so the validation/revalidate path (Shift keys, onKeyUp) is safe; only the cursor *writes* are guarded, so Escape/right-click cancel, Shift reset, leave-state cleanup and transition state still run unconditionally. Also guards `wallPreviewRef` inside `WallTool.stopDrafting()` (the double-click/cancel path that the earlier diff missed).

Reimplemented against current main (the original branch conflicted with #366 and used over-broad handler guards that silently dropped cancel/Shift). Verified: `tsc -p apps/editor` clean, biome clean on touched files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant