Skip to content

Fix ScaleManager scroll bounds after page scrolling#7342

Open
SaveEditors wants to merge 1 commit into
phaserjs:masterfrom
SaveEditors:fix-7203-scale-manager-scroll-bounds
Open

Fix ScaleManager scroll bounds after page scrolling#7342
SaveEditors wants to merge 1 commit into
phaserjs:masterfrom
SaveEditors:fix-7203-scale-manager-scroll-bounds

Conversation

@SaveEditors

Copy link
Copy Markdown

Fixes #7203.

ScaleManager stores canvas bounds in page coordinates, but getParentBounds() compared them with viewport-relative coordinates from getBoundingClientRect(). After the page scrolled, an unchanged canvas could be treated as having moved and trigger a refresh on every resize interval.

The bounds check now converts the current canvas rectangle to page coordinates using the same calculation as updateBounds() before comparing it with the cached bounds.

Regression tests cover horizontal and vertical scrolling, document client borders, parent resizing, actual canvas movement, and fixed-position canvas settling.

Validated on Windows with:

  • npm test -- tests/scale/ScaleManager.test.js tests/scale/const
  • npm run build
  • node --check src/scale/ScaleManager.js
  • node --check tests/scale/ScaleManager.test.js
  • git diff --check

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.

ScaleManager getParentBounds triggers perpetual refresh() once page is scrolled

1 participant