fix(anatomy,editor): detail-popup clicks + spine zones open VertebraPicker via data-anno-special
Three coupled bugs in zone interaction: 1. Clicks inside the head detail popup were ignored — EditorRoute looked up the clicked id in the main-SVG bones map only, so detail-only ids (point-mpbykomv et al.) returned undefined. 2. Spine zones did not open VertebraPicker on click; the picker was only reachable via the per-zone "Vertèbres…" button. 3. The new SVG hint data-anno-special="vertebral-precision" was present in Horse.svg but unread by the parser/UI. Parser now reads data-anno-special into Bone.special. EditorRoute parses the detail SVG on open and falls back to detailBones for id lookups. When bone.special === 'vertebral-precision', clicking adds the zone (if absent) and opens VertebraPicker for that zone index; toggle-off via main click is disabled for these zones (use ✕). The "Vertèbres…" button in ObservationCard is now shown only on zones that support it. Convention doc updated. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
21b678c3d5
commit
b9da4fa04a
7 files changed
+86
-22
No files matched your search
@@ -20,6 +20,7 @@ Every clickable zone element must carry all four attributes:
|
|||||||
| Attribute | Type | Description |
|
| Attribute | Type | Description |
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
| `data-anno-opens-detail` | `string` | Id of the detail popup SVG to open on click. Key must exist in `SpeciesManifest.details`. |
|
| `data-anno-opens-detail` | `string` | Id of the detail popup SVG to open on click. Key must exist in `SpeciesManifest.details`. |
|
||||||
|
| `data-anno-special` | `string` | Free-form behavior hint consumed by the app. Known value: `vertebral-precision` → clicking the zone opens VertebraPicker. Opaque to the parser; new values can be added without code changes (just unused). |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -114,12 +115,16 @@ A single `click` listener on the root `<svg>` element:
|
|||||||
```
|
```
|
||||||
event.target → walk up ancestors → find data-anno-id
|
event.target → walk up ancestors → find data-anno-id
|
||||||
→ if data-anno-opens-detail present → emit requestDetail({id})
|
→ if data-anno-opens-detail present → emit requestDetail({id})
|
||||||
→ else if category === 'spine-zone' → open VertebraPicker
|
→ else if data-anno-special === 'vertebral-precision' →
|
||||||
→ else → add bone to current observation
|
add zone to current observation (if absent) and open VertebraPicker
|
||||||
|
→ else → toggle bone in current observation
|
||||||
```
|
```
|
||||||
|
|
||||||
Never attach per-element click listeners — the SVG may have thousands of elements.
|
Never attach per-element click listeners — the SVG may have thousands of elements.
|
||||||
|
|
||||||
|
Note: `data-anno-category` is opaque to click handling — branching is
|
||||||
|
driven by `data-anno-opens-detail` and `data-anno-special` only.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Zone visual states
|
## Zone visual states
|
||||||
@@ -152,7 +157,8 @@ When a zone has `data-anno-opens-detail="head"`:
|
|||||||
|
|
||||||
## Vertebra picker trigger
|
## Vertebra picker trigger
|
||||||
|
|
||||||
When a bone has `data-anno-category="spine-zone"`, clicking it opens `VertebraPicker`:
|
When a bone has `data-anno-special="vertebral-precision"`, clicking it adds the
|
||||||
|
zone to the active observation (if absent) and opens `VertebraPicker`:
|
||||||
|
|
||||||
- Region tabs: Cervicales (C1–C7), Thoraciques (T1–T18), Lombaires (L1–L6), Sacrales (S1–S5), Caudales (Cd1–Cd18).
|
- Region tabs: Cervicales (C1–C7), Thoraciques (T1–T18), Lombaires (L1–L6), Sacrales (S1–S5), Caudales (Cd1–Cd18).
|
||||||
- Multi-select chip grid, ≥40 px touch targets.
|
- Multi-select chip grid, ≥40 px touch targets.
|
||||||
|
|||||||
@@ -701,4 +701,4 @@
|
|||||||
<g>
|
<g>
|
||||||
</g>
|
</g>
|
||||||
</switch>
|
</switch>
|
||||||
<g id="osteo-overlays"><circle cx="1523" cy="1397" r="34" fill="transparent" pointer-events="all" style="cursor:pointer" class="" data-anno-id="point-mpbwrkp0" data-anno-name-fr="Boulet post. (métatarso-phalangien)" data-anno-name-en="Hind fetlock" data-anno-category="articulations"><title>Boulet post. (métatarso-phalangien) / Hind fetlock</title></circle><circle cx="1523" cy="1397" r="22" fill="#ff9500" fill-opacity="0.65" stroke="#000" stroke-width="1.5" pointer-events="none" id="point-mpbwrkp0" class="" data-anno-id="point-mpbwrkp0" data-anno-name-fr="Boulet post. (métatarso-phalangien)" data-anno-name-en="Hind fetlock" data-anno-category="articulations"><title>Boulet post. (métatarso-phalangien) / Hind fetlock</title></circle><circle cx="1542" cy="1159" r="34" fill="transparent" pointer-events="all" style="cursor:pointer" class="" data-anno-id="point-mpbwsi9q" data-anno-name-fr="Jarret (tarsien)" data-anno-name-en="Hock" data-anno-category="articulations"><title>Jarret (tarsien) / Hock</title></circle><circle cx="1542" cy="1159" r="22" fill="#ff9500" fill-opacity="0.65" stroke="#000" stroke-width="1.5" pointer-events="none" id="point-mpbwsi9q" class="" data-anno-id="point-mpbwsi9q" data-anno-name-fr="Jarret (tarsien)" data-anno-name-en="Hock" data-anno-category="articulations"><title>Jarret (tarsien) / Hock</title></circle><circle cx="1464" cy="918" r="34" fill="transparent" pointer-events="all" style="cursor:pointer" class="" data-anno-id="point-mpbwt4fa" data-anno-name-fr="Grasset (fémoro-tibial)" data-anno-name-en="Stifle" data-anno-category="articulations"><title>Grasset (fémoro-tibial) / Stifle</title></circle><circle cx="1464" cy="918" r="22" fill="#ff9500" fill-opacity="0.65" stroke="#000" stroke-width="1.5" pointer-events="none" id="point-mpbwt4fa" class="" data-anno-id="point-mpbwt4fa" data-anno-name-fr="Grasset (fémoro-tibial)" data-anno-name-en="Stifle" data-anno-category="articulations"><title>Grasset (fémoro-tibial) / Stifle</title></circle><circle cx="1516" cy="695" r="34" fill="transparent" pointer-events="all" style="cursor:pointer" class="" data-anno-id="point-mpbwtst0" data-anno-name-fr="Hanche (coxo-fémorale)" data-anno-name-en="Hip joint" data-anno-category="articulations"><title>Hanche (coxo-fémorale) / Hip joint</title></circle><circle cx="1516" cy="695" r="22" fill="#ff9500" fill-opacity="0.65" stroke="#000" stroke-width="1.5" pointer-events="none" id="point-mpbwtst0" class="" data-anno-id="point-mpbwtst0" data-anno-name-fr="Hanche (coxo-fémorale)" data-anno-name-en="Hip joint" data-anno-category="articulations"><title>Hanche (coxo-fémorale) / Hip joint</title></circle><circle cx="1590" cy="606" r="34" fill="transparent" pointer-events="all" style="cursor:pointer" class="" data-anno-id="point-mpbwugty" data-anno-name-fr="Articulation Sacro-Iliaque" data-anno-name-en="Sacroiliac Joint" data-anno-category="articulations"><title>Articulation Sacro-Iliaque / Sacroiliac Joint</title></circle><circle cx="1590" cy="606" r="22" fill="#ff9500" fill-opacity="0.65" stroke="#000" stroke-width="1.5" pointer-events="none" id="point-mpbwugty" class="" data-anno-id="point-mpbwugty" data-anno-name-fr="Articulation Sacro-Iliaque" data-anno-name-en="Sacroiliac Joint" data-anno-category="articulations"><title>Articulation Sacro-Iliaque / Sacroiliac Joint</title></circle><circle cx="784" cy="907" r="34" fill="transparent" pointer-events="all" style="cursor:pointer" class="" data-anno-id="point-mpbwv4xy" data-anno-name-fr="Épaule (scapulo-humérale)" data-anno-name-en="Shoulder joint" data-anno-category="articulations"><title>Épaule (scapulo-humérale) / Shoulder joint</title></circle><circle cx="784" cy="907" r="22" fill="#ff9500" fill-opacity="0.65" stroke="#000" stroke-width="1.5" pointer-events="none" id="point-mpbwv4xy" class="" data-anno-id="point-mpbwv4xy" data-anno-name-fr="Épaule (scapulo-humérale)" data-anno-name-en="Shoulder joint" data-anno-category="articulations"><title>Épaule (scapulo-humérale) / Shoulder joint</title></circle><circle cx="747" cy="1193" r="34" fill="transparent" pointer-events="all" style="cursor:pointer" class="" data-anno-id="point-mpbwvpvt" data-anno-name-fr="Coude (huméro-radial)" data-anno-name-en="Elbow joint" data-anno-category="articulations"><title>Coude (huméro-radial) / Elbow joint</title></circle><circle cx="747" cy="1193" r="22" fill="#ff9500" fill-opacity="0.65" stroke="#000" stroke-width="1.5" pointer-events="none" id="point-mpbwvpvt" class="" data-anno-id="point-mpbwvpvt" data-anno-name-fr="Coude (huméro-radial)" data-anno-name-en="Elbow joint" data-anno-category="articulations"><title>Coude (huméro-radial) / Elbow joint</title></circle><circle cx="736" cy="1379" r="34" fill="transparent" pointer-events="all" style="cursor:pointer" class="" data-anno-id="point-mpbwwaru" data-anno-name-fr="Boulet ant. (métacarpo-phalangien)" data-anno-name-en="Fore fetlock" data-anno-category="articulations"><title>Boulet ant. (métacarpo-phalangienLine truncated
|
<g id="osteo-overlays"><circle cx="1523" cy="1397" r="34" fill="transparent" pointer-events="all" style="cursor:pointer" class="" data-anno-id="point-mpbwrkp0" data-anno-name-fr="Boulet post. (métatarso-phalangien)" data-anno-name-en="Hind fetlock" data-anno-category="articulations"><title>Boulet post. (métatarso-phalangien) / Hind fetlock</title></circle><circle cx="1523" cy="1397" r="22" fill="#ff9500" fill-opacity="0.65" stroke="#000" stroke-width="1.5" pointer-events="none" id="point-mpbwrkp0" class="" data-anno-id="point-mpbwrkp0" data-anno-name-fr="Boulet post. (métatarso-phalangien)" data-anno-name-en="Hind fetlock" data-anno-category="articulations"><title>Boulet post. (métatarso-phalangien) / Hind fetlock</title></circle><circle cx="1542" cy="1159" r="34" fill="transparent" pointer-events="all" style="cursor:pointer" class="" data-anno-id="point-mpbwsi9q" data-anno-name-fr="Jarret (tarsien)" data-anno-name-en="Hock" data-anno-category="articulations"><title>Jarret (tarsien) / Hock</title></circle><circle cx="1542" cy="1159" r="22" fill="#ff9500" fill-opacity="0.65" stroke="#000" stroke-width="1.5" pointer-events="none" id="point-mpbwsi9q" class="" data-anno-id="point-mpbwsi9q" data-anno-name-fr="Jarret (tarsien)" data-anno-name-en="Hock" data-anno-category="articulations"><title>Jarret (tarsien) / Hock</title></circle><circle cx="1464" cy="918" r="34" fill="transparent" pointer-events="all" style="cursor:pointer" class="" data-anno-id="point-mpbwt4fa" data-anno-name-fr="Grasset (fémoro-tibial)" data-anno-name-en="Stifle" data-anno-category="articulations"><title>Grasset (fémoro-tibial) / Stifle</title></circle><circle cx="1464" cy="918" r="22" fill="#ff9500" fill-opacity="0.65" stroke="#000" stroke-width="1.5" pointer-events="none" id="point-mpbwt4fa" class="" data-anno-id="point-mpbwt4fa" data-anno-name-fr="Grasset (fémoro-tibial)" data-anno-name-en="Stifle" data-anno-category="articulations"><title>Grasset (fémoro-tibial) / Stifle</title></circle><circle cx="1516" cy="695" r="34" fill="transparent" pointer-events="all" style="cursor:pointer" class="" data-anno-id="point-mpbwtst0" data-anno-name-fr="Hanche (coxo-fémorale)" data-anno-name-en="Hip joint" data-anno-category="articulations"><title>Hanche (coxo-fémorale) / Hip joint</title></circle><circle cx="1516" cy="695" r="22" fill="#ff9500" fill-opacity="0.65" stroke="#000" stroke-width="1.5" pointer-events="none" id="point-mpbwtst0" class="" data-anno-id="point-mpbwtst0" data-anno-name-fr="Hanche (coxo-fémorale)" data-anno-name-en="Hip joint" data-anno-category="articulations"><title>Hanche (coxo-fémorale) / Hip joint</title></circle><circle cx="1590" cy="606" r="34" fill="transparent" pointer-events="all" style="cursor:pointer" class="" data-anno-id="point-mpbwugty" data-anno-name-fr="Articulation Sacro-Iliaque" data-anno-name-en="Sacroiliac Joint" data-anno-category="articulations"><title>Articulation Sacro-Iliaque / Sacroiliac Joint</title></circle><circle cx="1590" cy="606" r="22" fill="#ff9500" fill-opacity="0.65" stroke="#000" stroke-width="1.5" pointer-events="none" id="point-mpbwugty" class="" data-anno-id="point-mpbwugty" data-anno-name-fr="Articulation Sacro-Iliaque" data-anno-name-en="Sacroiliac Joint" data-anno-category="articulations"><title>Articulation Sacro-Iliaque / Sacroiliac Joint</title></circle><circle cx="784" cy="907" r="34" fill="transparent" pointer-events="all" style="cursor:pointer" class="" data-anno-id="point-mpbwv4xy" data-anno-name-fr="Épaule (scapulo-humérale)" data-anno-name-en="Shoulder joint" data-anno-category="articulations"><title>Épaule (scapulo-humérale) / Shoulder joint</title></circle><circle cx="784" cy="907" r="22" fill="#ff9500" fill-opacity="0.65" stroke="#000" stroke-width="1.5" pointer-events="none" id="point-mpbwv4xy" class="" data-anno-id="point-mpbwv4xy" data-anno-name-fr="Épaule (scapulo-humérale)" data-anno-name-en="Shoulder joint" data-anno-category="articulations"><title>Épaule (scapulo-humérale) / Shoulder joint</title></circle><circle cx="747" cy="1193" r="34" fill="transparent" pointer-events="all" style="cursor:pointer" class="" data-anno-id="point-mpbwvpvt" data-anno-name-fr="Coude (huméro-radial)" data-anno-name-en="Elbow joint" data-anno-category="articulations"><title>Coude (huméro-radial) / Elbow joint</title></circle><circle cx="747" cy="1193" r="22" fill="#ff9500" fill-opacity="0.65" stroke="#000" stroke-width="1.5" pointer-events="none" id="point-mpbwvpvt" class="" data-anno-id="point-mpbwvpvt" data-anno-name-fr="Coude (huméro-radial)" data-anno-name-en="Elbow joint" data-anno-category="articulations"><title>Coude (huméro-radial) / Elbow joint</title></circle><circle cx="736" cy="1379" r="34" fill="transparent" pointer-events="all" style="cursor:pointer" class="" data-anno-id="point-mpbwwaru" data-anno-name-fr="Boulet ant. (métacarpo-phalangien)" data-anno-name-en="Fore fetlock" data-anno-category="articulations"><title>Boulet ant. (métacarpo-phalangienLine truncated
|
||||||
|
Before Width: | Height: | Size: 141 KiB After Width: | Height: | Size: 141 KiB |
@@ -52,6 +52,7 @@ export function parseSvgBones(svgRoot: SVGSVGElement): Map<string, Bone> {
|
|||||||
const category = el.getAttribute('data-anno-category') as BoneCategory
|
const category = el.getAttribute('data-anno-category') as BoneCategory
|
||||||
const opensDetail =
|
const opensDetail =
|
||||||
el.getAttribute('data-anno-opens-detail') ?? undefined
|
el.getAttribute('data-anno-opens-detail') ?? undefined
|
||||||
|
const special = el.getAttribute('data-anno-special') ?? undefined
|
||||||
|
|
||||||
const existing = map.get(id)
|
const existing = map.get(id)
|
||||||
if (existing) {
|
if (existing) {
|
||||||
@@ -59,6 +60,9 @@ export function parseSvgBones(svgRoot: SVGSVGElement): Map<string, Bone> {
|
|||||||
if (opensDetail && !existing.opensDetail) {
|
if (opensDetail && !existing.opensDetail) {
|
||||||
existing.opensDetail = opensDetail
|
existing.opensDetail = opensDetail
|
||||||
}
|
}
|
||||||
|
if (special && !existing.special) {
|
||||||
|
existing.special = special
|
||||||
|
}
|
||||||
if (!existing.fr && fr) existing.fr = fr
|
if (!existing.fr && fr) existing.fr = fr
|
||||||
if (!existing.en && en) existing.en = en
|
if (!existing.en && en) existing.en = en
|
||||||
} else {
|
} else {
|
||||||
@@ -68,6 +72,7 @@ export function parseSvgBones(svgRoot: SVGSVGElement): Map<string, Bone> {
|
|||||||
en,
|
en,
|
||||||
category,
|
category,
|
||||||
opensDetail,
|
opensDetail,
|
||||||
|
special,
|
||||||
els: [el],
|
els: [el],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,15 @@ export interface Bone {
|
|||||||
category: BoneCategory
|
category: BoneCategory
|
||||||
/** Detail popup id from data-anno-opens-detail, if present */
|
/** Detail popup id from data-anno-opens-detail, if present */
|
||||||
opensDetail?: string
|
opensDetail?: string
|
||||||
|
/**
|
||||||
|
* Free-form behavior hint from `data-anno-special`.
|
||||||
|
*
|
||||||
|
* Known values consumed by the application:
|
||||||
|
* - `vertebral-precision`: clicking the zone opens VertebraPicker.
|
||||||
|
*
|
||||||
|
* Opaque to the parser; new values are accepted without code changes.
|
||||||
|
*/
|
||||||
|
special?: string
|
||||||
/** All DOM elements carrying this annotation (used for colorization) */
|
/** All DOM elements carrying this annotation (used for colorization) */
|
||||||
els: Element[]
|
els: Element[]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ export default function EditorRoute() {
|
|||||||
const setNextAppointment = useReportStore((s) => s.setNextAppointment)
|
const setNextAppointment = useReportStore((s) => s.setNextAppointment)
|
||||||
|
|
||||||
const [bones, setBones] = useState<Map<string, Bone>>(new Map())
|
const [bones, setBones] = useState<Map<string, Bone>>(new Map())
|
||||||
|
const [detailBones, setDetailBones] = useState<Map<string, Bone>>(new Map())
|
||||||
const [pathologies, setPathologies] = useState<Pathology[]>([])
|
const [pathologies, setPathologies] = useState<Pathology[]>([])
|
||||||
const [detail, setDetail] = useState<{
|
const [detail, setDetail] = useState<{
|
||||||
id: string
|
id: string
|
||||||
@@ -55,6 +56,21 @@ export default function EditorRoute() {
|
|||||||
species.pathologies().then((m) => setPathologies(m.default))
|
species.pathologies().then((m) => setPathologies(m.default))
|
||||||
}, [species])
|
}, [species])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!detail) {
|
||||||
|
setDetailBones(new Map())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let cancelled = false
|
||||||
|
loadSvg(detail.src).then((root) => {
|
||||||
|
if (cancelled) return
|
||||||
|
setDetailBones(parseSvgBones(root))
|
||||||
|
})
|
||||||
|
return () => {
|
||||||
|
cancelled = true
|
||||||
|
}
|
||||||
|
}, [detail])
|
||||||
|
|
||||||
const activeObs =
|
const activeObs =
|
||||||
activeIndex >= 0 ? report?.observations[activeIndex] : undefined
|
activeIndex >= 0 ? report?.observations[activeIndex] : undefined
|
||||||
|
|
||||||
@@ -82,7 +98,7 @@ export default function EditorRoute() {
|
|||||||
|
|
||||||
function onZoneClick(boneId: string, detailSourceId?: string) {
|
function onZoneClick(boneId: string, detailSourceId?: string) {
|
||||||
if (!report) return
|
if (!report) return
|
||||||
const bone = bones.get(boneId)
|
const bone = bones.get(boneId) ?? detailBones.get(boneId)
|
||||||
if (!bone) return
|
if (!bone) return
|
||||||
|
|
||||||
if (bone.opensDetail && species?.details[bone.opensDetail]) {
|
if (bone.opensDetail && species?.details[bone.opensDetail]) {
|
||||||
@@ -105,18 +121,35 @@ export default function EditorRoute() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const matches = (z: ObservationZone) =>
|
||||||
|
z.boneId === boneId && z.detailSourceId === detailSourceId
|
||||||
|
const existingIndex = activeObs.zones.findIndex(matches)
|
||||||
|
|
||||||
|
if (bone.special === 'vertebral-precision') {
|
||||||
|
// Spine-zone behavior: always open VertebraPicker on click. Add the
|
||||||
|
// zone if missing; never toggle it off here (use the ✕ button).
|
||||||
|
let targetIndex = existingIndex
|
||||||
|
if (existingIndex < 0) {
|
||||||
|
const newZone: ObservationZone = {
|
||||||
|
boneId,
|
||||||
|
...(detailSourceId ? { detailSourceId } : {}),
|
||||||
|
}
|
||||||
|
const nextZones = [...activeObs.zones, newZone]
|
||||||
|
targetIndex = nextZones.length - 1
|
||||||
|
updateObservation(activeIndex, { ...activeObs, zones: nextZones })
|
||||||
|
}
|
||||||
|
setVertebraTarget(targetIndex)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const newZone: ObservationZone = {
|
const newZone: ObservationZone = {
|
||||||
boneId,
|
boneId,
|
||||||
...(detailSourceId ? { detailSourceId } : {}),
|
...(detailSourceId ? { detailSourceId } : {}),
|
||||||
}
|
}
|
||||||
const exists = activeObs.zones.some(
|
const nextZones =
|
||||||
(z) => z.boneId === boneId && z.detailSourceId === detailSourceId,
|
existingIndex >= 0
|
||||||
)
|
? activeObs.zones.filter((_, k) => k !== existingIndex)
|
||||||
const nextZones = exists
|
: [...activeObs.zones, newZone]
|
||||||
? activeObs.zones.filter(
|
|
||||||
(z) => !(z.boneId === boneId && z.detailSourceId === detailSourceId),
|
|
||||||
)
|
|
||||||
: [...activeObs.zones, newZone]
|
|
||||||
updateObservation(activeIndex, { ...activeObs, zones: nextZones })
|
updateObservation(activeIndex, { ...activeObs, zones: nextZones })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -187,18 +187,22 @@ export default function ObservationCard({
|
|||||||
<ul className="flex flex-wrap gap-2">
|
<ul className="flex flex-wrap gap-2">
|
||||||
{observation.zones.map((z, i) => {
|
{observation.zones.map((z, i) => {
|
||||||
const b = bones.get(z.boneId)
|
const b = bones.get(z.boneId)
|
||||||
|
const supportsVertebrae =
|
||||||
|
b?.special === 'vertebral-precision'
|
||||||
return (
|
return (
|
||||||
<li key={`${z.boneId}-${i}`}>
|
<li key={`${z.boneId}-${i}`}>
|
||||||
<Badge tone="accent" className="gap-2">
|
<Badge tone="accent" className="gap-2">
|
||||||
{describeZone(z, bones)}
|
{describeZone(z, bones)}
|
||||||
<button
|
{supportsVertebrae && (
|
||||||
type="button"
|
<button
|
||||||
onClick={() => onOpenVertebraPicker(i)}
|
type="button"
|
||||||
className="underline text-xs text-[var(--color-accent-strong)]"
|
onClick={() => onOpenVertebraPicker(i)}
|
||||||
title="Préciser les vertèbres pour cette zone"
|
className="underline text-xs text-[var(--color-accent-strong)]"
|
||||||
>
|
title="Préciser les vertèbres pour cette zone"
|
||||||
Vertèbres…
|
>
|
||||||
</button>
|
Vertèbres…
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
aria-label={`Retirer ${b?.fr ?? z.boneId}`}
|
aria-label={`Retirer ${b?.fr ?? z.boneId}`}
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ const FIXTURE = `
|
|||||||
<circle data-anno-id="point-shoulder" data-anno-name-fr="Épaule" data-anno-name-en="Shoulder"
|
<circle data-anno-id="point-shoulder" data-anno-name-fr="Épaule" data-anno-name-en="Shoulder"
|
||||||
data-anno-category="articulations" />
|
data-anno-category="articulations" />
|
||||||
<polygon data-anno-id="zone-cervical" data-anno-name-fr="Vertèbres cervicales"
|
<polygon data-anno-id="zone-cervical" data-anno-name-fr="Vertèbres cervicales"
|
||||||
data-anno-name-en="Cervical Vertebrae" data-anno-category="zone-colonne" />
|
data-anno-name-en="Cervical Vertebrae" data-anno-category="zone-colonne"
|
||||||
|
data-anno-special="vertebral-precision" />
|
||||||
<polygon data-anno-id="zone-head" data-anno-category="os" data-anno-opens-detail="head" />
|
<polygon data-anno-id="zone-head" data-anno-category="os" data-anno-opens-detail="head" />
|
||||||
<polygon data-anno-id="zone-future" data-anno-name-fr="Catégorie inédite"
|
<polygon data-anno-id="zone-future" data-anno-name-fr="Catégorie inédite"
|
||||||
data-anno-category="something-new-the-parser-has-never-seen" />
|
data-anno-category="something-new-the-parser-has-never-seen" />
|
||||||
@@ -39,6 +40,12 @@ describe('parseSvgBones', () => {
|
|||||||
expect(map.get('zone-head')?.opensDetail).toBe('head')
|
expect(map.get('zone-head')?.opensDetail).toBe('head')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('captures data-anno-special when present', () => {
|
||||||
|
const map = parseSvgBones(svgFromString(FIXTURE))
|
||||||
|
expect(map.get('zone-cervical')?.special).toBe('vertebral-precision')
|
||||||
|
expect(map.get('point-shoulder')?.special).toBeUndefined()
|
||||||
|
})
|
||||||
|
|
||||||
it('allows annotations without data-anno-name-fr/en (trigger-only zones)', () => {
|
it('allows annotations without data-anno-name-fr/en (trigger-only zones)', () => {
|
||||||
const map = parseSvgBones(svgFromString(FIXTURE))
|
const map = parseSvgBones(svgFromString(FIXTURE))
|
||||||
const trigger = map.get('zone-head')
|
const trigger = map.get('zone-head')
|
||||||
|
|||||||
Reference in new issue
Block a user