Repository navigation
Fix paste ghost off-grid for odd-sized copies - #62
Merged
Merged
Conversation
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.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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(newpasteSnap.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.tschecks 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.tscand 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