Skip to content

Fix paste ghost off-grid for odd-sized copies - #62

Merged
malte9799 merged 1 commit into
mainfrom
claude/issue-61-repro-test-9bb67f
Oct 23, 2026
Merged

malte9799 merged 1 commit into
mainfrom
claude/issue-61-repro-test-9bb67f

Conversation

@malte9799

Copy link
Copy Markdown
Owner

Fixes #61

Cause

A copied group's ghost is held from its centre and that anchor was rounded to a whole tile. For a lone odd-sized building (belt, assembler, 3x3, 5x5) the centre is at x.5, so the stamp landed half a tile off the grid hand placement uses. Even sizes were unaffected.

Fix

snapAnchorToTiles (new pasteSnap.ts) moves the anchor in whole-tile steps from where it was copied, so every stamped entity keeps its original distance from the grid.

Test

packages/renderer/test/pasteSnap.test.ts checks 1x1 to 5x5 copies against hand placement for many cursor positions. Against the old rounding it fails for 1x1, 3x3 and 5x5 and passes for even sizes. tsc and the full renderer suite pass. I did not check it in the browser.

Preview: https://malte9799.github.io/FactorioTools/preview/claude-issue-61-repro-test-9bb67f/

🤖 Generated with Claude Code

The ghost's anchor is the group's centre, which sits at x.5 for a lone
belt or assembler. Rounding it to a whole tile slid the stamp half a tile
off the grid. Snap by whole-tile steps from the copied position instead.
@coderabbitai

coderabbitai Bot commented Oct 23, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f68e44fc-8bd2-4077-8b4e-241e1ec3fced

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • 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

Comment @coderabbitai help to get the list of available commands.

@malte9799
malte9799 merged commit 2acbb50 into main Oct 23, 2026
5 checks passed
@malte9799
malte9799 deleted the claude/issue-61-repro-test-9bb67f branch October 23, 2026 04:56
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.

[Bug]: grid issue when copping odd size building

1 participant