[Bug] Dungeon Crawler: final 'Create Character' button unclickable — HUD hit-testing offset by the fixed app toolbar (same class as #492) #494

Closed
opened 2026-07-12 02:02:19 +00:00 by spikerj · 2 comments
Owner

Reported live by Joey (2026-07-11 ~22:0x): in the Dungeon Crawler's character-creation modal, the final Create Character button doesn't respond to clicks.

Root cause: identical defect class to #492 (Space Game). The HUD scene hit-tests in game-canvas space, but dungeon-crawler.component.ts delegated raw clientX/clientY window coordinates to hudScene.handleClick/MouseDown/MouseUp/MouseMove/Wheel. The canvas sits below the fixed app toolbar, so every click lands offset by the toolbar height and misses the button rectangles — lower buttons (like the final Create Character) worst of all.

Fix: apply PR #165's pattern — a toHudCoords() helper subtracting the canvasContainer origin (getBoundingClientRect) at all six HUD delegation points. Also collapsed a redundant identical-branch if in onMouseDown encountered in the path.

Not touched (possible follow-up): the THREE raycast NDC math still uses window.innerWidth/innerHeight; the renderer is window-sized so scale matches, but the canvas origin offset skews world-picking by toolbar-height. Same-class issue, different symptom, left out of this scoped fix — flag if world-click targeting feels off.

Verify: open Dungeon Crawler → create character → all modal buttons, including the final Create Character, respond; wheel-scroll inside modals still works.

Reported live by Joey (2026-07-11 ~22:0x): in the Dungeon Crawler's character-creation modal, the final **Create Character** button doesn't respond to clicks. **Root cause:** identical defect class to #492 (Space Game). The HUD scene hit-tests in game-canvas space, but `dungeon-crawler.component.ts` delegated raw `clientX/clientY` window coordinates to `hudScene.handleClick/MouseDown/MouseUp/MouseMove/Wheel`. The canvas sits below the fixed app toolbar, so every click lands offset by the toolbar height and misses the button rectangles — lower buttons (like the final Create Character) worst of all. **Fix:** apply PR #165's pattern — a `toHudCoords()` helper subtracting the `canvasContainer` origin (`getBoundingClientRect`) at all six HUD delegation points. Also collapsed a redundant identical-branch `if` in `onMouseDown` encountered in the path. **Not touched (possible follow-up):** the THREE raycast NDC math still uses `window.innerWidth/innerHeight`; the renderer is window-sized so scale matches, but the canvas origin offset skews world-picking by toolbar-height. Same-class issue, different symptom, left out of this scoped fix — flag if world-click targeting feels off. **Verify:** open Dungeon Crawler → create character → all modal buttons, including the final Create Character, respond; wheel-scroll inside modals still works.
Author
Owner

Fix up in spikersoft-angular PR #166 (fix/dungeon-crawler-hud-click-offset-494) — PR #165's toHudCoords pattern applied at all six HUD delegation points. Also swept every other _games/* canvas game for the same raw-clientX defect class: hex-tower-defence looked like a hit but passes the canvas bounding rect into its HUD handleClick (converts internally — correct); minecraft/chess/dungeon have no raw HUD delegations. So #492 + #494 were the only two instances; the class is now extinct in the codebase. Flagged follow-up (not in the PR): dungeon crawler's THREE raycast NDC still uses window dims — same-class origin skew for world picking, different symptom.

Fix up in spikersoft-angular PR #166 (fix/dungeon-crawler-hud-click-offset-494) — PR #165's toHudCoords pattern applied at all six HUD delegation points. Also swept every other _games/* canvas game for the same raw-clientX defect class: hex-tower-defence looked like a hit but passes the canvas bounding rect into its HUD handleClick (converts internally — correct); minecraft/chess/dungeon have no raw HUD delegations. So #492 + #494 were the only two instances; the class is now extinct in the codebase. Flagged follow-up (not in the PR): dungeon crawler's THREE raycast NDC still uses window dims — same-class origin skew for world picking, different symptom.
Author
Owner

Resolved in spikersoft-angular PR #166 (merged to master). toHudCoords() — PR #165's exact pattern — now converts window coordinates to canvas space at all six HUD delegation points (click/down/up/move/wheel), so the character-creation modal's buttons, including the final Create Character, hit their rectangles again. Sweep confirmed #492+#494 were the only two instances of this class (hex-tower-defence already passes the canvas rect; no other game delegates raw coords). Verify after the frontend deploy: Dungeon Crawler → create character → all buttons respond; modal wheel-scroll intact. The scoped-out follow-up (raycast NDC window-dims skew for world picking) remains noted in the earlier comment — file separately if fireball/world targeting ever feels off. Closing.

Resolved in spikersoft-angular PR #166 (merged to master). toHudCoords() — PR #165's exact pattern — now converts window coordinates to canvas space at all six HUD delegation points (click/down/up/move/wheel), so the character-creation modal's buttons, including the final Create Character, hit their rectangles again. Sweep confirmed #492+#494 were the only two instances of this class (hex-tower-defence already passes the canvas rect; no other game delegates raw coords). Verify after the frontend deploy: Dungeon Crawler → create character → all buttons respond; modal wheel-scroll intact. The scoped-out follow-up (raycast NDC window-dims skew for world picking) remains noted in the earlier comment — file separately if fireball/world targeting ever feels off. Closing.
Sign in to join this conversation.