Skip to content

fix: furniture pick tool duplicates items instead of moving them - #293

Open
Ralphive wants to merge 1 commit into
pixel-agents-hq:mainfrom
Ralphive:fix/furniture-pick-move
Open

fix: furniture pick tool duplicates items instead of moving them#293
Ralphive wants to merge 1 commit into
pixel-agents-hq:mainfrom
Ralphive:fix/furniture-pick-move

Conversation

@Ralphive

@Ralphive Ralphive commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Description

Picking a placed furniture item with the Pick tool arms the placement tool with the item's type while leaving the original on the map. The next click stamps a copy, and because the tool stays armed, every further click stamps another one. Picking up an item to reposition it — the natural reading of "Pick" — instead duplicates it every time.

This PR makes picking from the map carry the actual item:

  • The pick remembers the picked item's uid; the placement click performs a single undoable move of that item (uid and color preserved) instead of placing a clone.
  • After the drop the tool disarms, so a follow-up click doesn't place anything.
  • Escape, switching tools, or selecting a catalog item cancels the carry without touching the layout (nothing is removed on pick, so there's no data-loss window).
  • The placement ghost passes the carried uid as excludeUid to canPlaceFurniture, so dropping onto a spot that overlaps the item's old footprint shows valid (green) and works.

Placing from the catalog palette is unchanged: it still stamps new items and stays armed for repeated placement.

Type of change

  • Bug fix

Related issues

None found.

Screenshots / GIFs

Pick the stool, drop it two tiles away — it moves (no duplicate), and the tool disarms (the last click on empty floor places nothing):

pick moves the item

Test plan

  • Rebased on latest main
  • npm run lint, npm run build, npm test all pass
  • New unit tests in webview-ui/test/editorActions.test.ts cover the layout invariants the flow relies on: move never duplicates and preserves uid/color, self-overlap allowed via excludeUid, overlap with other items rejected, walls/void/bounds rejected
  • Manually verified in the standalone server: pick→drop moves; drop overlapping old footprint works; Esc cancels with no layout change; undo restores the move as one step; catalog placement still stamps repeatedly

Picking a placed furniture item armed the placement tool with the item's
type while leaving the original on the map, so the next click stamped a
copy — and the tool stayed armed, stamping another copy on every
subsequent click.

The pick tool now remembers the picked item's uid and placement performs
a single undoable move of that item (color preserved) instead of placing
a clone. After the drop the tool disarms. Escape, switching tools, or
choosing a catalog item cancels the carry without touching the layout.
The placement ghost excludes the carried item from its own collision
check, so dropping onto a spot overlapping the item's old footprint is
valid.

Stamping copies of catalog items is unchanged: picking from the palette
still places new items and stays armed.

Adds unit tests for the layout operations the flow relies on
(move preserves uid/color and never duplicates, self-overlap allowed,
overlap with other items rejected, excludeUid semantics).
@vercel

vercel Bot commented Jun 3, 2026

Copy link
Copy Markdown

@Ralphive is attempting to deploy a commit to the pablodelucca's projects Team on Vercel.

A member of the Team first needs to authorize it.

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