Skip to content

fix(service-map): tiles stay put while you place them - #2545

Merged
Makisuo merged 1 commit into
mainfrom
fix/service-map-tiles-placement
Nov 12, 2026
Merged

Makisuo merged 1 commit into
mainfrom
fix/service-map-tiles-placement

Conversation

@Makisuo

@Makisuo Makisuo commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Placing tiles on the Tiles view of the service map was unreliable: the board slid under the pointer whenever a tile was lifted or put down, so the cell you aimed at changed and the tile card showed the wrong outcome (e.g. "-1 roads" right after picking a tile up).

What changed

  • The camera stays still while you rearrange. The framing came from the tiles plus the open country, and the country was recomputed without the lifted tile, so every pickup and placement refit the camera. It now frames the tiles only; when a deal grows the board, the camera glides into frame (650 ms) instead of jumping. Grabbing the view stops a glide.
  • Lakes and woods stay put on pickup. The country is worked out with a lifted tile still at home, leaving a gap to put it back into. It only changes once the tile lands.
  • Aiming follows what is drawn. The target cell is the tile, plate, lake or country under the pointer (the held tile is see-through to this), falling back to the ground plane.
  • The tile in hand reads as in hand. It gets the selection ring, and starts over a cell at once: under the pointer, or (no pointer on the map) its own cell / the free cell nearest the middle, so Enter works without moving first.
  • No floating islands. The outer ring of country hides while a tile is held.
  • The map no longer resizes on Rearrange. The footer hint wrapped to two lines and shrank the canvas; it now truncates on one line.

Before / after

Lab /lab/service-map-tiles, headless Chromium.

Before After
Tile lifted
Hovering a cell
Dealing

Before: lifting orders refits the camera (the board shifts and zooms), the lakes move, outer country floats as islands, and the dealt tile sits on a cell looking placed. After: the board holds still, the tile in hand is ringed over its target.

Verification

  • Drove the lab with Playwright and logged camera position, hover cell and held tile through rearrange, pickup, hover, Escape and an 8-tile keyboard deal: the camera is unchanged through rearrange/pickup/hover and every Enter placed a tile.
  • New tests in world.test.ts: lifting a tile leaves lakes, country and framing unchanged (fails on main), the lifted tile is offered its own cell back, and a lifted tile starts over its own cell.
  • vitest run src/page/service-map: 345 passed. oxlint -c .oxlintrc.effect.json clean, no new tsc errors.

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

- The camera frames the tiles only, so lifting or putting down a tile no
  longer refits it and slides the board under the pointer. A bigger board
  after a deal glides into frame instead of jumping.
- Lakes and open country are worked out with a lifted tile still at home:
  they only move once it lands.
- The cell a held tile goes to is the one drawn under the pointer (tile,
  plate, lake or country), not a ground-plane hit.
- The tile in hand is ringed and starts over a cell at once, so it never
  reads as already placed and Enter works without moving the mouse.
- The outer ring of country hides while a tile is held instead of floating
  as islands, and the footer stays one line so the map never resizes.
@maple-review-bot

maple-review-bot Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Maple review

🟡 Confidence 6/10 · needs attention. Held at 6 because a correctness warning is open.
1 warning −1 · tests partial −1 · risk medium

Holds the service-map tiles camera, lakes and country still while a tile is lifted, glides the framing when the board grows, and aims at the tile, plate, lake or country drawn under the pointer. Sound apart from a stale ring in the country cache.

  • framing/fit glide the camera (FIT_GLIDE_MS) instead of jumping, cancelled by a grab or a zoom command
  • extentOf frames the tiles only, so lifting a tile no longer refits
  • derive computes lakes and wilds without the held id, so the country stays put on pickup
  • cellUnder raycasts tiles, plates, lakes and wilds; ring-2 country hides while a tile is held

Findings

🟠 Warning · F1 · wildTiles keeps a stale ring when a cell's ring changes

correctness · apps/web/src/page/service-map/tiles/scene.ts:623

The key omits ring, so a cell going from ring 1 to ring 2 with the same feature keeps its cached entry and is never rebuilt. showOffers (scene.ts:636) reads the stale ring and leaves that island of country visible while a tile is held — the symptom this change removes. Reachable once a tile moves away from a neighbour.

				key: `${cellKey(cell)}:${ring}:${biome.id}:${feature}:${palette.night}`,
🤖 Prompt to fix this finding with an AI agent
Findings from an automated review of commit f5b378a8bca27c32062eec70053d190d16a389e8. Verify each one against the current code before changing anything, fix only those that still apply, and keep each fix to the lines it names.

---

F1 · Warning · correctness · apps/web/src/page/service-map/tiles/scene.ts:623
`wildTiles` keeps a stale `ring` when a cell's ring changes
The key omits `ring`, so a cell going from ring 1 to ring 2 with the same feature keeps its cached entry and is never rebuilt. `showOffers` (`scene.ts:636`) reads the stale ring and leaves that island of country visible while a tile is held — the symptom this change removes. Reachable once a tile moves away from a neighbour.
Replace those lines with:
				key: `${cellKey(cell)}:${ring}:${biome.id}:${feature}:${palette.night}`,

f5b378a · What was checked, coverage and telemetry details are on the Maple / review check. Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.

@coderabbitai

coderabbitai Bot commented Nov 12, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 16 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 529bb925-8f90-4c59-8e47-d8e42d98350b
Commits

Reviewing files that changed from the base of the PR and between 61dc8b6 and f5b378a.

Files selected for processing: 4

  • apps/web/src/page/service-map/tiles/scene.ts
  • apps/web/src/page/service-map/tiles/view.ts
  • apps/web/src/page/service-map/tiles/world.test.ts
  • apps/web/src/page/service-map/tiles/world.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@Makisuo
Makisuo merged commit 911fe1a into main Nov 12, 2026
26 checks passed
@Makisuo
Makisuo deleted the fix/service-map-tiles-placement branch November 12, 2026 23:39

@maple-review-bot maple-review-bot 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.

1 inline note from Maple's review. The score and summary are in the review comment above.

ring,
biome,
feature,
key: `${cellKey(cell)}:${biome.id}:${feature}:${palette.night}`,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Warning

wildTiles keeps a stale ring when a cell's ring changes

F1 · Warning · correctness

The key omits ring, so a cell going from ring 1 to ring 2 with the same feature keeps its cached entry and is never rebuilt. showOffers (scene.ts:636) reads the stale ring and leaves that island of country visible while a tile is held — the symptom this change removes. Reachable once a tile moves away from a neighbour.

Add `ring` to the key so the cell is rebuilt, and its stored `ring` refreshed, when it changes ring.
Suggested change
key: `${cellKey(cell)}:${biome.id}:${feature}:${palette.night}`,
key: `${cellKey(cell)}:${ring}:${biome.id}:${feature}:${palette.night}`,
🤖 Prompt to fix with an AI agent
In `apps/web/src/page/service-map/tiles/scene.ts:623`: `wildTiles` keeps a stale `ring` when a cell's ring changes.

The key omits `ring`, so a cell going from ring 1 to ring 2 with the same feature keeps its cached entry and is never rebuilt. `showOffers` (`scene.ts:636`) reads the stale ring and leaves that island of country visible while a tile is held — the symptom this change removes. Reachable once a tile moves away from a neighbour.

Replace those lines with:

				key: `${cellKey(cell)}:${ring}:${biome.id}:${feature}:${palette.night}`,

Verify the problem exists at that location before changing it, and keep the fix to those lines.

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