fix(anatomy): V1-2.2 refuse zones without a usable interior

A polygon or path zone or trigger must fill a disc of 4 CSS px on the
320 x 568 preview under the layer's nonzero rule, stroke left out:
conservative widest-disc search on the flattened outline, caps and a
per-sheet budget, closed codes interior_too_small and
marker_interior_too_small. Browser probe on six projects.
This commit is contained in:
bchanot committed 2026-11-01 12:19:08 +01:00
1 parent de2dfb392e
commit 8dd2d78d38
18 files changed
+1852 -38

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="fr">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Interior harness</title>
</head>
<body style="margin: 0">
<div id="root"></div>
<script type="module" src="./interior.ts"></script>
</body>
</html>
+33
View File
@@ -0,0 +1,33 @@
/**
* Test page for the interior rule in a real browser (e2e/ui/interior-clicks.spec.ts): the
* canvas the core composes for one probe case (e2e/fixtures/interior-probe.json, generated by
* crates/core/tests/interior_probe.rs) in the phone preview's 286 × 310 box, inserted as the
* editor inserts it (DOMParser, importNode), every click on a marker recorded. Served by the
* Vite dev server only (`/e2e/harness/interior.html?case=`); the build never ships it.
*/
import probe from '../fixtures/interior-probe.json'
const name = new URLSearchParams(location.search).get('case')
const found = probe.cases.find((c) => c.name === name)
if (!found) throw new Error(`no probe case ${String(name)}`)
const root = document.getElementById('root') as HTMLElement
const clicks = document.createElement('output')
clicks.dataset.testid = 'clicks'
clicks.style.cssText = 'display:block;height:24px;overflow:hidden'
const box = document.createElement('div')
box.dataset.testid = 'preview'
box.style.cssText = `width:${probe.frame.width}px;height:${probe.frame.height}px`
const parsed = new DOMParser().parseFromString(found.svg, 'image/svg+xml')
const svg = document.importNode(
parsed.documentElement,
true,
) as unknown as SVGSVGElement
svg.style.cssText = 'display:block;width:100%;height:100%'
box.append(svg)
root.append(clicks, box)
box.addEventListener('click', (event) => {
const marker = (event.target as Element).closest('[data-anno-id]')
const id = marker?.getAttribute('data-anno-id')
if (id) clicks.textContent = `${clicks.textContent ?? ''} ${id}`.trim()
})