Skip to content

[Maintainer] Typed wall length and angle, and typed cabinet coordinates - #1249

Merged
Aymericr merged 31 commits into
mainfrom
cursor/wall-typed-input-combined-11c1
Nov 9, 2026
Merged

Aymericr merged 31 commits into
mainfrom
cursor/wall-typed-input-combined-11c1

Conversation

@Aymericr

@Aymericr Aymericr commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

What does this PR do?

Combines three community PRs into one typed-entry feature, on current main:

dkbbdev's commits keep their authorship, including every Bugbot-round fix.

Behaviour, the same in the 3D tools and the 2D plan:

  • Walls: while drafting, start typing to open a Length / Angle HUD. The normal draft label stays until the first keystroke. Tab switches fields, Enter commits, and the next segment starts empty.
    • Escape has two stages: the first clears what was typed and keeps the draft, the second cancels.
    • Untyped drafts keep run, angle and junction snapping.
    • The typed angle is an absolute heading in the plan frame, measured as the 15° angle snap measures it; the placeholder shows the live heading.
  • Cabinets: once a cabinet snaps to a wall, type a distance, then Tab or comma for the offset, and Enter to place. Escape has the same two stages. A rejected placement keeps the typed values.

Maintainer changes on top of the two merges:

  • One shared store: a single usePlacementTyping store, key router (routePlacementTypingKey) and HUD serve walls and cabinets, replacing the two parallel implementations.
  • Typed angle: added for walls.
  • 2D-only keys: typed keys are taken in a window capture listener ahead of the global shortcuts. Before this, typing 1 switched phase, m armed Measure, and the first Escape cancelled the tool. A regression test mounts the real useKeyboard handler first.
  • 2D HUD sizing: the HUD takes unitsPerPixel and the plan rotation from its caller. The wall draft renders outside FloorplanRenderProvider, so the HUD was plan-metre sized and off screen in 2D-only view; I found this in manual testing.
  • Pointer handling: the 3D Enter commits before the pointer moves, and the 2D HUD passes clicks through to the cabinet ghost.
  • Docs: the typed-entry convention is described in wiki/architecture/tools.md.

How to test

  1. Run bun dev, pick Walls, click a start point, move the pointer, and type 4.5. Then Tab, type 90, and press Enter: a 4.5 m wall heading 90° is committed.
  2. Start another wall and type 2. Press Escape: the HUD clears and the draft follows the pointer again. Press Escape again: the draft is cancelled.
  3. Switch to 2D-only view, start a wall, and type 12m. The phase doesn't change, Measure isn't armed, and Enter commits exactly 12 m.
  4. Pick a base cabinet, hover until it snaps to a wall, and type 1. Then Tab, 0.1, Enter: the cabinet is placed 1 m along the wall and 0.1 m off it.
  5. Focused tests: bun test packages/editor/src/store/use-placement-typing.test.ts packages/editor/src/components/editor/floorplan-wall-typing-keys.test.tsx packages/editor/src/components/editor-2d/renderers/floorplan-placement-typing-hud.test.tsx.

Screenshots / screen recording

Wall typed entry in 3D, then 2D-only (idle frames removed):

wall_typed_entry_3d_and_2d_walkthrough.mp4

Typed length and angle (3D) First Escape keeps the draft (3D) 2D-only: 12m typed, no shortcut fired
3D HUD Escape 2D HUD

Cabinet typed entry isn't in the recording: my scripted browser couldn't get the ghost to attach to a wall. It's covered by the cabinet placement and typing-store tests.

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

Local bun run ci passed on d7aea0c0; the head adds only a comment reflow. An independent read-only review approved 471747da after an earlier round with one P1, the 2D-only shortcut leak, fixed here. Its remaining P3 follow-ups:

  • A second Escape in 2D-only exits to Select, as on main.
  • The capture listener skips the delete-confirmation and version-preview guards.
  • The angle placeholder rounds to whole degrees.

Supersedes #883, #887 and #1207. Credit: @dkbbdev and @saadmooh.

Co-authored-by: dkbbdev [email protected]
Co-authored-by: saadmooh [email protected]

To show artifacts inline, enable in settings.

Open in Web Open in Cursor 

Note

Medium Risk
Large edits to wall drafting and cabinet placement commit paths plus window-level keyboard capture; mitigated by focused tests and 2D/3D parity rules, but regressions in split view or shortcut ordering remain plausible.

Reviewed by Cursor Bugbot for commit 471747d. Bugbot is set up for automated code reviews on this repo. Configure here.

dkbbdev and others added 30 commits September 17, 2026 23:31
While drafting a wall, printable keys open a typing buffer; the draft
endpoint is projected onto the typed length along the current draft
direction, so the pointer keeps steering direction only. Enter commits
at the typed length, two-stage Escape clears the buffer first and then
cancels the draft, Backspace/Delete edit the buffer. Shared zustand
store keeps the 2D floor plan and the 3D view in lockstep (parity rule
in wiki/architecture/tools.md); angle/junction snapping is preserved on
untyped drafts and bypassed only for the typed commit.
- click/Enter commit reuses the projected endpoint the previews show
  instead of re-snapping the raw pointer (2D + 3D parity)
- HUD subscribes to the typing store so the label tracks keystrokes
- typing buffer cleared on every commit/cancel path; never carries
  into the next chain segment
- 2D typing keys stopPropagation so tool shortcuts don't fire mid-type
- drop unused begin() action
… Enter commit

- 3D Enter keeps the buffer across the synthetic grid:click so the
  commit is recognized as typed (no re-snap), clears defensively after
- stopDrafting clears the typing store: double-click finish and chain
  auto-close no longer leak the old length into the next draft
- 2D Enter commits through a latest-ref instead of the first-render
  closure, which used to restart the draft at the typed point
- 2D move preview publishes projectedEnd so a click mid-type commits
  the projected endpoint, matching the 3D tool
- Strip insertionPreview/insertionFailure in applyTypedPlacement so Enter
  commits the typed wall position instead of re-entering the pointer
  path's run-insertion branch (Bugbot: stale insertion, high).
- Drop the trailing setProjectedPosition(snap) in beginTypedPlacement that
  pinned the HUD to the pre-typing snap instead of the first digit's
  projection.
- Clear typedWallHitRef/typedCoordinateDefaultsRef on every typing exit
  (becameInactive), covering Escape typed inside the HUD input whose
  window handler skips INPUT targets.
- Render the coordinate HUD from exactly one surface: 2D pane in 2d/split,
  3D Html in 3d-only — split view mounts both panes, so both instances
  fought over caret/focus.
- Neutralize altKey on the reused pointer event for typed commits so a
  stale force-place modifier cannot override the typed pose (Bugbot:
  stale Alt click).
- onClick now reports whether a cabinet was committed; a rejected typed
  commit (e.g. collision) keeps the typing session so values survive and
  can be adjusted instead of being silently wiped.
- 2D typed-entry HUD sizes its foreignObject from CSS px × unitsPerPixel
  and counter-rotates by -sceneRotationDeg (mirrors the measurement
  extrusion control), so inputs render screen-upright at a usable size
  at any zoom/rotation.
- Continuous-mode typed Enter now seeds the stretch preview at the typed
  position (zero-length span) via a rawOverride on
  resolveStretchedPlacement, instead of growing toward the stale cursor
  position carried by the reused pointer event (Bugbot: high).
- A canvas click while typed entry is active ends the typing session
  before committing, so a newly started stretch can follow the pointer
  instead of being frozen until Escape (Bugbot: medium).
findClosestCabinetWallInPlan now accepts maxDistance; beginTypedPlacement
passes Infinity since the placement already knows its wallId and only
needs the projection onto it. A typed perpendicular offset (or deep
cabinet) can push the center beyond WALL_SNAP_DISTANCE_M, which made the
next session fail to start and let digits fall through to global phase
shortcuts.
- Restore the pre-typing pose when a typing session ends uncommitted
  (Escape/tool cancel): placementRef kept the typed pose, so a click right
  after Escape committed the cancelled coordinates (Bugbot: high).
- Ending the session on island toggle: island has no wall snapping, so the
  session would be orphaned (frozen pointer, vanished HUD) until Escape.
- resolveCabinetTypedPlacementPosition clamps distance instead of
  rejecting when the cabinet is wider than the wall, matching the
  coordinate getter's clamp so the pose stays committable (Bugbot: medium).
- A canvas click during typed entry now commits the typed preview pose
  (suppress the pre-typing restore; keep placementRef) instead of the
  restored original snap (Bugbot: high).
- Strip 'node' from the synthetic typed-commit event so
  stopPlacementCommitPropagation does not install its 300ms window click
  swallow, which could eat the user's next real click (Bugbot: medium).
- resolveCabinetTypedPlacementPosition samples the mitered face offset at
  the destination station (hit.localX = typed distance + width/2) instead
  of the frozen pre-typing snap (Bugbot: medium).
- HIGH-2: recompute wallSurfaceNormal from updated resolved.yaw in applyTypedPlacement

- HIGH-3: re-resolve and publish placement from lastPlacementEventRef when typing ends without commit

- QUICKWIN-2: allow '/' and ',' in isPlacementTypingKey and advance field on comma in PlacementCoordinateInput

Note: HIGH-1 and QUICKWIN-1 were already addressed in commit 7c7851a.
…les field

- A canvas click during typed entry now ends the session only when the
  commit succeeds (onClick wrapper defers clear() past onClickInner). An
  invalid typed pose keeps the session alive so values stay editable
  (Bugbot: invalid click ends typed entry, high).
- The capture-phase window keydown handler now treats ',' as a field
  toggle like the focused HUD input does, so comma advances to the
  offset field even when the HUD is unfocused (Bugbot: medium).
Wall snap centers an oversized cabinet on the wall (empty span →
midpoint), but typed entry mapped default distance 0 to
localX = width / 2, sliding the cabinet off the wall center — possibly
past the wall end — the moment coordinate entry started or the default
was committed. resolveCabinetTypedPlacementPosition now resolves the
centered pose (wallLength / 2) when the cabinet is wider than the wall,
matching getCabinetPlacementCoordinates and resolveCabinetWallSnapPlacement.

Adds a regression test: wall 4m, cabinet 5m wide → distance 0 resolves
to wallLocalX 2 (wall center), not 2.5.
Bugbot 8497d792 (round 3, high): append/backspace only change the
buffer, while projectedEnd is published by pointer move — so digits
typed after the last move left the click commit using a stale
endpoint (typed "1" then "2" without moving committed 1, not 12).
Enter already re-parsed and re-projected; click now does too, via a
shared resolveTypedCommitEnd(start, currentEnd, input, parseOpts)
helper used by both the 3D grid-click path and the 2D floor-plan
placement callback, falling back to the last projected end only when
there is no usable direction. The 2D move preview also re-binds on
unit/metricNotation changes so the parse options stay in sync.

check-types + biome + editor (1072) + nodes (3392) suites pass.
Bugbot cb434c3d (round 4, high): the 3D tool's capture-phase Enter
handler synthesized grid:click and stopped the event, so the 2D Enter
path never ran handleWallPlacementPoint. In 2D-only that click pipeline
commits nothing (the canvas is display:none), so a typed Enter silently
did nothing; in split view the 3D commit left the panel's draftStart on
the previous segment, so the next 2D preview and typed commit projected
from a stale origin.

The tool's key handler now yields in 2D-only view — the floor-plan
panel is the committer there (view-gated createWallOnCurrentLevel
already exists). For split view, the panel subscribes to the chain
start the 3D tool publishes on useSegmentDraftChain and re-bases its
draft onto it, so both views keep drafting from the same point with a
single commit owner. The subscription re-arms reactively on
mode/tool instead of reading the store once at mount.

check-types + biome + editor (1072) + nodes (3393) suites pass.
- Escape during a typed 2D draft now only clears the buffer: the panel's
  cancel handler recognizes the stage-1 tool:cancel via
  wallTypingEscapeClearedRef and consumes it, so the draft and the tool
  survive (Bugbot e9c12894).
- A null publish from the 3D chain store (auto-close, T-junction,
  single-segment finish, cancel) now tears the 2D draft down too —
  clearWallPlacementDraft resets draftStart and wallChainFirstVertex
  (Bugbot a172c934).
- 2D Enter guards before clearing: a valid buffer with a degenerate
  preview no longer wipes the input without committing; clearInput moves
  after the guards and after setDraftEnd, matching the 3D path (Bugbot
  622bea04).
- Split view: a grid:move emitted by the floor-plan panel carries a
  screenProjection; while a typing buffer is active the 3D move path now
  trusts that point verbatim instead of re-running magnetic/grid snap,
  which could rotate the draft ray away from the 2D preview (Bugbot
  3cd53dd1).
- acceptsWallTypingKey gates buffer START on a digit or leading dot;
  letters only continue an active buffer, so c/m/t/f drafting shortcuts
  stay live before typing begins (Bugbot 7dcff331).
…penings)

# Conflicts:
#	packages/editor/src/components/editor/floorplan-panel.tsx
#	packages/nodes/src/wall/tool.tsx
Conflicts in the wall tool and the floor plan panel:
- 3D move: main's run snapping (wallDraftIsRun/snapRun) and wall-body
  capture are kept; the typed split-view bypass (a plan-forwarded move with
  an active buffer is trusted verbatim) is layered in front of them.
- 3D click: a typed commit still bypasses snapping; otherwise main's run or
  segment snap runs.
- The 2D-only guard in the 3D key handler uses main's planOwnsInput()
  instead of reading viewMode.
- Floor plan: keep both the typed chain re-base/teardown subscriptions and
  main's pull-run seeding.
Import-only conflicts in the cabinet tool: main's movingAlignmentAnchors and
isTypingTarget are kept beside #887's NodeEvent, isPlacementTypingKey,
PlacementTypingState and parseMeasurement imports. The editor index export
order is re-sorted for main's new use-point-ask export.
…n walls and cabinets

#883 (typed wall length) and #887 (typed cabinet distance/offset) each
brought their own typed-entry store, key handling and HUD. Replace
`useWallDraftTyping` with the cabinet's `usePlacementTyping`, now carrying
its session's field labels, so both tools share:

- `routePlacementTypingKey`: a digit or `.` opens a session, Tab or comma
  switches field, Enter commits, Escape clears the session (the next Escape
  cancels the draft), Backspace edits, Delete empties the field; Cmd/Ctrl/Alt
  chords are never consumed.
- A display-only `PlacementCoordinateInput` (no focused inputs), rendered in
  3D through `LocalizedHtml` and in the plan through
  `FloorplanPlacementTypingHud`, so split view shows it in both panes.
- `resolveTypedWallEnd` for the wall projection, used by the 3D tool and
  the plan alike. The plan forwards the pointer itself on `grid:move` and
  each side re-projects it, and a typed Enter that resolves to nothing
  keeps the session instead of dropping it.

Also drops the floorplan preview layer's cabinet kind check (E-002), clears
the session after each Polygon corner, and removes the frozen-copy
typed-length test in favour of tests through the exported resolver.
Adapted from the typed-angle idea in #1207: the wall draft's typed entry
gets a second field, the heading. Tab (or comma) switches between length
and angle, and Tab with no session open starts on the angle.

- Length only: the pointer steers the direction, the length is exact.
- Angle only: the direction is locked and the pointer's projection onto it
  sets the length, on the grid step when grid snapping is on.
- Both: the endpoint is fully determined.

Degrees are measured the way the 15° angle snap builds its rays,
`atan2(dz, dx)` from the building's +X axis towards +Z; the field's
placeholder shows the live heading in that convention. The same resolver
drives the 3D tool and the plan, so 2D, 3D and split view agree. Only the
angle field is taken from #1207; its chain, guide and parser changes are
not.

Co-authored-by: saadmooh <[email protected]>
…tcuts

The plan's typed entry sat in its bubble-phase keydown listener, which is
re-registered (after the global `useKeyboard` one) on every draft's first
click. In 2D-only view a typed `1`/`2` switched phase, `m` armed Measure and
the first Escape cancelled the tool instead of clearing what was typed.

Move it into `installFloorplanWallTypingKeys`, a window capture listener
registered once that reads the draft through refs, consumes its keys before
any shortcut sees them, and stands down outside 2D-only view, where the 3D
wall tool's capture listener owns them. The stage-1 Escape marker and its
`tool:cancel` workaround are gone: that Escape no longer reaches the global
handler. Also tidies two comments left half-edited.
Right after the start click the tool has no pointer yet, so Enter with both
length and angle typed did nothing and typing showed no preview. Fall back
to the start point, as the plan does.
The plan's HUD was centred on the cabinet with a pointer-active box around
it, so clicks on the ghost hit the HUD. Lift it just above its anchor and
let only the HUD panel take the pointer.
A heading just under 360° rounded to a 360° placeholder; show 0° as the
typed-angle convention reads it.
…rwarding

The typed angle is an absolute heading in the plan frame, as the angle snap
measures it, and its placeholder shows the live heading the same way, while
the draft's angle labels stay relative. The plan forwards its snapped
pointer, never the typed end, and takes 2D-only keys in a capture listener.
The typing store is shared across test files, so a session another file
left open turned the typed `1m` into `51m` in the full suite.
The wall draft renders outside FloorplanRenderProvider, so the shared HUD
read the context defaults (unitsPerPixel 1, rotation 0) and drew a
plan-metre-sized box far off screen in the 2D-only view. The HUD now takes
unitsPerPixel and sceneRotationDeg from its caller.

Co-authored-by: dkbbdev <[email protected]>
@Aymericr Aymericr added the bot:maintainer label Nov 9, 2026 — with Cursor
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T23:01:35.051517Z 471747d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 471747da39

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1124 to +1126
if (usePlacementTyping.getState().isActive) {
usePlacementTyping.getState().clear()
return

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve the draft on non-keyboard cancellation

When cancellation reaches this handler through cancelActiveTool() (for example, from a spatial Cancel action rather than the window key listener), this branch clears the typing store but returns without calling markToolCancelConsumed(). The caller therefore treats the cancel as unconsumed and immediately switches to Select; in split view, the floor-plan cancel listener can also tear down the mirrored draft. As a result, the documented two-stage behavior only works for physical Escape keydowns—route the first stage before emitting tool:cancel, or coordinate/consume the cancel so clearing typed input cannot also end the wall draft.

AGENTS.md reference: AGENTS.md:L21-L24

Useful? React with 👍 / 👎.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 471747d. Configure here.

if (usePlacementTyping.getState().isActive) {
usePlacementTyping.getState().clear()
return
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cancel during typed wall entry exits tool

Medium Severity

The wall tool's tool:cancel handler clears an active typed session and returns without calling markToolCancelConsumed. History abort (⌘Z) and other cancel sources then fall through as unconsumed, so the global handler exits to Select instead of only dropping the typed values. The cabinet tool consumes this same first-stage cancel, and Escape already keeps the draft.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 471747d. Configure here.

@Aymericr
Aymericr merged commit 34518ac into main Nov 9, 2026
4 checks passed
@Aymericr
Aymericr deleted the cursor/wall-typed-input-combined-11c1 branch November 9, 2026 23:08
cursor Bot pushed a commit that referenced this pull request Nov 9, 2026
Brings in #1249 (typed wall length/angle, shared usePlacementTyping store,
floorplan typing keys/HUD, typed cabinet coordinates). No source file was
changed on both sides; the textual conflicts were limited to generated
catalogs.

Resolutions:
- packages/editor/src/i18n/locales/{en,en-XA}/messages.ts: compiled
  catalogs conflicted; took main's copy and regenerated with
  `bun run i18n:extract`, which re-adds this branch's end height offset
  strings alongside #1249's typing strings. The PO catalogs auto-merged and
  extraction left them unchanged; `bun run i18n:check` passes.

Co-authored-by: vducasse <[email protected]>
Aymericr added a commit that referenced this pull request Nov 9, 2026
…e draft (#1251)

* fix(wall): a cancel that only ends typed entry keeps the draft

Follow-up to #1249. A first cancel from any source (Escape, ⌘Z mid-draft,
a toolbar cancel) while a typed wall session is open now only clears the
typed values; the next cancel drops the draft and the tool stays armed.

- 3D wall tool: consume the first-stage cancel, as the cabinet tool does.
- 2D-only plan: `endFloorplanWallTypingOnCancel` clears the session and
  keeps the plan's draft; in split view it defers to the 3D wall tool.

Regression tests drive `cancelActiveTool()` (the ⌘Z path) through the real
WallTool and the plan's cancel handler.

Addresses Cursor Bugbot finding on #1249 ("Cancel during typed wall entry
exits tool").

Co-authored-by: dkbbdev <[email protected]>

* docs(tools): a first cancel from any source ends typed entry

Co-authored-by: dkbbdev <[email protected]>

---------

Co-authored-by: Cursor Agent <[email protected]>
Co-authored-by: dkbbdev <[email protected]>
cursor Bot pushed a commit that referenced this pull request Nov 10, 2026
…ions-refinements

Conflicts:
- packages/editor/src/i18n/locales/{en,en-XA}/messages.ts: compiled
  catalogs conflicted on both branches' new messages. Regenerated with
  `bun run i18n:extract` rather than hand-merged; this also normalised
  comment order in the es/fr/ja/zh-CN PO drafts, which keep their
  `fuzzy` + `Review: required` markers. `bun run i18n:check` passes.

Auto-merged files touched by both sides (reviewed, no edits needed):
- packages/editor/src/index.tsx: keeps this branch's
  `RegistryToolContextValue` export and #1249's PlacementCoordinateInput,
  wall typed-entry and usePlacementTyping exports.
- packages/nodes/src/cabinet/tool.tsx and wall/tool.tsx changed only on
  main since the merge base, so #1249's typed coordinates land unchanged
  next to this branch's cabinet move-lock/selection-proxy changes.

Co-authored-by: sudhir <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants