Skip to content

Conversation

@shindonghwi
Copy link
Contributor

Fixed a bug in _retainChildren where the recursive call was passing i, j instead of the calculated child coordinates 2 * x + i, 2 * y + j.

This caused incorrect tile lookups at z+2 level. For a tile at (100, 200, z=10), it was searching (0-3, 0-3) instead of (400-403, 800-803) at z=12.

The sibling function _retainAncestor correctly passes the calculated coordinates, so this appears to be a copy-paste oversight.

@JaffaKetchup
Copy link
Member

Hey @shindonghwi, great spot, and thanks for the test addition!

Could you explain whether this has fixed a bug you've found (new or existing)? We usually like to merge fix PRs with a bug report attached.

@shindonghwi
Copy link
Contributor Author

Found it while reading the code. Opened an issue here: #2175

@JaffaKetchup JaffaKetchup changed the title fix: correct coordinate calculation in _retainChildren recursion fix: correct coordinate calculation in _retainChildren recursion Dec 21, 2025
@JaffaKetchup JaffaKetchup linked an issue Dec 21, 2025 that may be closed by this pull request
Copy link
Member

@JaffaKetchup JaffaKetchup left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for spotting this!

@JaffaKetchup JaffaKetchup enabled auto-merge (squash) December 21, 2025 16:50
@JaffaKetchup JaffaKetchup merged commit decf89b into fleaflet:master Dec 21, 2025
11 checks passed
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.

_retainChildren passes wrong coordinates in recursive call

2 participants