Skip to content

Show the backdrop only where the buffer does not reach (#131, #130) - #132

Merged
Gherkin merged 2 commits into
mainfrom
backdrop-only-when-needed
Oct 27, 2026
Merged

Gherkin merged 2 commits into
mainfrom
backdrop-only-when-needed

Conversation

@Gherkin

@Gherkin Gherkin commented Oct 27, 2026

Copy link
Copy Markdown
Owner

Fixes #131. Fixes #130.

The buffer is see-through outside the board outline. The backdrop under it showed there all the time once it had been drawn:

The backdrop is now displayed only when the drawn part of the buffer does not cover the whole view. It is the same transform updateCSSTransform() uses.

  • bufferCoversView() in render.js. While overscan pieces are still to come, only the viewport rect of the render counts as drawn. When all pieces are in, the whole buffer counts.
  • updateBackdropTransform() sets display from that. It already runs on every pan, zoom and blit. blitPiece() calls it when the last piece is in.
  • blitBackdrop() sets _backdropReady instead of display: block. hideBackdrop() clears it.

This differs from the fix in #131, which waits for all overscan pieces before it hides the backdrop. Counting the viewport rect hides it at the first blit after a toggle, and that is what fixes #130. Hiding the backdrop on every key change, as #130 suggests, was not needed.

Tests

  • New: the backdrop is not displayed while the buffer covers the view, is displayed after a fast zoom out, and is hidden again after the renders.
  • New: with the worker's backdrop held back, a press on S leaves the old backdrop hidden.
  • The tests that used display === 'block' to mean "a backdrop for this view is drawn" now check _backdropReady. The resize test records hideBackdrop() calls, since display may already be none.
  • Both new tests fail on main.
  • Full Playwright suite: 132 passed, 1 timed out (an inner layer checkbox changes both sides). That test passes when run alone; it is the known flaky one. npm run test:api passes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01UCbPYsA5LYNX8HZaGGZCpK

@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-10-27 15:55 UTC

@Gherkin

Gherkin commented Oct 27, 2026

Copy link
Copy Markdown
Owner Author

Review, round 1.

  • web/render.js:319-321 bufferCoversView() divides by devicePixelRatio and compares to clientWidth. At a pixel ratio of 1.1 and a 1000 px wide view, the viewport rect gives 999.9999999999999 < 1000, so the view never counts as covered while pieces are pending, and the old backdrop shows after a toggle (Old backdrop shows at the board edge after a layer or colour toggle #130 at that ratio). Fix: compare in device pixels against clientWidth * devicePixelRatio, the same width postRender() sends the worker.

Back in CSS pixels the viewport rect came out a hair short of the view at
some pixel ratios (999.9999999999999 for 1000 px at 1.1). The view then
never counted as covered while pieces were pending, and the old backdrop
showed after a toggle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UCbPYsA5LYNX8HZaGGZCpK
@Gherkin
Gherkin merged commit ee4e656 into main Oct 27, 2026
10 checks passed
@Gherkin
Gherkin deleted the backdrop-only-when-needed branch October 27, 2026 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant