Skip to content

fix(onet): make the connecting line visible - #306

Merged
slaveofcode merged 1 commit into
developfrom
fix/onet-line
Aug 21, 2026
Merged

fix(onet): make the connecting line visible#306
slaveofcode merged 1 commit into
developfrom
fix/onet-line

Conversation

@slaveofcode

Copy link
Copy Markdown
Owner

You were right — no line appeared on a match. Two bugs:

1. The line was invisible, not missing. strokeWidth={0.14} combined with vectorEffect="non-scaling-stroke" means 0.14 screen pixels, not 0.14 cells. It was rendering the whole time, just sub-pixel thin.

2. The overlay was mispositioned. Its hand-picked -8% / 116% offsets didn't match the viewBox (8 columns needs -12.5% / 125%) and ignored the grid's 2px gap and padding — so even at a visible width it would have been off.

Fix: the path is now converted to pixel centres measured from the real cells (extrapolating the cell pitch to handle the one-cell margin) and drawn in the grid's own pixel space with overflow-visible. That lines up exactly at any board size or difficulty, and routes that leave the board still render. Added a dark halo behind the line plus endpoint dots so it reads on any tile colour, and lengthened the flash 240ms → 420ms.

Verified in a browser, not just asserted: captured mid-flash, the polyline renders 101.5,34.5 → 101.5,-32.5 → 369.5,-32.5 → 369.5,34.5 — a 2-turn route going up out of the board and back down (negative y = the outside margin), 268×67px.

Note: because a route can legitimately travel outside the board, the flash briefly overlaps the stat chips above the grid. I left it — it actually communicates the outside-border rule, and reserving a full cell of clearance would cost ~67px of permanent dead space. Happy to add clearance if you'd rather.

  • Tests: 1731 passing · Lint: 0 errors · Build green

The line was drawn but invisible: strokeWidth 0.14 combined with
vectorEffect='non-scaling-stroke' meant 0.14 SCREEN pixels, not 0.14
cells. The overlay was also mispositioned — its hand-picked -8%/116%
offsets didn't match the viewBox (8 columns needs -12.5%/125%) and
ignored the grid's gap and padding.

Now the path is converted to pixel centres measured from the real cells
(extrapolating the cell pitch for the one-cell margin), drawn in the
grid's own pixel space with overflow visible, so it lines up exactly at
any board size and routes that leave the board still show. Added a dark
halo behind the line plus endpoint dots for contrast on any tile, and
lengthened the flash from 240ms to 420ms so it is actually seen.
@slaveofcode
slaveofcode merged commit fb55565 into develop Aug 21, 2026
1 check passed
@slaveofcode
slaveofcode deleted the fix/onet-line branch August 21, 2026 14:27
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.

1 participant