1294 lines
60 KiB
Diff
1294 lines
60 KiB
Diff
diff --git a/apps/app/e2e/harness/canvas.html b/apps/app/e2e/harness/canvas.html
|
||
new file mode 100644
|
||
index 0000000..86ee85f
|
||
--- /dev/null
|
||
+++ b/apps/app/e2e/harness/canvas.html
|
||
@@ -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>Canvas harness</title>
|
||
+ </head>
|
||
+ <body>
|
||
+ <div id="root"></div>
|
||
+ <script type="module" src="./canvas.tsx"></script>
|
||
+ </body>
|
||
+</html>
|
||
diff --git a/apps/app/e2e/harness/canvas.tsx b/apps/app/e2e/harness/canvas.tsx
|
||
new file mode 100644
|
||
index 0000000..8f033c0
|
||
--- /dev/null
|
||
+++ b/apps/app/e2e/harness/canvas.tsx
|
||
@@ -0,0 +1,73 @@
|
||
+/**
|
||
+ * Test page for the editor canvas in a real browser (e2e/ui/canvas-clicks.spec.ts): the
|
||
+ * bundled equine sheet in AnatomyCanvas, its drawing's root given the attributes of the
|
||
+ * chosen `?drawing=` case, every click recorded. Served by the Vite dev server only
|
||
+ * (`/e2e/harness/canvas.html`); the build has a single entry, index.html, so this page
|
||
+ * never ships.
|
||
+ */
|
||
+import { StrictMode, useState } from 'react'
|
||
+import { createRoot } from 'react-dom/client'
|
||
+import '@/styles/index.css'
|
||
+import AnatomyCanvas from '@/components/canvas/AnatomyCanvas'
|
||
+import { bundledSheetProvider } from '@/sheets/provider'
|
||
+import { setSheetProvider, useSheet } from '@/sheets/useSheet'
|
||
+
|
||
+/**
|
||
+ * Root attributes of the drawing per case (V1-2.2 owner brief 2026-10-30, defect 2): the
|
||
+ * reported giant stroke, the same width with no stroke paint (an invisible enlarged
|
||
+ * surface), and the hiding stroke properties.
|
||
+ */
|
||
+const DRAWINGS: Record<string, string> = {
|
||
+ plain: '',
|
||
+ 'giant-stroke': 'stroke="#ff00ff" stroke-width="2000"',
|
||
+ 'invisible-stroke': 'stroke-width="2000"',
|
||
+ 'hidden-stroke': 'stroke="#ff00ff" stroke-width="2000" stroke-opacity="0"',
|
||
+}
|
||
+
|
||
+const params = new URLSearchParams(location.search)
|
||
+const rootAttrs = DRAWINGS[params.get('drawing') ?? 'plain'] ?? ''
|
||
+const viewId = params.get('view') ?? 'main'
|
||
+
|
||
+setSheetProvider({
|
||
+ async getReferenceSheet(speciesId) {
|
||
+ const sheet = await bundledSheetProvider.getReferenceSheet(speciesId)
|
||
+ if (!sheet || rootAttrs === '') return sheet
|
||
+ const assets = Object.fromEntries(
|
||
+ Object.entries(sheet.assets).map(([id, text]) => [
|
||
+ id,
|
||
+ text.replace('<svg ', `<svg ${rootAttrs} `),
|
||
+ ]),
|
||
+ )
|
||
+ return { ...sheet, assets }
|
||
+ },
|
||
+})
|
||
+
|
||
+function Harness() {
|
||
+ const sheet = useSheet('equine')
|
||
+ const [clicks, setClicks] = useState<string[]>([])
|
||
+ return (
|
||
+ <main className="p-4">
|
||
+ <h1 className="text-xl font-semibold">Canvas harness</h1>
|
||
+ {/* A fixed height: the canvas never moves when the first click is listed. */}
|
||
+ <output data-testid="clicks" className="block h-6 overflow-hidden">
|
||
+ {clicks.join(' ')}
|
||
+ </output>
|
||
+ <div style={{ width: 'min(1000px, 100%)', aspectRatio: '2073.4 / 1629.4' }}>
|
||
+ {sheet.status === 'ready' && (
|
||
+ <AnatomyCanvas
|
||
+ index={sheet.index}
|
||
+ viewId={viewId}
|
||
+ states={new Map()}
|
||
+ onZoneClick={(id) => setClicks((all) => [...all, id])}
|
||
+ />
|
||
+ )}
|
||
+ </div>
|
||
+ </main>
|
||
+ )
|
||
+}
|
||
+
|
||
+createRoot(document.getElementById('root') as HTMLElement).render(
|
||
+ <StrictMode>
|
||
+ <Harness />
|
||
+ </StrictMode>,
|
||
+)
|
||
diff --git a/apps/app/e2e/playwright.ui.config.ts b/apps/app/e2e/playwright.ui.config.ts
|
||
index 4b61a06..4ed2c31 100644
|
||
--- a/apps/app/e2e/playwright.ui.config.ts
|
||
+++ b/apps/app/e2e/playwright.ui.config.ts
|
||
@@ -1,11 +1,12 @@
|
||
/**
|
||
* `pnpm e2e:ui`: Chromium against a Vite dev server with no backend, on a
|
||
* loopback port of its own (never the owner's `pnpm dev` on 5173, never
|
||
- * reused): the Dialog test page and the local tool. docs/development/BROWSER_TESTS.md.
|
||
+ * reused): the Dialog test page, the local tool and the canvas click proof (also on
|
||
+ * Firefox and WebKit when installed). docs/development/BROWSER_TESTS.md.
|
||
*/
|
||
import { defineConfig } from '@playwright/test'
|
||
import type { GuardOptions } from './support/browser'
|
||
-import { PROJECTS } from './support/browser'
|
||
+import { CLICK_PROJECTS, PROJECTS } from './support/browser'
|
||
|
||
const ORIGIN = 'http://127.0.0.1:5191'
|
||
|
||
@@ -27,7 +28,7 @@ export default defineConfig<GuardOptions>({
|
||
trace: 'retain-on-failure',
|
||
screenshot: 'only-on-failure',
|
||
},
|
||
- projects: PROJECTS,
|
||
+ projects: [...PROJECTS, ...CLICK_PROJECTS],
|
||
webServer: {
|
||
command: 'node_modules/.bin/vite --host 127.0.0.1 --port 5191 --strictPort',
|
||
cwd: '..',
|
||
diff --git a/apps/app/e2e/support/browser.ts b/apps/app/e2e/support/browser.ts
|
||
index 674c418..fa5e182 100644
|
||
--- a/apps/app/e2e/support/browser.ts
|
||
+++ b/apps/app/e2e/support/browser.ts
|
||
@@ -3,11 +3,14 @@
|
||
* the two Chromium projects, the request guard every test runs under, the axe
|
||
* gate, and the focus and layout probes.
|
||
*/
|
||
+import { existsSync } from 'node:fs'
|
||
import AxeBuilder from '@axe-core/playwright'
|
||
import {
|
||
devices,
|
||
expect,
|
||
+ firefox,
|
||
test as base,
|
||
+ webkit,
|
||
type Page,
|
||
type Project,
|
||
} from '@playwright/test'
|
||
@@ -37,6 +40,51 @@ export const PROJECTS: Project[] = [
|
||
},
|
||
]
|
||
|
||
+/**
|
||
+ * The canvas click proof (V1-2.2, e2e/ui/canvas-clicks.spec.ts) also runs on Firefox and
|
||
+ * WebKit, desktop, and on the WebKit phone, when the pinned engine is installed
|
||
+ * (`playwright install firefox webkit`, no sudo, never `--with-deps`). A missing engine is
|
||
+ * named in the run's output, never passed silently.
|
||
+ */
|
||
+const CANVAS_CLICKS = /canvas-clicks\.spec\.ts$/
|
||
+
|
||
+function installed(name: string, executable: string): boolean {
|
||
+ const present = existsSync(executable)
|
||
+ if (!present) console.warn(`canvas clicks: ${name} is not installed, its projects do not run`)
|
||
+ return present
|
||
+}
|
||
+
|
||
+export const CLICK_PROJECTS: Project[] = [
|
||
+ ...(installed('firefox', firefox.executablePath())
|
||
+ ? [
|
||
+ {
|
||
+ name: 'firefox-desktop',
|
||
+ testMatch: CANVAS_CLICKS,
|
||
+ grepInvert: /@phone/,
|
||
+ use: { ...devices['Desktop Firefox'], viewport: { width: 1280, height: 800 } },
|
||
+ },
|
||
+ ]
|
||
+ : []),
|
||
+ ...(installed('webkit', webkit.executablePath())
|
||
+ ? [
|
||
+ {
|
||
+ name: 'webkit-desktop',
|
||
+ testMatch: CANVAS_CLICKS,
|
||
+ grepInvert: /@phone/,
|
||
+ use: { ...devices['Desktop Safari'], viewport: { width: 1280, height: 800 } },
|
||
+ },
|
||
+ {
|
||
+ name: 'webkit-375',
|
||
+ testMatch: CANVAS_CLICKS,
|
||
+ use: {
|
||
+ ...devices['iPhone SE'],
|
||
+ viewport: { width: 375, height: 667 },
|
||
+ },
|
||
+ },
|
||
+ ]
|
||
+ : []),
|
||
+]
|
||
+
|
||
export interface GuardOptions {
|
||
/** Origins the page may reach; every other request is aborted and fails the test. */
|
||
allowedOrigins: string[]
|
||
diff --git a/apps/app/e2e/tsconfig.json b/apps/app/e2e/tsconfig.json
|
||
index ea6716e..3bae59f 100644
|
||
--- a/apps/app/e2e/tsconfig.json
|
||
+++ b/apps/app/e2e/tsconfig.json
|
||
@@ -7,5 +7,5 @@
|
||
"@/*": ["src/*"]
|
||
}
|
||
},
|
||
- "include": ["."]
|
||
+ "include": [".", "../src/sheets/virtual-sheet.d.ts"]
|
||
}
|
||
diff --git a/apps/app/e2e/ui/canvas-clicks.spec.ts b/apps/app/e2e/ui/canvas-clicks.spec.ts
|
||
new file mode 100644
|
||
index 0000000..848f59d
|
||
--- /dev/null
|
||
+++ b/apps/app/e2e/ui/canvas-clicks.spec.ts
|
||
@@ -0,0 +1,133 @@
|
||
+import { expect, test } from '../support/browser'
|
||
+import type { Page } from '@playwright/test'
|
||
+
|
||
+// V1-2.2 owner brief 2026-10-30, defect 2: a click on the editor canvas records the marker
|
||
+// under the pointer, never another one, whatever stroke the drawing's root sets. Real
|
||
+// clicks (taps on the phone project) on the bundled equine sheet in AnatomyCanvas
|
||
+// (e2e/harness/canvas.tsx); run on Chromium, Firefox and WebKit when installed.
|
||
+
|
||
+/**
|
||
+ * The points of the equine main view whose visible disc no other marker covers, in document
|
||
+ * order. The three vertebral junctions sit on the edge of a zone painted after them: part of
|
||
+ * their disc records the zone (pre-existing, owner decision, see the fixme below).
|
||
+ */
|
||
+const POINTS = [
|
||
+ 'hind-fetlock',
|
||
+ 'hock',
|
||
+ 'stifle',
|
||
+ 'hip',
|
||
+ 'sacroiliac',
|
||
+ 'shoulder',
|
||
+ 'elbow',
|
||
+ 'carpus',
|
||
+ 'fore-fetlock',
|
||
+ 'fore-sesamoids',
|
||
+]
|
||
+const JUNCTIONS = ['l6-s1', 't18-l1', 'c7-t1']
|
||
+const DRAWINGS = ['plain', 'giant-stroke', 'invisible-stroke', 'hidden-stroke']
|
||
+
|
||
+type Point = { x: number; y: number }
|
||
+
|
||
+async function open(page: Page, drawing: string) {
|
||
+ await page.goto(`/e2e/harness/canvas.html?drawing=${drawing}`)
|
||
+ await expect(
|
||
+ page.locator('[data-testid="anatomy-canvas"] [data-anno-id="hock"]').first(),
|
||
+ ).toBeAttached()
|
||
+}
|
||
+
|
||
+/** The centre of a marker's visible shape on screen (a point's twin shares its hitbox's). */
|
||
+async function centreOf(page: Page, id: string): Promise<Point> {
|
||
+ const box = await page
|
||
+ .locator(`[data-testid="anatomy-canvas"] [data-anno-id="${id}"]`)
|
||
+ .last()
|
||
+ .boundingBox()
|
||
+ if (!box) throw new Error(`${id} has no box`)
|
||
+ return { x: box.x + box.width / 2, y: box.y + box.height / 2 }
|
||
+}
|
||
+
|
||
+async function press(page: Page, at: Point, touch: boolean) {
|
||
+ if (touch) await page.touchscreen.tap(at.x, at.y)
|
||
+ else await page.mouse.click(at.x, at.y)
|
||
+}
|
||
+
|
||
+/** The ids recorded by the clicks so far. */
|
||
+async function recorded(page: Page): Promise<string[]> {
|
||
+ const text = (await page.getByTestId('clicks').textContent()) ?? ''
|
||
+ return text.split(' ').filter(Boolean)
|
||
+}
|
||
+
|
||
+async function clickRecords(page: Page, at: Point, touch = false) {
|
||
+ const before = (await recorded(page)).length
|
||
+ await press(page, at, touch)
|
||
+ // A click that records nothing leaves the list as it was; wait out the handler.
|
||
+ await page.waitForTimeout(50)
|
||
+ return (await recorded(page)).slice(before)
|
||
+}
|
||
+
|
||
+test.describe('canvas clicks', () => {
|
||
+ for (const drawing of DRAWINGS) {
|
||
+ test(`a click on the hock records the hock (${drawing})`, async ({ page }, info) => {
|
||
+ await open(page, drawing)
|
||
+ const touch = info.project.use.hasTouch === true
|
||
+ expect(await clickRecords(page, await centreOf(page, 'hock'), touch)).toEqual(['hock'])
|
||
+ })
|
||
+
|
||
+ test(`every point clear of the zones records itself (${drawing})`, async ({ page }) => {
|
||
+ await open(page, drawing)
|
||
+ for (const id of POINTS) {
|
||
+ expect(await clickRecords(page, await centreOf(page, id)), id).toEqual([id])
|
||
+ }
|
||
+ })
|
||
+
|
||
+ test(`a click on the drawing away from the markers records nothing (${drawing})`, async ({
|
||
+ page,
|
||
+ }) => {
|
||
+ await open(page, drawing)
|
||
+ const box = await page.getByTestId('anatomy-canvas').boundingBox()
|
||
+ if (!box) throw new Error('no canvas')
|
||
+ // The top left corner and the middle of the belly hold no marker.
|
||
+ for (const [fx, fy] of [
|
||
+ [0.03, 0.05],
|
||
+ [0.5, 0.55],
|
||
+ ] as const) {
|
||
+ const at = { x: box.x + box.width * fx, y: box.y + box.height * fy }
|
||
+ expect(await clickRecords(page, at), `${fx},${fy}`).toEqual([])
|
||
+ }
|
||
+ })
|
||
+ }
|
||
+
|
||
+ test('two close points each record themselves, their shared edge goes to the later one', async ({
|
||
+ page,
|
||
+ }) => {
|
||
+ await open(page, 'giant-stroke')
|
||
+ const fetlock = await centreOf(page, 'fore-fetlock')
|
||
+ const sesamoids = await centreOf(page, 'fore-sesamoids')
|
||
+ expect(await clickRecords(page, fetlock)).toEqual(['fore-fetlock'])
|
||
+ expect(await clickRecords(page, sesamoids)).toEqual(['fore-sesamoids'])
|
||
+ // Halfway, outside both visible discs and inside both hitboxes: document order, the
|
||
+ // later marker is on top. One id, never two.
|
||
+ const half = { x: (fetlock.x + sesamoids.x) / 2, y: (fetlock.y + sesamoids.y) / 2 }
|
||
+ expect(await clickRecords(page, half)).toEqual(['fore-sesamoids'])
|
||
+ })
|
||
+
|
||
+ test('a click on a vertebral junction records the junction', async ({ page }) => {
|
||
+ test.fixme(
|
||
+ true,
|
||
+ 'V1-2.2 finding: the zones are painted and hit after the points; c7-t1 records « thoracic » at its centre in Firefox and WebKit, and up to half of each junction disc records a zone in every engine (owner decision on the capture order)',
|
||
+ )
|
||
+ await open(page, 'plain')
|
||
+ for (const id of JUNCTIONS) {
|
||
+ expect(await clickRecords(page, await centreOf(page, id)), id).toEqual([id])
|
||
+ }
|
||
+ })
|
||
+
|
||
+ // @phone: the desktop projects leave it out (grepInvert), the touch projects run it.
|
||
+ test('a tap on the hock records the hock @phone', async ({ page }) => {
|
||
+ for (const drawing of DRAWINGS) {
|
||
+ await open(page, drawing)
|
||
+ expect(await clickRecords(page, await centreOf(page, 'hock'), true), drawing).toEqual([
|
||
+ 'hock',
|
||
+ ])
|
||
+ }
|
||
+ })
|
||
+})
|
||
diff --git a/apps/app/tests/helpers/svgTree.ts b/apps/app/tests/helpers/svgTree.ts
|
||
index 990e7e0..acf678c 100644
|
||
--- a/apps/app/tests/helpers/svgTree.ts
|
||
+++ b/apps/app/tests/helpers/svgTree.ts
|
||
@@ -126,3 +126,49 @@ export function withIdsScopedPerView(tree: unknown, viewId: string): unknown {
|
||
visit(copy)
|
||
return copy
|
||
}
|
||
+
|
||
+const HITBOX_DECLARED = { stroke: 'none', 'pointer-events': 'visibleFill' }
|
||
+
|
||
+/** A point hitbox of the R3 layer: a circle capturing on `all` with no stroke of its own. */
|
||
+function isR3Hitbox(node: unknown): node is { name: string; attrs: Record<string, string> } {
|
||
+ const n = node as { name?: string; attrs?: Record<string, string> }
|
||
+ return n.name === 'circle' && n.attrs?.['pointer-events'] === 'all' && !('stroke' in n.attrs)
|
||
+}
|
||
+
|
||
+/**
|
||
+ * Owner brief 2026-10-30 (V1-2.2, three MEDIUM): each point hitbox the composers draw declares
|
||
+ * `stroke="none"` and `pointer-events="visibleFill"`. Applied to a frozen layer (a deep copy).
|
||
+ * Mirrors `crates/core/tests/common/svg_tree.rs`.
|
||
+ */
|
||
+export function withDeclaredHitboxes(layer: unknown): unknown {
|
||
+ const copy = structuredClone(layer) as { children?: unknown[] }
|
||
+ for (const child of copy.children ?? []) {
|
||
+ if (isR3Hitbox(child)) Object.assign(child.attrs, HITBOX_DECLARED)
|
||
+ }
|
||
+ return copy
|
||
+}
|
||
+
|
||
+/**
|
||
+ * Owner brief 2026-10-30 (V1-2.2, three MEDIUM): the composition root is the engine's. Applied
|
||
+ * to a frozen canvas tree (a deep copy): the root keeps its namespaces and `viewBox`; its other
|
||
+ * attributes and every child before the layer go into a `<g>` of the drawing; the layer's
|
||
+ * hitboxes are declared (`withDeclaredHitboxes`). Mirrors `crates/core/tests/common/svg_tree.rs`.
|
||
+ */
|
||
+export function withIsolatedLayer(tree: unknown): unknown {
|
||
+ const root = structuredClone(tree) as {
|
||
+ ns: string
|
||
+ attrs: Record<string, string>
|
||
+ children: unknown[]
|
||
+ }
|
||
+ const layer = root.children.pop()
|
||
+ const kept: Record<string, string> = {}
|
||
+ const moved: Record<string, string> = {}
|
||
+ for (const [name, value] of Object.entries(root.attrs)) {
|
||
+ if (name === 'xmlns' || name === 'xmlns:xlink' || name === 'viewBox') kept[name] = value
|
||
+ else moved[name] = value
|
||
+ }
|
||
+ const group = { ns: root.ns, name: 'g', attrs: moved, children: root.children }
|
||
+ root.attrs = kept
|
||
+ root.children = [group, withDeclaredHitboxes(layer)]
|
||
+ return root
|
||
+}
|
||
diff --git a/apps/app/tests/unit/canvas.trees.test.tsx b/apps/app/tests/unit/canvas.trees.test.tsx
|
||
index 93426a8..8482cd4 100644
|
||
--- a/apps/app/tests/unit/canvas.trees.test.tsx
|
||
+++ b/apps/app/tests/unit/canvas.trees.test.tsx
|
||
@@ -21,7 +21,9 @@ import {
|
||
import {
|
||
checkR3Golden,
|
||
treeOf,
|
||
+ withDeclaredHitboxes,
|
||
withIdsScopedPerView,
|
||
+ withIsolatedLayer,
|
||
withTriggerNamesPerLanguage,
|
||
type TreeNode,
|
||
} from '../helpers/svgTree'
|
||
@@ -82,9 +84,10 @@ describe.each(VIEWS)('the %s canvas', (viewId) => {
|
||
it('builds the frozen tree with no state', () => {
|
||
const build = buildViewSvg(sheet, viewId)
|
||
if (!build.ok) throw new Error(`canvas ${viewId}: ${build.failure}`)
|
||
- // and the owner's decision 2026-10-29: the drawing's ids scoped to the view
|
||
+ // and the owner's decision 2026-10-29: the drawing's ids scoped to the view; the brief
|
||
+ // 2026-10-30: the composition root is the engine's, the hitboxes declared
|
||
checkR3Golden(`canvas.${viewId}.json`, treeOf(build.svg), (frozen) =>
|
||
- withIdsScopedPerView(declared(frozen), viewId),
|
||
+ withIsolatedLayer(withIdsScopedPerView(declared(frozen), viewId)),
|
||
)
|
||
})
|
||
|
||
@@ -94,6 +97,13 @@ describe.each(VIEWS)('the %s canvas', (viewId) => {
|
||
layers[name] = await mountedLayer(viewId, states)
|
||
}
|
||
expect(Object.keys(layers).length).toBeGreaterThan(8)
|
||
- checkR3Golden(`canvas.${viewId}.layers.json`, layers, declared)
|
||
+ checkR3Golden(`canvas.${viewId}.layers.json`, layers, (frozen) =>
|
||
+ Object.fromEntries(
|
||
+ Object.entries(declared(frozen) as Record<string, unknown>).map(([name, layer]) => [
|
||
+ name,
|
||
+ withDeclaredHitboxes(layer),
|
||
+ ]),
|
||
+ ),
|
||
+ )
|
||
})
|
||
})
|
||
diff --git a/crates/core/src/anatomy/compose.rs b/crates/core/src/anatomy/compose.rs
|
||
index 457f4b0..ca990c7 100644
|
||
--- a/crates/core/src/anatomy/compose.rs
|
||
+++ b/crates/core/src/anatomy/compose.rs
|
||
@@ -1,9 +1,9 @@
|
||
//! Composition of one view (`docs/ANNOTATION-RENDERING.md`): the sanitised drawing framed on
|
||
//! the view, with its annotation layer last. Two forms, as the TypeScript has them: the
|
||
-//! editor canvas (`apps/app/src/anatomy/drawing.ts`: a fresh root, `0 0 100 100` when no box
|
||
-//! is known, the interactive layer) and the PDF highlight (`packages/anatomy/src/render/
|
||
-//! compose.ts`: the asset's root framed in place, the selected markers only, recoloured, the
|
||
-//! halo filter on request). Both take a sanitised tree, never text.
|
||
+//! editor canvas (`apps/app/src/anatomy/drawing.ts`: `0 0 100 100` when no frame is known, the
|
||
+//! interactive layer) and the PDF highlight (`packages/anatomy/src/render/compose.ts`: no
|
||
+//! `viewBox` when no frame is known, the selected markers only, recoloured, the halo filter on
|
||
+//! request). Both take a sanitised tree, never text.
|
||
//!
|
||
//! The canvas is inlined into the page, where `#id` resolves against the whole document: its
|
||
//! ids and the references to them are scoped to the view (`fv.<view id>.<id>`, owner decision
|
||
@@ -13,19 +13,23 @@
|
||
//! own and keeps the drawing's ids, so it never holds one the composition writes
|
||
//! (`svg::refs::RESERVED_IDS`, the halo filter): the reader refuses such a drawing and both
|
||
//! composers refuse such a tree.
|
||
-//! Both forms append the marker layer as the root's last child, so the root never hides it: a
|
||
-//! root `visibility` other than `visible` is refused by the reader and by both composers.
|
||
-//! Both frame the view on `frame::view_frame` (the view's box, else the drawing's `viewBox` read
|
||
-//! as a browser reads it), the frame the verdict and the preview measure the annotations against
|
||
-//! (V1-2.2 owner brief 2026-10-30, defect 3); the canvas falls back to `0 0 100 100`, the PDF
|
||
-//! view to no `viewBox`. The drawing's `preserveAspectRatio` is dropped: the default
|
||
-//! `xMidYMid meet` shows the whole frame whatever the box (a `slice` would crop it where the
|
||
-//! raster's aspect is clamped or the canvas box is not the frame's).
|
||
+//!
|
||
+//! The composition root is the engine's (V1-2.2 owner brief 2026-10-30): the namespaces and the
|
||
+//! frame only. The frame is `frame::view_frame` (the view's box, else the drawing's `viewBox` read
|
||
+//! as a browser reads it), the one the verdict and the preview measure the annotations against;
|
||
+//! with no `preserveAspectRatio` the default `xMidYMid meet` shows the whole frame whatever the
|
||
+//! box. The drawing's root becomes a
|
||
+//! `<g>` keeping its other attributes and its children, and the marker layer (and the PDF's halo
|
||
+//! filter, in a `<defs>` of the engine) are appended as that group's siblings: no property the
|
||
+//! drawing sets, inherited (`stroke-width`, `stroke-opacity`, `stroke-dasharray`, `fill-rule`,
|
||
+//! `visibility`…) or acting on a whole group (`opacity`, `display`), reaches a marker or the
|
||
+//! halo. A root `visibility` other than `visible` stays refused by the reader and by both
|
||
+//! composers (accepted fix of 2026-10-30).
|
||
|
||
use std::collections::HashSet;
|
||
|
||
use super::frame::view_frame;
|
||
-use super::layer::{LayerError, find_view, render_layer};
|
||
+use super::layer::{LayerError, find_view, render_composed_layer};
|
||
pub use super::svg::refs::HALO_FILTER_ID;
|
||
use super::svg::refs::holds_reserved_id;
|
||
use super::svg::sanitize::check_root_visibility;
|
||
@@ -54,8 +58,9 @@ pub enum ComposeError {
|
||
/// composes it. Fail-closed: the reader refuses it (`reserved_id`), so only a tree that did
|
||
/// not come out of `read_svg` reaches it, a composed view given back included.
|
||
ReservedId,
|
||
- /// The drawing's root carries a `visibility` other than `visible`, which the marker layer
|
||
- /// would inherit. Fail-closed: the reader refuses it (`root_visibility`).
|
||
+ /// The drawing's root carries a `visibility` other than `visible` (the marker layer inherited
|
||
+ /// it before the root became the engine's). Fail-closed: the reader refuses it
|
||
+ /// (`root_visibility`).
|
||
RootVisibility,
|
||
}
|
||
|
||
@@ -98,32 +103,62 @@ pub fn compose_canvas(
|
||
if check_root_visibility(asset).is_err() {
|
||
return Err(ComposeError::RootVisibility);
|
||
}
|
||
- let mut root = Element {
|
||
- qname: "svg".to_owned(),
|
||
- namespace: asset.namespace.clone(),
|
||
- attrs: asset
|
||
- .attrs
|
||
- .iter()
|
||
- .filter(|a| !matches!(a.qname.as_str(), "width" | "height" | "preserveAspectRatio"))
|
||
- .cloned()
|
||
- .collect(),
|
||
- children: asset.children.clone(),
|
||
- };
|
||
let view_box = view_frame(view, asset).map_or_else(
|
||
|| CANVAS_FALLBACK_VIEW_BOX.to_owned(),
|
||
|frame| frame.view_box(),
|
||
);
|
||
- root.set_attr("viewBox", view_box);
|
||
+ let mut root = isolated(asset.clone(), Some(view_box));
|
||
let scope = id_scope(view_id);
|
||
scope_ids(&mut root, &scope);
|
||
if !references_scoped(&root, &scope) {
|
||
return Err(ComposeError::UnscopedReference);
|
||
}
|
||
- let layer = render_layer(document, view_id, &HashSet::new())?;
|
||
+ let layer = render_composed_layer(document, view_id, &HashSet::new())?;
|
||
root.children.push(Node::Element(checked(layer)?));
|
||
Ok(root)
|
||
}
|
||
|
||
+/// Root attributes with no meaning on a `<g>`: the frame is the engine's, the size is the
|
||
+/// page's or the raster's.
|
||
+const ROOT_ONLY: [&str; 7] = [
|
||
+ "viewBox",
|
||
+ "preserveAspectRatio",
|
||
+ "version",
|
||
+ "width",
|
||
+ "height",
|
||
+ "x",
|
||
+ "y",
|
||
+];
|
||
+
|
||
+/// The composition root framed on `view_box`, holding the drawing as its one child: a `<g>`
|
||
+/// with the drawing root's attributes (namespace declarations and `ROOT_ONLY` aside) and its
|
||
+/// children. The caller appends the engine's elements after it.
|
||
+fn isolated(asset: Element, view_box: Option<String>) -> Element {
|
||
+ let (namespaces, attrs): (Vec<_>, Vec<_>) = asset
|
||
+ .attrs
|
||
+ .into_iter()
|
||
+ .partition(|a| a.qname == "xmlns" || a.qname == "xmlns:xlink");
|
||
+ let drawing = Element {
|
||
+ qname: "g".to_owned(),
|
||
+ namespace: asset.namespace.clone(),
|
||
+ attrs: attrs
|
||
+ .into_iter()
|
||
+ .filter(|a| !ROOT_ONLY.contains(&a.qname.as_str()))
|
||
+ .collect(),
|
||
+ children: asset.children,
|
||
+ };
|
||
+ let mut root = Element {
|
||
+ qname: "svg".to_owned(),
|
||
+ namespace: asset.namespace,
|
||
+ attrs: namespaces,
|
||
+ children: vec![Node::Element(drawing)],
|
||
+ };
|
||
+ if let Some(view_box) = view_box {
|
||
+ root.set_attr("viewBox", view_box);
|
||
+ }
|
||
+ root
|
||
+}
|
||
+
|
||
/// The prefix of a view's ids in its canvas. Stable ids hold no `.`, so the scope of one view
|
||
/// is never the start of another's, and no page id starts with `fv.`.
|
||
pub fn id_scope(view_id: &str) -> String {
|
||
@@ -180,7 +215,7 @@ fn scope_ids(element: &mut Element, scope: &str) {
|
||
pub fn compose_highlight(
|
||
document: &AnatomicalSheetDocument,
|
||
view_id: &str,
|
||
- mut asset: Element,
|
||
+ asset: Element,
|
||
annotation_ids: &HashSet<&str>,
|
||
halo: bool,
|
||
) -> Result<Element, ComposeError> {
|
||
@@ -191,20 +226,16 @@ pub fn compose_highlight(
|
||
if check_root_visibility(&asset).is_err() {
|
||
return Err(ComposeError::RootVisibility);
|
||
}
|
||
- match view_frame(view, &asset) {
|
||
- Some(frame) => asset.set_attr("viewBox", frame.view_box()),
|
||
- None => asset.remove_attr("viewBox"),
|
||
- }
|
||
- asset.remove_attr("width");
|
||
- asset.remove_attr("height");
|
||
- asset.remove_attr("preserveAspectRatio");
|
||
+ let view_box = view_frame(view, &asset).map(|frame| frame.view_box());
|
||
+ let mut root = isolated(asset, view_box);
|
||
if halo {
|
||
- add_halo_filter(&mut asset);
|
||
+ let defs = Element::svg("defs", Vec::new(), vec![Node::Element(halo_filter())]);
|
||
+ root.children.push(Node::Element(defs));
|
||
}
|
||
- let layer = render_layer(document, view_id, &HashSet::new())?;
|
||
+ let layer = render_composed_layer(document, view_id, &HashSet::new())?;
|
||
let layer = highlight_layer(layer, annotation_ids, halo);
|
||
- asset.children.push(Node::Element(checked(layer)?));
|
||
- Ok(asset)
|
||
+ root.children.push(Node::Element(checked(layer)?));
|
||
+ Ok(root)
|
||
}
|
||
|
||
/// The layer reduced to the selected annotations, recoloured, every `data-*` dropped.
|
||
@@ -235,31 +266,6 @@ fn highlight_element(mut element: Element, halo: bool) -> Element {
|
||
element
|
||
}
|
||
|
||
-/// The halo filter in the first `<defs>` of the drawing, else in a new `<defs>` placed first.
|
||
-fn add_halo_filter(root: &mut Element) {
|
||
- if !append_to_first_defs(root) {
|
||
- let defs = Element::svg("defs", Vec::new(), vec![Node::Element(halo_filter())]);
|
||
- root.children.insert(0, Node::Element(defs));
|
||
- }
|
||
-}
|
||
-
|
||
-/// Appends the halo to the first `<defs>` below `element` (document order).
|
||
-fn append_to_first_defs(element: &mut Element) -> bool {
|
||
- for child in &mut element.children {
|
||
- let Node::Element(child) = child else {
|
||
- continue;
|
||
- };
|
||
- if child.qname == "defs" {
|
||
- child.children.push(Node::Element(halo_filter()));
|
||
- return true;
|
||
- }
|
||
- if append_to_first_defs(child) {
|
||
- return true;
|
||
- }
|
||
- }
|
||
- false
|
||
-}
|
||
-
|
||
fn halo_filter() -> Element {
|
||
let blur = |std: &str, result: &str| {
|
||
Node::Element(Element::svg(
|
||
diff --git a/crates/core/src/anatomy/layer.rs b/crates/core/src/anatomy/layer.rs
|
||
index 407efeb..0e4bb77 100644
|
||
--- a/crates/core/src/anatomy/layer.rs
|
||
+++ b/crates/core/src/anatomy/layer.rs
|
||
@@ -27,14 +27,38 @@ pub fn find_view<'a>(
|
||
}
|
||
|
||
/// `renderAnnotationLayer({ document, viewId, states })`: `states` holds the ids marked
|
||
-/// `data-state="current"`.
|
||
+/// `data-state="current"`. The R3 tree, kept for the seed review drawings
|
||
+/// (`curation::draft::app_review`); the composers draw `render_composed_layer`.
|
||
pub fn render_layer(
|
||
document: &AnatomicalSheetDocument,
|
||
view_id: &str,
|
||
states: &HashSet<&str>,
|
||
+) -> Result<Element, LayerError> {
|
||
+ layer(document, view_id, states, false)
|
||
+}
|
||
+
|
||
+/// The layer the composers draw (V1-2.2 owner brief 2026-10-30): the R3 tree with each point
|
||
+/// hitbox declaring its paint and its capture rule, `stroke="none"` and
|
||
+/// `pointer-events="visibleFill"`, so its clickable area is its circle whatever stroke the page
|
||
+/// or a drawing would give it (under `pointer-events="all"` a stroke widens the hit area even
|
||
+/// when nothing paints it). The zones and the trigger already declare theirs.
|
||
+pub fn render_composed_layer(
|
||
+ document: &AnatomicalSheetDocument,
|
||
+ view_id: &str,
|
||
+ states: &HashSet<&str>,
|
||
+) -> Result<Element, LayerError> {
|
||
+ layer(document, view_id, states, true)
|
||
+}
|
||
+
|
||
+fn layer(
|
||
+ document: &AnatomicalSheetDocument,
|
||
+ view_id: &str,
|
||
+ states: &HashSet<&str>,
|
||
+ declared_hitbox: bool,
|
||
) -> Result<Element, LayerError> {
|
||
let view = find_view(document, view_id).ok_or(LayerError::UnknownView)?;
|
||
let context = Context {
|
||
+ declared_hitbox,
|
||
twin_opacity: if view.is_main() { "0.65" } else { "0.5" },
|
||
categories: document
|
||
.categories
|
||
@@ -59,6 +83,8 @@ pub fn render_layer(
|
||
}
|
||
|
||
struct Context<'a> {
|
||
+ /// The hitbox declares `stroke="none"` and captures on its circle only (composed form).
|
||
+ declared_hitbox: bool,
|
||
twin_opacity: &'static str,
|
||
/// Last duplicate wins, as a JavaScript `Map` built from the list.
|
||
categories: HashMap<&'a str, Option<&'a str>>,
|
||
@@ -154,9 +180,14 @@ impl Context<'_> {
|
||
("cy", js_number(cy)),
|
||
("r", js_number(r)),
|
||
("fill", "transparent".to_owned()),
|
||
- ("pointer-events", "all".to_owned()),
|
||
- ("style", "cursor:pointer".to_owned()),
|
||
];
|
||
+ if self.declared_hitbox {
|
||
+ hitbox.push(("stroke", "none".to_owned()));
|
||
+ hitbox.push(("pointer-events", "visibleFill".to_owned()));
|
||
+ } else {
|
||
+ hitbox.push(("pointer-events", "all".to_owned()));
|
||
+ }
|
||
+ hitbox.push(("style", "cursor:pointer".to_owned()));
|
||
hitbox.extend(data.iter().cloned());
|
||
let mut visible: Attrs = vec![
|
||
("cx", js_number(cx)),
|
||
diff --git a/crates/core/src/anatomy/svg/mod.rs b/crates/core/src/anatomy/svg/mod.rs
|
||
index f499619..85bea93 100644
|
||
--- a/crates/core/src/anatomy/svg/mod.rs
|
||
+++ b/crates/core/src/anatomy/svg/mod.rs
|
||
@@ -14,7 +14,7 @@ pub use tree::{Element, Node, SvgRejection};
|
||
|
||
/// Bounds, parses, sanitises and checks the references of an SVG text: no cycle, within the
|
||
/// expansion budget, each naming an id the drawing defines; no id the composition writes and
|
||
-/// no root `visibility` the marker layer would inherit.
|
||
+/// no root `visibility` other than `visible`.
|
||
pub fn read_svg(text: &str) -> Result<Sanitized, SvgRejection> {
|
||
let root = tree::parse_svg(text)?;
|
||
let sanitized = sanitize::sanitize(root)?;
|
||
diff --git a/crates/core/src/anatomy/svg/refs.rs b/crates/core/src/anatomy/svg/refs.rs
|
||
index 95f3248..dc99a3d 100644
|
||
--- a/crates/core/src/anatomy/svg/refs.rs
|
||
+++ b/crates/core/src/anatomy/svg/refs.rs
|
||
@@ -18,8 +18,8 @@ use super::tree::{Element, Node, SvgRejection};
|
||
/// Expanded elements a drawing may instantiate (the product's drawing: a few thousand).
|
||
pub const MAX_EXPANDED_ELEMENTS: u64 = 50_000;
|
||
|
||
-/// The PDF highlight's filter (`compose::compose_highlight`), written into the drawing's own
|
||
-/// document: the PDF view keeps the drawing's ids.
|
||
+/// The PDF highlight's filter (`compose::compose_highlight`), written in an engine `<defs>` of
|
||
+/// the composed document next to the drawing: the PDF view keeps the drawing's ids.
|
||
pub const HALO_FILTER_ID: &str = "osteo-halo";
|
||
|
||
/// Every id the composition writes next to the drawing's ids. A drawing defining one would
|
||
diff --git a/crates/core/src/anatomy/svg/sanitize.rs b/crates/core/src/anatomy/svg/sanitize.rs
|
||
index b4cbd24..dfd8836 100644
|
||
--- a/crates/core/src/anatomy/svg/sanitize.rs
|
||
+++ b/crates/core/src/anatomy/svg/sanitize.rs
|
||
@@ -435,10 +435,10 @@ fn value_acceptable(qname: &str, value: &str) -> bool {
|
||
}
|
||
|
||
/// The root lets the engine's marker layer show: no `visibility`, or `visible` (CSS whitespace
|
||
-/// and letter case aside). Both composers append the layer as the root's last child, so it
|
||
-/// inherits the root's `visibility`, which the drawing's own children can set back to
|
||
-/// `visible`: any other value, `hidden`, `collapse`, a CSS-wide keyword or an unreadable one,
|
||
-/// is refused (V1-2.2 security review, owner brief 2026-10-30). The root's `style` and `class`
|
||
+/// and letter case aside). Until the composition root became the engine's, the layer inherited
|
||
+/// the root's `visibility`, which the drawing's own children can set back to `visible`: any
|
||
+/// other value, `hidden`, `collapse`, a CSS-wide keyword or an unreadable one, stays refused
|
||
+/// (V1-2.2 security review, owner brief 2026-10-30), the composers checking it too. The root's `style` and `class`
|
||
/// are removed by `sanitize`, so this attribute is the one way left to set it.
|
||
pub fn check_root_visibility(root: &Element) -> Result<(), SvgRejection> {
|
||
let visible = root.attr("visibility").is_none_or(|value| {
|
||
diff --git a/crates/core/src/anatomy/svg/tree.rs b/crates/core/src/anatomy/svg/tree.rs
|
||
index 91c3886..545943d 100644
|
||
--- a/crates/core/src/anatomy/svg/tree.rs
|
||
+++ b/crates/core/src/anatomy/svg/tree.rs
|
||
@@ -111,9 +111,9 @@ pub enum SvgRejection {
|
||
/// An id the composition writes into the drawing's own document (`refs::RESERVED_IDS`):
|
||
/// the drawing's element would stand in for the engine's (V1-2.2, owner brief 2026-10-30).
|
||
ReservedId,
|
||
- /// A `visibility` on the root other than `visible`: the engine's marker layer, appended as
|
||
- /// the root's last child, inherits it, while the drawing's own children can set `visible`
|
||
- /// back (V1-2.2 security review, owner brief 2026-10-30).
|
||
+ /// A `visibility` on the root other than `visible`: until the composition root became the
|
||
+ /// engine's, the marker layer inherited it while the drawing's own children set `visible`
|
||
+ /// back (V1-2.2 security review, owner brief 2026-10-30); kept as a reader rule.
|
||
RootVisibility,
|
||
}
|
||
|
||
diff --git a/crates/core/src/curation/draft/app_review.rs b/crates/core/src/curation/draft/app_review.rs
|
||
index bca7882..aaad006 100644
|
||
--- a/crates/core/src/curation/draft/app_review.rs
|
||
+++ b/crates/core/src/curation/draft/app_review.rs
|
||
@@ -4,6 +4,11 @@
|
||
//! uses. Written under `draft/review/app-<view>.svg` so the markers and the framing can be
|
||
//! compared outside the browser.
|
||
//!
|
||
+//! Declared difference (V1-2.2, owner brief 2026-10-30): the application draws the drawing in a
|
||
+//! group of its own under an engine root and declares each point hitbox's stroke and capture
|
||
+//! (`compose`, `layer::render_composed_layer`); this review drawing keeps the R5 form, a seed
|
||
+//! resource never regenerated without the owner.
|
||
+//!
|
||
//! Declared difference: the R3 owner decision (2026-10-15) gives a trigger without a name of
|
||
//! its own the opened view's name in each language; the TypeScript renderer wrote the French
|
||
//! name twice (`svg_compare::TriggerNames`).
|
||
diff --git a/crates/core/tests/anatomy_canvas_op.rs b/crates/core/tests/anatomy_canvas_op.rs
|
||
index 50e2799..e9ad406 100644
|
||
--- a/crates/core/tests/anatomy_canvas_op.rs
|
||
+++ b/crates/core/tests/anatomy_canvas_op.rs
|
||
@@ -5,7 +5,8 @@
|
||
mod common;
|
||
|
||
use common::svg_tree::{
|
||
- tree_value, view_names, with_ids_scoped_per_view, with_trigger_names_per_language,
|
||
+ tree_value, view_names, with_ids_scoped_per_view, with_isolated_layer,
|
||
+ with_trigger_names_per_language,
|
||
};
|
||
use faunosteo_core::anatomy::svg::tree::parse_svg;
|
||
use faunosteo_core::domain::js::parse_json;
|
||
@@ -44,6 +45,7 @@ fn golden(view: &str, sheet: &LoadedSheet) -> Value {
|
||
let mut frozen: Value = serde_json::from_str(&text).unwrap();
|
||
with_trigger_names_per_language(&mut frozen, &view_names(&sheet.document));
|
||
with_ids_scoped_per_view(&mut frozen, view);
|
||
+ with_isolated_layer(&mut frozen);
|
||
frozen
|
||
}
|
||
|
||
diff --git a/crates/core/tests/anatomy_compose.rs b/crates/core/tests/anatomy_compose.rs
|
||
index 6809da5..873a860 100644
|
||
--- a/crates/core/tests/anatomy_compose.rs
|
||
+++ b/crates/core/tests/anatomy_compose.rs
|
||
@@ -12,7 +12,8 @@ mod common;
|
||
use std::collections::HashSet;
|
||
|
||
use common::svg_tree::{
|
||
- reread, tree_value, view_names, with_ids_scoped_per_view, with_trigger_names_per_language,
|
||
+ reread, tree_value, view_names, with_ids_scoped_per_view, with_isolated_layer,
|
||
+ with_trigger_names_per_language,
|
||
};
|
||
use faunosteo_core::anatomy::compose::{
|
||
ComposeError, asset_id_of_view, compose_canvas, compose_highlight,
|
||
@@ -96,6 +97,7 @@ fn every_highlighted_view_equals_the_engine_tree() {
|
||
let label = format!("{} {} {view}", case["sheet"], case["observation"]["id"]);
|
||
let mut frozen = expected(case, &oracle);
|
||
with_trigger_names_per_language(&mut frozen, &view_names(document));
|
||
+ with_isolated_layer(&mut frozen);
|
||
assert_eq!(reread(&composed), frozen, "{label}");
|
||
}
|
||
}
|
||
@@ -109,6 +111,7 @@ fn canvas_golden(view: &str) -> Value {
|
||
let mut frozen: Value = serde_json::from_str(&text).unwrap();
|
||
with_trigger_names_per_language(&mut frozen, &view_names(&draft()));
|
||
with_ids_scoped_per_view(&mut frozen, view);
|
||
+ with_isolated_layer(&mut frozen);
|
||
frozen
|
||
}
|
||
|
||
diff --git a/crates/core/tests/common/svg_tree.rs b/crates/core/tests/common/svg_tree.rs
|
||
index b430111..119647d 100644
|
||
--- a/crates/core/tests/common/svg_tree.rs
|
||
+++ b/crates/core/tests/common/svg_tree.rs
|
||
@@ -101,3 +101,77 @@ pub fn view_names(
|
||
.map(|v| (v.id().to_owned(), v.name().fr.clone(), v.name().en.clone()))
|
||
.collect()
|
||
}
|
||
+
|
||
+/// Owner brief 2026-10-30 (V1-2.2, three MEDIUM): the composition root is the engine's. Applied
|
||
+/// to a frozen view tree before comparing, written apart from the core: the root keeps its
|
||
+/// namespaces and `viewBox`; its other attributes and every child before the layer go into a
|
||
+/// `<g>`; the halo filter leaves the drawing for an engine `<defs>` placed before the layer;
|
||
+/// each point hitbox (a circle capturing on `all` with no stroke of its own) declares
|
||
+/// `stroke="none"` and `pointer-events="visibleFill"`.
|
||
+pub fn with_isolated_layer(tree: &mut Value) {
|
||
+ let root = tree.as_object_mut().unwrap();
|
||
+ let mut children = root["children"].as_array().unwrap().clone();
|
||
+ let mut layer = children.pop().unwrap();
|
||
+ let halo = take_halo(&mut children);
|
||
+ let attrs = root["attrs"].as_object().unwrap().clone();
|
||
+ let (kept, moved): (Vec<_>, Vec<_>) = attrs
|
||
+ .into_iter()
|
||
+ .partition(|(name, _)| ["xmlns", "xmlns:xlink", "viewBox"].contains(&name.as_str()));
|
||
+ let group = json!({
|
||
+ "ns": root["ns"], "name": "g",
|
||
+ "attrs": moved.into_iter().collect::<serde_json::Map<_, _>>(),
|
||
+ "children": children,
|
||
+ });
|
||
+ let mut out = vec![group];
|
||
+ if let Some(halo) = halo {
|
||
+ out.push(json!({ "ns": SVG_NS, "name": "defs", "attrs": {}, "children": [halo] }));
|
||
+ }
|
||
+ for marker in layer["children"].as_array_mut().unwrap() {
|
||
+ let circle = marker["name"] == "circle";
|
||
+ let attrs = marker["attrs"].as_object_mut().unwrap();
|
||
+ let hitbox = circle
|
||
+ && attrs.get("pointer-events") == Some(&json!("all"))
|
||
+ && !attrs.contains_key("stroke");
|
||
+ if hitbox {
|
||
+ attrs.insert("stroke".to_owned(), json!("none"));
|
||
+ attrs.insert("pointer-events".to_owned(), json!("visibleFill"));
|
||
+ }
|
||
+ }
|
||
+ out.push(layer);
|
||
+ root.insert(
|
||
+ "attrs".to_owned(),
|
||
+ Value::Object(kept.into_iter().collect()),
|
||
+ );
|
||
+ root.insert("children".to_owned(), Value::Array(out));
|
||
+}
|
||
+
|
||
+/// Removes `filter#osteo-halo` from the frozen drawing (and the `<defs>` the engine created for
|
||
+/// it alone, placed first), answering it.
|
||
+fn take_halo(children: &mut Vec<Value>) -> Option<Value> {
|
||
+ let first_is_engine_defs = children.first().is_some_and(|c| {
|
||
+ c["name"] == "defs"
|
||
+ && c["children"]
|
||
+ .as_array()
|
||
+ .is_some_and(|k| k.len() == 1 && k[0]["attrs"]["id"] == "osteo-halo")
|
||
+ });
|
||
+ if first_is_engine_defs {
|
||
+ return Some(children.remove(0)["children"][0].clone());
|
||
+ }
|
||
+ for child in children.iter_mut() {
|
||
+ if let Some(found) = take_from(child) {
|
||
+ return Some(found);
|
||
+ }
|
||
+ }
|
||
+ None
|
||
+}
|
||
+
|
||
+fn take_from(node: &mut Value) -> Option<Value> {
|
||
+ let kids = node.get_mut("children")?.as_array_mut()?;
|
||
+ if let Some(at) = kids
|
||
+ .iter()
|
||
+ .position(|k| k["name"] == "filter" && k["attrs"]["id"] == "osteo-halo")
|
||
+ {
|
||
+ return Some(kids.remove(at));
|
||
+ }
|
||
+ kids.iter_mut().find_map(take_from)
|
||
+}
|
||
diff --git a/crates/core/tests/svg_marker_isolation.rs b/crates/core/tests/svg_marker_isolation.rs
|
||
new file mode 100644
|
||
index 0000000..783d0f0
|
||
--- /dev/null
|
||
+++ b/crates/core/tests/svg_marker_isolation.rs
|
||
@@ -0,0 +1,193 @@
|
||
+//! V1-2.2 owner brief « arbitrages propriétaire sur les trois MEDIUM » (2026-10-30), defects 1
|
||
+//! and 2: nothing the drawing sets reaches the engine's markers. Until then both composers
|
||
+//! appended the marker layer to the drawing's own root, so the root's presentation attributes
|
||
+//! reached every marker: inherited ones (`stroke-opacity="0"` or `stroke-dasharray` erased the
|
||
+//! zone outlines and the detail trigger, `stroke-width` widened the point hitbox until the last
|
||
+//! one took 13 of the 19 equine clicks) and whole-group ones (`opacity`, `display`). The
|
||
+//! composition root is now the engine's (namespaces and frame only), the drawing sits in a
|
||
+//! group of its own, and the layer and the halo filter are that group's siblings. The point
|
||
+//! hitbox declares its paint and its capture rule (`stroke="none"`, `pointer-events=
|
||
+//! "visibleFill"`), so its clickable area is its circle, whatever the page or the drawing set.
|
||
+#![allow(clippy::disallowed_methods, clippy::unwrap_used, clippy::expect_used)]
|
||
+
|
||
+mod common;
|
||
+
|
||
+use std::collections::HashSet;
|
||
+
|
||
+use common::sheet_readers::{OPEN, sheet};
|
||
+use faunosteo_core::anatomy::compose::{compose_canvas, compose_highlight};
|
||
+use faunosteo_core::anatomy::svg::{Element, read_svg};
|
||
+use faunosteo_core::domain::sheet::AnatomicalSheetDocument;
|
||
+use serde::Deserialize;
|
||
+
|
||
+/// The attributes the composition root may carry: namespaces and the frame.
|
||
+const ROOT_ATTRIBUTES: [&str; 3] = ["xmlns", "xmlns:xlink", "viewBox"];
|
||
+
|
||
+/// Every presentation attribute the reader keeps on a drawing's root, with a value that would
|
||
+/// change a marker if it reached one (the reader removes `class`, `style`, `transform`,
|
||
+/// `filter`, `mask` and `clip-path` from the root, and refuses a root `visibility` other than
|
||
+/// `visible`).
|
||
+const ROOT_PROPERTIES: [&str; 22] = [
|
||
+ "stroke=\"#ff00ff\"",
|
||
+ "stroke-width=\"400\"",
|
||
+ "stroke-opacity=\"0\"",
|
||
+ "stroke-dasharray=\"0 1000\"",
|
||
+ "stroke-dashoffset=\"7\"",
|
||
+ "stroke-linecap=\"square\"",
|
||
+ "stroke-linejoin=\"miter\"",
|
||
+ "stroke-miterlimit=\"100\"",
|
||
+ "fill=\"none\"",
|
||
+ "fill-opacity=\"0\"",
|
||
+ "fill-rule=\"evenodd\"",
|
||
+ "opacity=\"0\"",
|
||
+ "display=\"none\"",
|
||
+ "visibility=\"visible\"",
|
||
+ "color=\"#00ff00\"",
|
||
+ "clip-rule=\"evenodd\"",
|
||
+ "color-interpolation-filters=\"sRGB\"",
|
||
+ "font-family=\"serif\"",
|
||
+ "font-size=\"90\"",
|
||
+ "font-weight=\"bold\"",
|
||
+ "systemLanguage=\"xx\"",
|
||
+ "id=\"drawing\"",
|
||
+];
|
||
+
|
||
+const BODY: &str = "<g><path d=\"M0 0h10v10z\"/></g>";
|
||
+
|
||
+fn rooted(attrs: &str) -> String {
|
||
+ let root = OPEN.replace("viewBox", &format!("{attrs} viewBox"));
|
||
+ format!("{root}{BODY}</svg>")
|
||
+}
|
||
+
|
||
+fn horse() -> Element {
|
||
+ let text = common::repo_file("supabase/seed/anatomical-sheets/equine/draft/assets/horse.svg");
|
||
+ read_svg(&text).unwrap().root
|
||
+}
|
||
+
|
||
+fn draft() -> AnatomicalSheetDocument {
|
||
+ let text = common::repo_file("supabase/seed/anatomical-sheets/equine/draft/document.json");
|
||
+ AnatomicalSheetDocument::deserialize(serde_json::from_str::<serde_json::Value>(&text).unwrap())
|
||
+ .unwrap()
|
||
+}
|
||
+
|
||
+/// The composed views of `tree`'s `main` view: the canvas, and the PDF view of `hock`.
|
||
+fn composed(tree: &Element) -> [Element; 2] {
|
||
+ let ids: HashSet<&str> = ["hock"].into_iter().collect();
|
||
+ [
|
||
+ compose_canvas(&sheet(), "main", tree).unwrap(),
|
||
+ compose_highlight(&sheet(), "main", tree.clone(), &ids, true).unwrap(),
|
||
+ ]
|
||
+}
|
||
+
|
||
+fn names(element: &Element) -> Vec<&str> {
|
||
+ element.attrs.iter().map(|a| a.qname.as_str()).collect()
|
||
+}
|
||
+
|
||
+/// The marker layer is a child of the composition root, which carries no drawing attribute;
|
||
+/// the drawing's root attributes and children live in a group the layer is not part of.
|
||
+fn assert_isolated(composed: &Element, drawing: &Element, label: &str) {
|
||
+ let root_names = names(composed);
|
||
+ assert!(
|
||
+ root_names.iter().all(|n| ROOT_ATTRIBUTES.contains(n)),
|
||
+ "{label}: composition root carries {root_names:?}"
|
||
+ );
|
||
+ let layer = composed.element_children().last().unwrap();
|
||
+ assert_eq!(layer.qname, "g", "{label}");
|
||
+ assert!(layer.element_children().count() > 0, "{label}");
|
||
+ let group = composed.element_children().next().unwrap();
|
||
+ assert_eq!(group.qname, "g", "{label}: the drawing's group comes first");
|
||
+ assert!(!std::ptr::eq(group, layer), "{label}");
|
||
+ for attr in &drawing.attrs {
|
||
+ let framing = ["xmlns", "xmlns:xlink", "viewBox"].contains(&attr.qname.as_str());
|
||
+ if !framing && attr.qname != "id" {
|
||
+ assert_eq!(
|
||
+ group.attr(&attr.qname),
|
||
+ Some(attr.value.as_str()),
|
||
+ "{label}: the drawing keeps its own {}",
|
||
+ attr.qname
|
||
+ );
|
||
+ }
|
||
+ }
|
||
+ assert_eq!(
|
||
+ group.element_children().count(),
|
||
+ drawing.element_children().count(),
|
||
+ "{label}: the drawing's children stay in its group"
|
||
+ );
|
||
+}
|
||
+
|
||
+#[test]
|
||
+fn no_root_property_of_the_drawing_reaches_a_marker() {
|
||
+ for property in ROOT_PROPERTIES {
|
||
+ let read = read_svg(&rooted(property)).unwrap_or_else(|e| panic!("{property}: {e:?}"));
|
||
+ assert!(read.removed.is_empty(), "{property}: {:?}", read.removed);
|
||
+ let [canvas, highlight] = composed(&read.root);
|
||
+ assert_isolated(&canvas, &read.root, &format!("canvas {property}"));
|
||
+ assert_isolated(&highlight, &read.root, &format!("pdf {property}"));
|
||
+ }
|
||
+}
|
||
+
|
||
+#[test]
|
||
+fn every_root_property_at_once_stays_with_the_drawing() {
|
||
+ let all = ROOT_PROPERTIES.join(" ");
|
||
+ let read = read_svg(&rooted(&all)).unwrap();
|
||
+ let [canvas, highlight] = composed(&read.root);
|
||
+ assert_isolated(&canvas, &read.root, "canvas");
|
||
+ assert_isolated(&highlight, &read.root, "pdf");
|
||
+}
|
||
+
|
||
+/// The equine drawing keeps its root attributes (`font-family`, `font-size`) on its group and
|
||
+/// its frame on the composition root, in both forms.
|
||
+#[test]
|
||
+fn the_equine_drawing_is_isolated_in_both_forms() {
|
||
+ let horse = horse();
|
||
+ let draft = draft();
|
||
+ let ids: HashSet<&str> = ["hock", "hip"].into_iter().collect();
|
||
+ let canvas = compose_canvas(&draft, "main", &horse).unwrap();
|
||
+ let highlight = compose_highlight(&draft, "main", horse.clone(), &ids, true).unwrap();
|
||
+ for (label, view) in [("canvas", &canvas), ("pdf", &highlight)] {
|
||
+ assert_isolated(view, &horse, label);
|
||
+ assert_eq!(view.attr("viewBox"), Some("0 0 2073.4 1629.4"), "{label}");
|
||
+ }
|
||
+}
|
||
+
|
||
+/// The halo filter is the engine's: outside the drawing's group, so no property of the
|
||
+/// drawing (`color-interpolation-filters` on its root or its `<defs>`) changes the halo.
|
||
+#[test]
|
||
+fn the_halo_filter_lives_outside_the_drawing() {
|
||
+ let read = read_svg(&rooted(
|
||
+ "color-interpolation-filters=\"sRGB\" stroke-width=\"400\"",
|
||
+ ))
|
||
+ .unwrap();
|
||
+ let [_, highlight] = composed(&read.root);
|
||
+ let group = highlight.element_children().next().unwrap();
|
||
+ let mut inside = Vec::new();
|
||
+ common::sheet_readers::holders(group, "osteo-halo", &mut inside);
|
||
+ assert!(inside.is_empty(), "the halo is not in the drawing's group");
|
||
+ let mut everywhere = Vec::new();
|
||
+ common::sheet_readers::holders(&highlight, "osteo-halo", &mut everywhere);
|
||
+ assert_eq!(everywhere.len(), 1);
|
||
+}
|
||
+
|
||
+/// Every interactive surface of the canvas: the point hitboxes declare `stroke="none"` and
|
||
+/// capture on their circle only (`visibleFill`), the zones and the trigger declare their
|
||
+/// stroke width; the visible twins never capture.
|
||
+#[test]
|
||
+fn every_interactive_surface_declares_its_geometry_and_capture() {
|
||
+ let draft = draft();
|
||
+ let canvas = compose_canvas(&draft, "main", &horse()).unwrap();
|
||
+ let layer = canvas.element_children().last().unwrap();
|
||
+ let mut hitboxes = 0;
|
||
+ for marker in layer.element_children() {
|
||
+ match (marker.attr("fill"), marker.attr("pointer-events")) {
|
||
+ (Some("transparent"), capture) => {
|
||
+ hitboxes += 1;
|
||
+ assert_eq!(marker.attr("stroke"), Some("none"), "{marker:?}");
|
||
+ assert_eq!(capture, Some("visibleFill"), "{marker:?}");
|
||
+ }
|
||
+ (_, Some("none")) => {}
|
||
+ (_, Some("all")) => assert!(marker.attr("stroke-width").is_some(), "{marker:?}"),
|
||
+ other => panic!("unexpected capture {other:?}"),
|
||
+ }
|
||
+ }
|
||
+ assert_eq!(hitboxes, 13, "the 13 points of the main view");
|
||
+}
|
||
diff --git a/crates/core/tests/svg_root_visibility.rs b/crates/core/tests/svg_root_visibility.rs
|
||
index 34369a9..d9b0a38 100644
|
||
--- a/crates/core/tests/svg_root_visibility.rs
|
||
+++ b/crates/core/tests/svg_root_visibility.rs
|
||
@@ -1,7 +1,7 @@
|
||
//! V1-2.2 owner brief 2026-10-30: the drawing's root never decides whether the engine's markers
|
||
-//! show. Both composers append the marker layer as the root's last child (the PDF view keeps the
|
||
-//! drawing's root, the canvas copies its attributes), so the layer inherits the root's
|
||
-//! `visibility`; a drawing `<svg visibility="hidden">` whose children set `visible` back read
|
||
+//! show. Both composers appended the marker layer as the root's last child, so the layer
|
||
+//! inherited the root's `visibility` (the composition root is the engine's since the three-MEDIUM
|
||
+//! brief, `svg_marker_isolation`); a drawing `<svg visibility="hidden">` whose children set `visible` back read
|
||
//! clean before and showed its drawing without a single marker (security review, MEDIUM). The
|
||
//! reader refuses a root `visibility` other than `visible` (`root_visibility`); the cleaning,
|
||
//! the preview, the verdict and the PDF snapshot gate answer it; both composers refuse such a
|
||
@@ -189,12 +189,10 @@ fn equivalent_styles_never_hide_the_layer() {
|
||
assert!(layer_shows(&canvas.unwrap()) && layer_shows(&highlight.unwrap()));
|
||
}
|
||
|
||
-/// The other root properties that reach the layer. Removed by the reader before V1-2.2: the
|
||
-/// paint servers and effects (`filter`, `mask`, `clip-path`), `transform`, `class`, `style`.
|
||
-/// Kept: `opacity` and `display` act on the whole root, drawing and markers alike (the
|
||
-/// browser proofs of RUST.md §12.10 show both); `fill` and `fill-opacity` are set on every PDF
|
||
-/// marker. The stroke properties no marker sets (`stroke-opacity`, `stroke-dasharray`,
|
||
-/// `stroke-width` on the hitbox) are an open owner decision, not covered here.
|
||
+/// The other root properties. Removed by the reader before V1-2.2: the paint servers and
|
||
+/// effects (`filter`, `mask`, `clip-path`), `transform`, `class`, `style`. Kept: `opacity`,
|
||
+/// `display` and the paint, which since the three-MEDIUM brief stay on the drawing's group and
|
||
+/// never reach a marker (`svg_marker_isolation`); every PDF marker still sets its fill.
|
||
#[test]
|
||
fn other_root_properties_are_removed_or_act_on_the_whole_view() {
|
||
for name in ["filter", "mask", "clip-path"] {
|
||
diff --git a/docs/ANNOTATION-RENDERING.md b/docs/ANNOTATION-RENDERING.md
|
||
index a18e915..9c1439a 100644
|
||
--- a/docs/ANNOTATION-RENDERING.md
|
||
+++ b/docs/ANNOTATION-RENDERING.md
|
||
@@ -23,7 +23,7 @@ trigger.
|
||
| Annotation | Elements |
|
||
|---|---|
|
||
| `detail_trigger`, any geometry | one dashed shape: fill and stroke = the colour, `fill-opacity` 0.06, `stroke-width` 2, `stroke-dasharray` `8,4`, `pointer-events` all, `style` `cursor:pointer`, class `detail-zone` |
|
||
-| `point` or `zone` with a circle | a transparent hitbox (the geometry's `r`, `fill` transparent, `pointer-events` all, `style` `cursor:pointer`) then a visible twin on top (radius `max(2, r − 12)`, the colour, `fill-opacity` 0.65 on the main view / 0.5 on a detail view, stroke `#000` 1.5, `pointer-events` none) |
|
||
+| `point` or `zone` with a circle | a transparent hitbox (the geometry's `r`, `fill` transparent, `stroke` none, `pointer-events` visibleFill, `style` `cursor:pointer`; the R3 form kept for the seed review drawings has no `stroke` and `pointer-events` all) then a visible twin on top (radius `max(2, r − 12)`, the colour, `fill-opacity` 0.65 on the main view / 0.5 on a detail view, stroke `#000` 1.5, `pointer-events` none) |
|
||
| `point` or `zone` with a polygon or a path | one filled shape: fill and stroke = the colour, `fill-opacity` 0.3, `stroke-width` 2, `pointer-events` all, `style` `cursor:pointer` |
|
||
|
||
Annotations without geometry draw nothing. Annotations follow the document
|
||
@@ -111,22 +111,23 @@ a pointer cursor and brightens on hover.
|
||
The engine composes the observation's zones of one view: the markers of the
|
||
other annotations are dropped (not hidden), every `data-*` attribute is
|
||
removed, the kept elements get fill `#b85a3f` at 0.85 and, on the main view,
|
||
-the `osteo-halo` filter (two Gaussian blurs merged with the source), added to
|
||
-the first `<defs>` of the drawing or to a new `<defs>` placed first. The PDF
|
||
+the `osteo-halo` filter (two Gaussian blurs merged with the source), in a
|
||
+`<defs>` of the engine placed after the drawing's group, before the layer. The PDF
|
||
view keeps the drawing's ids, so `osteo-halo` is reserved (V1-2.2, owner brief
|
||
2026-10-30): the reader refuses a drawing holding it in any letter case
|
||
(`reserved_id`) and both composers refuse such a tree, so the halo the markers
|
||
name is always the engine's.
|
||
|
||
-Both forms append the layer as the root's last child, so it inherits the
|
||
-root's `visibility`. A root `visibility` other than `visible` is refused by
|
||
-the reader (`root_visibility`) and by both composers: a drawing could
|
||
-otherwise hide every marker while its own children set `visible` back. The
|
||
-root's `class`, `style`, `transform`, `filter`, `mask` and `clip-path` are
|
||
-removed by the reader; `opacity` and `display` on the root act on the drawing
|
||
-and the markers alike. Still open (RUST.md §12.10): `stroke-opacity`,
|
||
-`stroke-dasharray` and `stroke-width` on the root reach the markers, which do
|
||
-not set them (the frame of a view: see Views, RUST.md §12.11).
|
||
+The composition root is the engine's (V1-2.2, owner brief 2026-10-30, RUST.md
|
||
+§12.12): `xmlns`, `xmlns:xlink` and the frame only. The drawing's root becomes
|
||
+a `<g>` holding its other attributes and its children; the layer (and the
|
||
+halo's `<defs>`) are that group's siblings, so no property the drawing sets,
|
||
+inherited (`stroke-*`, `fill*`, `visibility`…) or acting on a whole group
|
||
+(`opacity`, `display`), reaches a marker: a root `opacity="0"` or
|
||
+`display="none"` hides the drawing alone. A root `visibility` other than
|
||
+`visible` stays refused by the reader (`root_visibility`) and by both
|
||
+composers. The R3 trees stay frozen; the tests apply this declared change
|
||
+(`withIsolatedLayer`, `withDeclaredHitboxes`, `with_isolated_layer`).
|
||
|
||
## Checking the look
|
||
|
||
diff --git a/docs/development/BROWSER_TESTS.md b/docs/development/BROWSER_TESTS.md
|
||
index 2b1c962..39c55c3 100644
|
||
--- a/docs/development/BROWSER_TESTS.md
|
||
+++ b/docs/development/BROWSER_TESTS.md
|
||
@@ -1,7 +1,9 @@
|
||
# Browser tests (Playwright and axe)
|
||
|
||
Status: V1-1.3, 2026-10-25 (decision D14, `V1-1_OWNERS_ANIMALS.md` §12.5).
|
||
-Chromium only until V1-5. The suites live in `apps/app/e2e`.
|
||
+Chromium only until V1-5, except the canvas click proof (V1-2.2), which also
|
||
+runs on Firefox and WebKit, desktop and the WebKit phone, when the pinned
|
||
+engines are installed. The suites live in `apps/app/e2e`.
|
||
|
||
## 1. Suites
|
||
|
||
@@ -110,7 +112,12 @@ suite needs Docker in the runner for the sandbox.
|
||
|
||
## 6. Limits
|
||
|
||
-- Chromium only. Firefox, WebKit and the 412 × 915 viewport join at V1-5
|
||
+- Chromium only, but `e2e/ui/canvas-clicks.spec.ts` (V1-2.2: projects
|
||
+ `firefox-desktop`, `webkit-desktop`, `webkit-375`, added when
|
||
+ `playwright install firefox webkit` has put the pinned engines in the cache;
|
||
+ a missing one is named in the run's output and its projects do not run;
|
||
+ harness `e2e/harness/canvas.{html,tsx}`, dev server only). Firefox, WebKit
|
||
+ and the 412 × 915 viewport join every suite at V1-5
|
||
(contract §12.5). WebKit's system libraries may need `sudo` (owner action).
|
||
Desktop WebKit is not iOS Safari: the owner's manual check on a real iPhone
|
||
and on a computer over the LAN stays a validation criterion of every mobile
|
||
diff --git a/docs/development/RUST.md b/docs/development/RUST.md
|
||
index 6a0cf21..02c1ab0 100644
|
||
--- a/docs/development/RUST.md
|
||
+++ b/docs/development/RUST.md
|
||
@@ -4198,3 +4198,46 @@ Oracles: none changed by this rule; the R3 canvas and highlight trees, the R4 di
|
||
frozen (no committed drawing carries a `preserveAspectRatio` or a `viewBox` in another spelling).
|
||
Module: 560 377 → 572 993 B gzip -9 (+12 616 B, the curve and arc measure), 1 515 246 → 1 544 834 B raw; Node's gzip
|
||
582 919 B (budget 600 000).
|
||
+
|
||
+### 12.12 Marker isolation and the hitbox capture (owner, 2026-10-30, defects 1 and 2)
|
||
+
|
||
+Brief « V1-2.2 : arbitrages propriétaire sur les trois MEDIUM », points 1 and 2 (open items (1) and (2) of §12.10). A
|
||
+structural fix in the composition, common to both forms, not a list of refused attributes.
|
||
+
|
||
+| Point | Built | Where |
|
||
+|---|---|---|
|
||
+| Composition root | the engine's own `<svg>`: `xmlns`, `xmlns:xlink`, the frame (§12.11). The drawing's root becomes a `<g>` holding its other attributes (`viewBox`, `preserveAspectRatio`, `version`, `width`, `height`, `x`, `y` dropped) and its children; the marker layer, and in the PDF view an engine `<defs>` holding the halo filter, are that group's siblings | `anatomy/compose.rs` (`isolated`) |
|
||
+| Layer | the composers draw `render_composed_layer`: the R3 tree with each point hitbox declaring `stroke="none"` and `pointer-events="visibleFill"` (its clickable area is its circle: under `all` a stroke widens the hit area even unpainted); the zones and the trigger already declare their stroke width; the R3 `render_layer` stays for the seed review drawings, unchanged | `anatomy/layer.rs` |
|
||
+| Kept | the reader rules of §12.9 and §12.10 (`reserved_id`, `root_visibility`) and both composers' fail-closed checks | |
|
||
+
|
||
+What reached a marker before, and why the structure ends it: inherited properties (`stroke`, `stroke-width`,
|
||
+`stroke-opacity`, `stroke-dasharray`, `stroke-dashoffset`, `stroke-linecap`, `stroke-linejoin`, `stroke-miterlimit`,
|
||
+`fill`, `fill-opacity`, `fill-rule`, `visibility`, `color`, `clip-rule`, `color-interpolation-filters`, the font
|
||
+properties) pass from an ancestor to a child, which a child's own attribute overrides only for the properties it sets;
|
||
+`opacity`, `display` and the conditional `systemLanguage` act on the element and its whole subtree, which no child can
|
||
+undo. The reader already removes the root's `class`, `style`, `transform`, `filter`, `mask` and `clip-path`, refuses a
|
||
+root `visibility` other than `visible`, keeps no `pointer-events` or `cursor` attribute and no `<style>`. With the layer a
|
||
+sibling of the drawing, its only ancestor is the engine's root (and, in the canvas, the page, whose stylesheet is the
|
||
+application's). Consequence for drawings: a root `opacity="0"` or `display="none"` now hides the drawing alone, in every
|
||
+engine and both forms (before: the whole view, or nothing, depending on the engine and the form).
|
||
+
|
||
+Proofs: `svg_marker_isolation` (5, all red on `958228a`): 22 root properties one by one and all at once never on the
|
||
+layer's ancestors, the drawing keeping them on its group, in both forms; the equine drawing; the halo outside the
|
||
+drawing; every interactive surface declaring its stroke and capture. Browser pixels (Chromium 156, Firefox 157,
|
||
+WebKit 27.2; PDF raster as `browserRasterizer`, canvas inline): the equine views identical before and after (0 px), the
|
||
+markers under nine hostile roots identical to the plain markers (0 px) where `958228a` drew them altered (4 700 to
|
||
+196 000 px) or not at all (`opacity`, `display`). Real PDF exports (demo, v2full, v2unresolved, Chromium rasters): byte-
|
||
+identical to `958228a`. Clicks (`e2e/ui/canvas-clicks.spec.ts`): 67 pass on Chromium desktop and phone, Firefox, WebKit
|
||
+desktop and phone; on `958228a` 45 fail. Mutations I1 to I7 killed, K1, K7, K8, K10, V1, V6, V7 rerun killed.
|
||
+
|
||
+References this changes (left to the owner, not rewritten): the R3 highlight oracle (`crates/core/tests/oracles/r3/
|
||
+highlight.json`, 36 cases) and the R3 canvas goldens (`apps/app/tests/fixtures/goldens/r3/canvas.{main,head}.json`,
|
||
+`canvas.{main,head}.layers.json` as the mounted canvas reads them): equal once the declared change above is applied;
|
||
+the R4.1 real-raster manifest (`apps/app/tests/fixtures/pdf/r3/real/manifest.json`, call 1 `svgSha256`), a byte digest
|
||
+no declared change can map. Unchanged: R3 `layer.json` and `sanitiser.json`, the R4 digests, the step6 goldens, the N-1
|
||
+copies, the seed review drawings, the equine drawing and its fingerprint. Correction to §12.10: the class fix does not
|
||
+change the R4 digests.
|
||
+
|
||
+Open, pre-existing, owner decision: the vertebral junction points sit on the edge of zones painted and hit after them;
|
||
+measured in all three engines on the plain equine sheet, 28 to 49 % of `c7-t1`, `l6-s1` and `t18-l1`'s visible disc
|
||
+records the zone, 8 % of the fore fetlock's records the fore sesamoids (`fixme` in the click spec).
|