Fix stamp tool cursor positioning to match anchor point#61
Open
Fix stamp tool cursor positioning to match anchor point#61
Conversation
The stamp tool was placing sprites off by one square because it used a fixed offset (center of cell) instead of the sprite's actual anchor point offset. This caused a mismatch between where the cursor showed the sprite and where it was actually placed. The fix computes the correct offset based on the stamp item's anchor position, matching the cursor positioning in cursor-support.tsx. https://claude.ai/code/session_01WC2Evn9xnmzidW5oGzbogY
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.
Summary
Fixed the stamp tool to position dropped sprites at the cursor location by computing the drag offset based on the sprite's anchor point, matching the visual feedback shown in the cursor.
Changes
DEFAULT_APPEARANCE_INFOfrom sprite module for fallback appearance dataDEFAULT_APPEARANCE_INFOas fallbackImplementation Details
The stamp tool now computes
dragLeftanddragTopas the distance from the sprite's top-left corner to its anchor center in screen pixels. This ensures that when a sprite is dropped, its anchor point aligns with the cursor position, matching the visual representation shown in the cursor preview.