feat(editor): add laterality dropdown to SVG editor
Adds a Latéralité/Laterality select (unpaired / bilateral) to the SVG editor edit panel. Value is persisted as data-anno-lateral on all sibling elements via applyEdit and restored on selection via showEditPanel. i18n keys added to both fr/en dicts. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
773b00282f
commit
a4739df538
3 files changed
+20
-1
No files matched your search
@@ -153,6 +153,11 @@ export default function SvgEditorRoute() {
|
||||
<input id="svg-editor-edit-en" placeholder="ex: Hip joint" />
|
||||
<label>{t('svg_editor.category')}</label>
|
||||
<select id="svg-editor-edit-category" />
|
||||
<label>{t('svg_editor.lateral')}</label>
|
||||
<select id="svg-editor-edit-lateral">
|
||||
<option value="">{t('svg_editor.lateral_unpaired')}</option>
|
||||
<option value="bilateral">{t('svg_editor.lateral_bilateral')}</option>
|
||||
</select>
|
||||
<label id="svg-editor-lbl-radius">{t('svg_editor.radius')}</label>
|
||||
<div className="slider-row" id="svg-editor-radius-row">
|
||||
<input id="svg-editor-edit-radius" type="range" min={1} max={80} defaultValue={15} />
|
||||
@@ -715,7 +720,7 @@ function initSvgEditor(
|
||||
|
||||
getEl('svg-editor-filter-input').addEventListener('input', refreshElementList, sig)
|
||||
|
||||
;['svg-editor-edit-fr', 'svg-editor-edit-en', 'svg-editor-edit-category'].forEach(
|
||||
;['svg-editor-edit-fr', 'svg-editor-edit-en', 'svg-editor-edit-category', 'svg-editor-edit-lateral'].forEach(
|
||||
(id) => {
|
||||
getEl(id).addEventListener('change', applyEdit, sig)
|
||||
},
|
||||
@@ -889,6 +894,8 @@ function initSvgEditor(
|
||||
svgEl.getAttribute('data-anno-name-en') || ''
|
||||
;(getEl('svg-editor-edit-category') as HTMLSelectElement).value =
|
||||
svgEl.getAttribute('data-anno-category') || 'custom'
|
||||
;(getEl('svg-editor-edit-lateral') as HTMLSelectElement).value =
|
||||
svgEl.getAttribute('data-anno-lateral') || ''
|
||||
|
||||
const id = svgEl.getAttribute('data-anno-id')!
|
||||
const cat = svgEl.getAttribute('data-anno-category')
|
||||
@@ -976,6 +983,7 @@ function initSvgEditor(
|
||||
const fr = (getEl('svg-editor-edit-fr') as HTMLInputElement).value.trim()
|
||||
const en = (getEl('svg-editor-edit-en') as HTMLInputElement).value.trim()
|
||||
const cat = (getEl('svg-editor-edit-category') as HTMLSelectElement).value
|
||||
const lateral = (getEl('svg-editor-edit-lateral') as HTMLSelectElement).value
|
||||
const opacityPct = (getEl('svg-editor-edit-opacity') as HTMLInputElement).value
|
||||
const opacity = (parseFloat(opacityPct) / 100).toString()
|
||||
const radius = (getEl('svg-editor-edit-radius') as HTMLInputElement).value
|
||||
@@ -1017,6 +1025,11 @@ function initSvgEditor(
|
||||
s.removeAttribute('data-anno-special')
|
||||
}
|
||||
}
|
||||
if (lateral) {
|
||||
s.setAttribute('data-anno-lateral', lateral)
|
||||
} else {
|
||||
s.removeAttribute('data-anno-lateral')
|
||||
}
|
||||
}
|
||||
|
||||
if (opensDetailEnabled && detailTarget) {
|
||||
|
||||
@@ -227,4 +227,7 @@ export const en: Dict = {
|
||||
'svg_editor.handle_insert': 'Click to insert a vertex here',
|
||||
'svg_editor.polygon_vertices': 'polygon ({count} vertices)',
|
||||
'svg_editor.drop_svg_here': 'Drop SVG here',
|
||||
'svg_editor.lateral': 'Laterality',
|
||||
'svg_editor.lateral_unpaired': 'Unpaired (no side)',
|
||||
'svg_editor.lateral_bilateral': 'Bilateral (left / right)',
|
||||
}
|
||||
@@ -244,4 +244,7 @@ export const fr: Dict = {
|
||||
'svg_editor.handle_insert': 'Cliquez pour insérer un sommet ici',
|
||||
'svg_editor.polygon_vertices': 'polygone ({count} sommets)',
|
||||
'svg_editor.drop_svg_here': 'Déposez le SVG ici',
|
||||
'svg_editor.lateral': 'Latéralité',
|
||||
'svg_editor.lateral_unpaired': 'Impair (pas de côté)',
|
||||
'svg_editor.lateral_bilateral': 'Bilatéral (gauche / droite)',
|
||||
}
|
||||
Reference in new issue
Block a user