Floating combat text stays visible when projected Y is off-screen #1051

Closed
opened 2026-08-13 05:38:32 +00:00 by spikerj · 1 comment
Owner

updateFloatingTexts in projects/spikersoft/src/app/_components/_games/dungeon-crawler/floating-text-system.ts decides on-screen visibility with:

scratchPosition.x > -1 && scratchPosition.x < 1 && scratchPosition.z < 1

NDC y is never gated. A number whose projected y is > 1 or < -1 (above/below the viewport) still gets display: block and a top that can be hundreds of pixels off-canvas.

The comment on that arm says it is checking whether the position is visible on screen; x and behind-camera z are checked, y is not. Damage/XP/gold labels therefore leak as invisible-but-present DOM nodes (and can become visible again on resize) while the entity is vertically off-screen.

Fix: also require scratchPosition.y > -1 && scratchPosition.y < 1 (or the inclusive equivalent used for x).

Found by Wave 7 coverage tests (floating-text-system.leftovers.spec.ts).

`updateFloatingTexts` in `projects/spikersoft/src/app/_components/_games/dungeon-crawler/floating-text-system.ts` decides on-screen visibility with: ``` scratchPosition.x > -1 && scratchPosition.x < 1 && scratchPosition.z < 1 ``` NDC **y** is never gated. A number whose projected y is `> 1` or `< -1` (above/below the viewport) still gets `display: block` and a `top` that can be hundreds of pixels off-canvas. The comment on that arm says it is checking whether the position is visible on screen; x and behind-camera z are checked, y is not. Damage/XP/gold labels therefore leak as invisible-but-present DOM nodes (and can become visible again on resize) while the entity is vertically off-screen. Fix: also require `scratchPosition.y > -1 && scratchPosition.y < 1` (or the inclusive equivalent used for x). Found by Wave 7 coverage tests (`floating-text-system.leftovers.spec.ts`).
Author
Owner

Resolved in spikersoft-angular PR #819 (merged to master). Floating combat text is culled when projected Y is off-screen. Closing.

Resolved in spikersoft-angular [PR #819](https://git.spikersoft.com/spikerj/spikersoft-angular/pulls/819) (merged to `master`). Floating combat text is culled when projected Y is off-screen. Closing.
Sign in to join this conversation.