// Rust vs browser on the frame limits (owner brief 2026-11-01): each case is a composed canvas // (`frame_probe_generator.rs.txt`) with the core's f64 expectation of every visible disc (size and // centre in CSS px on the smallest preview box). The browser draws it in a box of that size, CSS as // AnatomyCanvas (svg max-width/max-height 100 %, centred); answers the largest size and centre gaps. import { createRequire } from 'node:module' import { readFileSync, readdirSync } from 'node:fs' const require = createRequire(process.argv[2] + '/apps/app/package.json') const pw = require('@playwright/test') const DIR = process.argv[3] const cases = readdirSync(DIR).filter((f) => f.endsWith('.json')).sort().map((f) => JSON.parse(readFileSync(`${DIR}/${f}`, 'utf8'))) for (const engine of process.argv[4].split(',')) { const browser = await pw[engine].launch() const page = await browser.newPage({ viewport: { width: 600, height: 600 } }) console.log(`== ${engine} ${browser.version()}`) for (const c of cases) { const [bw, bh] = c.box await page.setContent(`
${c.svg.replace(/^`) const got = await page.evaluate((markers) => { const svg = document.querySelector('#b svg'); const s = svg.getBoundingClientRect() // The hitbox (stroke none): Firefox counts a stroke in an element's client rect, the others do not. const boxes = [...svg.querySelectorAll('circle[pointer-events="visibleFill"]')] return markers.map((m) => { const t = boxes.find((e) => e.getAttribute('data-anno-id') === m.id); if (!t) return null const r = t.getBoundingClientRect(); return { size: r.width, cx: r.x + r.width / 2 - s.x, cy: r.y + r.height / 2 - s.y } }) }, c.markers) let size = 0, centre = 0 c.markers.forEach((m, i) => { const g = got[i]; if (!g) { size = Infinity; return } size = Math.max(size, Math.abs(g.size - m.hitbox) / m.hitbox); centre = Math.max(centre, Math.hypot(g.cx - m.cx, g.cy - m.cy)) }) const disc = Math.min(...c.markers.map((m) => m.size)) console.log(c.name.padEnd(30), c.core.padEnd(12), JSON.stringify({ core_disc_px: +disc.toPrecision(4), hitbox_size_gap_rel: +size.toPrecision(2), max_centre_gap_px: +centre.toPrecision(2) })) } await browser.close() }