From 98441fae1598977f25a2b2d364fa467ad8b26dfd Mon Sep 17 00:00:00 2001 From: jay Date: Wed, 10 Jun 2026 21:43:28 -0400 Subject: [PATCH] Extract + unit-test the padding-aware cell geometry (Codex nice-to-have) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pulled the pointer→cell math out of cellAt() into a pure cellFromPoint(rect, x, y, n) in $lib/wordsearch.js (only getBoundingClientRect stays in the component), and covered it with vitest — including the last-column case that was drifting under the old overflowing layout, plus clamping and a scrolled-origin rect. 11 vitest tests now; real-device testing remains the final validator. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../src/lib/components/WordSearchGame.svelte | 9 ++---- frontend/src/lib/wordsearch.js | 13 +++++++++ frontend/src/lib/wordsearch.test.js | 28 ++++++++++++++++++- 3 files changed, 42 insertions(+), 8 deletions(-) diff --git a/frontend/src/lib/components/WordSearchGame.svelte b/frontend/src/lib/components/WordSearchGame.svelte index 349b28d..2599773 100644 --- a/frontend/src/lib/components/WordSearchGame.svelte +++ b/frontend/src/lib/components/WordSearchGame.svelte @@ -1,6 +1,6 @@