Skip to content

E fits the highlighted nets as the layer table draws them (#137, #138, #139) - #141

Merged
Gherkin merged 3 commits into
mainfrom
issue-137-e-fits-drawn-layers
Oct 27, 2026
Merged

Gherkin merged 3 commits into
mainfrom
issue-137-e-fits-drawn-layers

Conversation

@Gherkin

@Gherkin Gherkin commented Oct 27, 2026 •

Copy link
Copy Markdown
Owner

Closes #137, closes #138, closes #139.

E (and zoom=selected) now fits the highlighted nets as they are drawn. It uses the layer table the same way the drawing does.

  • New check: netCopperShows(l, kind) in app.js. A net's copper on a layer counts when the layer is on, or when it is off with "Net" ticked. Only the kinds ticked on that row count (tracks, zones, vias, pads).
  • Every layer, both views: each copper layer is drawn on both canvases, so E judges each one by that check. It no longer counts inner tracks just because the view is F, and no longer drops the far side or the inner layers on the back view.
  • Pads: same rule as the drawing. All pads on the side in view, and on the far side only those of parts on that side.
  • Zones: now counted (E never fits zones #139). The worker already worked out a box for each zone. It now sends those boxes to the page in its ready message. The page cannot load the worker's code, so this avoids a second copy of the SVG path parser.
  • Tracks: counted by their box, widened by half the track width. An arc counts as its whole circle, which is never smaller than the arc.
  • Pinned parts: their box is now turned by the part's angle, as the drawing turns it. Before, a part at ±90° was fitted with width and height swapped. New helper footprintCorners(fp) in render.js.
  • No change: markers, and which nets count.

The fit code moved out of zoomFitSelected into fitPoints(side), so the tests can read it.

Tests

  • New tests/browser/fit.spec.js: an inner layer off/on/Net-only, the side in view off, the far side with Net, an inner layer seen from the back, zones with zones on and off, a pinned part at 90°, and E pressed end to end. It uses three nets from the netdaq fixture whose copper reaches outside their copper on F. A check in the file confirms they still do.
  • npx playwright test: 145 passed, 1 timed out ("an inner layer checkbox changes both sides"). This is the known flaky test. It passed 3 of 3 when run alone.
  • npm run test:api: OK.

🤖 Generated with Claude Code

https://claude.ai/code/session_01UCbPYsA5LYNX8HZaGGZCpK

@github-actions

github-actions Bot commented Oct 27, 2026 •

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UCbPYsA5LYNX8HZaGGZCpK
@Gherkin

Gherkin commented Oct 27, 2026

Copy link
Copy Markdown
Owner Author

Review, round 1 — 1 finding.

  • web/app.js:1635 — a zoom=selected link fits before the worker's ready message, so zoneBox() (web/render.js:1535) returns null and zones are left out. Shown with +5V_USB, copper=F: the link's view starts at y=75.35, the zone at y=70. Pressing E after load fits it. The new E fits zones test calls fitPoints() after load, so it does not catch this.

Fix pushed: workerReady promise in web/render.js, resolved on ready; the link's zoom awaits it. New test a zoom=selected link fits zones (fails without the fix).

Checked and fine: pad/track/via/zone rules match drawHighlightsOnLayer, drawInnerLayer and drawHiddenNet in render-worker.js; footprintCorners turns the same way as drawFootprint; arcs and vias are split as the worker splits them.

The link applied its zoom before the worker's ready message, so E had
no zone boxes yet and left zones out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UCbPYsA5LYNX8HZaGGZCpK
@Gherkin

Gherkin commented Oct 27, 2026

Copy link
Copy Markdown
Owner Author

Review, round 2 (61264d6 only) — 2 findings, both FYI, not fixed.

  • web/app.js:1636 — the await workerReady sits inside the _applyingLink = true block. A setting changed during worker init is not saved, and recordLinkOverrides (web/app.js:1642) then treats it as the link's. Not fixed: the window is worker init, before the board is first drawn. Moving the wait above _applyingLink = true would close it, but that changes when every zoom link waits.
  • web/app.js:1636 — if the worker never sends ready (crash in init), applyHashState never returns. Init after web/app.js:1912 (search inputs, list keys) is never set up. Not fixed: with no ready nothing is drawn either, and initWorker (web/render.js:45) has no onerror path today.

Checked and fine: _resolveWorkerReady() runs before renderBuffers, so the awaited zoom() posts after the first render and postRender marks it dirty; one extra render, no lost view. The new test fails without the fix (per round 1).

@Gherkin
Gherkin merged commit 57f37a4 into main Oct 27, 2026
10 checks passed
@Gherkin
Gherkin deleted the issue-137-e-fits-drawn-layers branch October 27, 2026 19:45
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.

E never fits zones E skips highlighted nets on Net-only layers E fits copper on layers that are off

1 participant