You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix Rect.setSize() not updating bounds (pointer event regression) (#1373)
* Fix Rect.setSize() not updating bounds (regression from TS conversion)
Rect.setSize() did not call updateBounds(), leaving bounds stale after
position or size changes. This broke pointer event broadphase lookups:
the QuadTree query rect always reported bounds at (0,0) instead of the
actual click position, causing moles at certain positions in the
whack-a-mole example to not respond to clicks.
Root cause: commit 4d185c9 (July 2024) replaced Rect.setShape(x,y,w,h)
with pos.set() + setSize() during the TypeScript conversion, but setSize()
never called updateBounds(). The old setShape() updated everything in one
call. See #817 for the underlying pos type mismatch.
Fix: add updateBounds() call in Rect.setSize().
Tests: add bounds validation tests for Rect.setSize(), pos.set()+setSize(),
Rect.copy(), and RoundRect equivalents.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Add recalc() call in Rect.setSize() for edge/normal consistency
setSize() now calls recalc() before updateBounds(), matching the
behavior of the width/height setters. Without this, edges, normals,
and indices were stale after setSize(), which could cause incorrect
SAT/collision results on resized rectangles.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: packages/melonjs/CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,7 @@
39
39
-**BREAKING**: `Tween` no longer adds itself to `game.world` — uses event-based lifecycle (`TICK`, `GAME_AFTER_UPDATE`, `STATE_PAUSE`, `STATE_RESUME`, `GAME_RESET`) instead. Public API unchanged. `isPersistent` and `updateWhenPaused` properties still supported.
40
40
41
41
### Fixed
42
+
- Geometry: `Rect.setSize()` now calls `updateBounds()` — fixes a regression from July 2024 (`4d185c902`) where replacing `Rect.setShape()` with `pos.set()` + `setSize()` during the TypeScript conversion left bounds stale, causing pointer event broadphase lookups to use `(0,0)` instead of the actual pointer position (see #817)
42
43
- WebGL: depth buffer now correctly used for 3D mesh rendering with `gl.LESS` depth function
43
44
- Canvas: backface culling corrected for Y-flipped screen space (was culling front faces instead of back)
44
45
- Canvas: triangle seam expansion (0.5px) to cover anti-aliasing gaps between adjacent triangles
0 commit comments