fix(flame_tiled): Anchor oversized orthogonal tiles at bottom-left of cell#3923
Open
Ortes wants to merge 1 commit into
Open
fix(flame_tiled): Anchor oversized orthogonal tiles at bottom-left of cell#3923Ortes wants to merge 1 commit into
Ortes wants to merge 1 commit into
Conversation
… cell In Tiled, when a tile image is larger than the map's tile size (oversized tiles from collection-image tilesets, or atlas tiles drawn into a smaller map cell), the image is rendered with its bottom-LEFT corner aligned to the cell's bottom-left, extending up and to the right. flame_tiled's orthogonal renderer instead anchored such tiles at the cell's bottom-RIGHT (`anchorX = src.width - halfMapTile.x`), causing oversized tiles to extend up and to the LEFT, which does not match Tiled's editor preview and breaks `tileoffset` workflows: positioning a tree centered on its cell in Tiled placed it off-cell in-game. For uniform tilesets where `src.width == map.tileWidth`, the new `anchorX = halfMapTile.x` evaluates to the same value as before, so behavior is unchanged for the common case. The `oversized_tiles_orthogonal` golden was regenerated to reflect the corrected (Tiled-compatible) rendering. The isometric, hexagonal, and staggered renderers are not touched by this change.
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 #3922.
Summary
For oversized tiles in orthogonal maps (image larger than
map.tileWidth/tileHeight, typically collection-image tilesets used for decorative props like trees),flame_tiledwas anchoring the rendered image at the cell's bottom-right, causing it to extend up and to the left. Tiled's editor anchors such tiles at the cell's bottom-left (extending up and to the right). The mismatch broketileoffset-based workflows: a tile visually centered on its cell in Tiled was rendered off-cell in-game.Change
For uniform tilesets where
src.width == map.tileWidth, both expressions equalhalfMapTile.x, so the common case is unchanged. The fix only affects tiles whose source image is larger than the map's tile size.The isometric, hexagonal, and staggered renderers have their own anchor logic and are not touched.
Test plan
oversized_tiles_orthogonalgolden regenerated (it previously captured the buggy bottom-right anchoring; it now captures the corrected bottom-left anchoring per Tiled's convention)flame_tiledcontinue to pass (the 3 unrelated pre-existing failures onmain—image_layer_test"covers entire map" andTileStackpositioning — are unaffected by this change)tileoffset.x="-43"(placed in Tiled to center the trunk on a 32×32 cell) now renders centered in-game, matching the Tiled editor previewCompatibility note
For users who currently have oversized orthogonal tiles and worked around the bug by tweaking
tileoffsetto compensate for the bottom-right anchoring, this change will shift those tiles visually. The new behavior matches Tiled's editor, so re-opening the map in Tiled will show the same result as in-game.