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:
Bastien ChanotandClaude committed 2026-05-19 04:58:04 +02:00
1 parent 21b678c3d5
commit b9da4fa04a
7 files changed
+86 -22

No files matched your search

+9 -3
View File
@@ -20,6 +20,7 @@ Every clickable zone element must carry all four attributes:
| 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-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
→ if data-anno-opens-detail present → emit requestDetail({id})
→ else if category === 'spine-zone' → open VertebraPicker
→ else → add bone to current observation
→ else if data-anno-special === 'vertebral-precision' →
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.
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
@@ -152,7 +157,8 @@ When a zone has `data-anno-opens-detail="head"`:
## 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).
- Multi-select chip grid, ≥40 px touch targets.