Skip to content

fix(rendering): texture-load heal no longer clobbers explicitly narrowed frames#382

Merged
Exoridus merged 1 commit into
mainfrom
worktree-infinite-maps-slice2
Jul 16, 2026
Merged

fix(rendering): texture-load heal no longer clobbers explicitly narrowed frames#382
Exoridus merged 1 commit into
mainfrom
worktree-infinite-maps-slice2

Conversation

@Exoridus

Copy link
Copy Markdown
Owner

Root cause

A Sprite constructed from a still-loading texture schedules a heal (the deferred-handle fix that keeps a sprite from staying 0×0): once the texture hydrates, _healOnTextureLoad reset the frame to the full texture. It did so unconditionally — clobbering any frame explicitly narrowed in the meantime. Spritesheet.addFrame does exactly that (construct sprite, then setTextureFrame(rect)), so every spritesheet sliced from a not-yet-awaited atlas rendered the whole atlas per sprite. Reproduced in ~5 merged examples (e.g. tile-chunks-and-bands, sprite-follows-body).

Fix

The schedule-time resetTextureFrame() on an unhydrated texture leaves a 0×0 frame (Texture._size starts 0×0 until load). A non-empty frame at hydration time therefore means someone chose it deliberately — the heal now only fires when the frame is still 0×0. One-condition change; the original heal behavior (bare sprite from deferred texture) is preserved and pinned by test.

Verification

  • TDD: explicit-frame-survives case failed before the guard (frame reset to full texture), passes after; bare-heal case passes before and after.
  • pnpm test:core: 307 files / 4943 tests green.
  • Empirical: screenshot of the merged tile-chunks-and-bands example post-fix shows the explorer as a single character sprite (previously the full ~15-character atlas grid) — zero example edits needed, which was the point of fixing at engine altitude.

…wed frames

A Sprite constructed from a still-loading texture schedules a heal that
resets the frame to the full texture on hydration. When a Spritesheet (or
any caller) explicitly narrowed the frame in the meantime, that reset threw
the chosen frame away — every sliced sprite rendered the whole atlas. The
schedule-time reset leaves a 0x0 frame, so a non-empty frame now disables
the heal.
@Exoridus
Exoridus enabled auto-merge (squash) July 16, 2026 16:08
@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Bundle Report

Changes will increase total bundle size by 561 bytes (0.0%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
exo-esm-esm 804.45kB 61 bytes (0.01%) ⬆️
exo-esm-modules-esm 3.56MB 370 bytes (0.01%) ⬆️
exo-iife-min-Exo-iife 811.46kB 61 bytes (0.01%) ⬆️
exo-full-iife-Exo-iife 2.61MB 69 bytes (0.0%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: exo-esm-modules-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
rendering/sprite/Sprite.js 370 bytes 17.79kB 2.12%

Files in rendering/sprite/Sprite.js:

  • ./src/rendering/sprite/Sprite.ts → Total Size: 17.34kB
view changes for bundle: exo-full-iife-Exo-iife

Assets Changed:

Asset Name Size Change Total Size Change (%)
exo.full.iife.js 69 bytes 2.61MB 0.0%
view changes for bundle: exo-iife-min-Exo-iife

Assets Changed:

Asset Name Size Change Total Size Change (%)
exo.iife.min.js 61 bytes 811.46kB 0.01%

Files in exo.iife.min.js:

  • ./src/rendering/sprite/Sprite.ts → Total Size: 17.46kB
view changes for bundle: exo-esm-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
exo.esm.js 61 bytes 804.45kB 0.01%

Files in exo.esm.js:

  • ./src/rendering/sprite/Sprite.ts → Total Size: 17.34kB

@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@Exoridus
Exoridus merged commit 02fe847 into main Jul 16, 2026
17 of 18 checks passed
@Exoridus
Exoridus deleted the worktree-infinite-maps-slice2 branch July 16, 2026 16:17
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.

1 participant