feat(editor): point handle, size slider with core minimum, move mode

HandleLayer: its own svg over the overlay, not aria-hidden; the selected
point (or link circle) gets a focusable « Point {nom} » handle whose hit
circle (data-handle) the press machine reads, sized in CSS px under zoom
(R-9, read once from any-pointer: coarse). The Task 2 stand-in (the
selected marker as its own handle) is removed.

Keys on the handle: arrows step 0.5 % of the frame (Shift x10) as a
stamped series, Enter or blur commit once, Escape drops it (R-11, R-13).
SizeSlider in the strip for a selected point and for the Point tool (A5):
the view's sizes as ticks, the core minimum as a red mark, snap 8 px,
arrows 1 %, Page Up/Down next size, one commit on release, Enter or blur;
a refusal restores the size and draws the refused place in red dashes.
« Déplacer le point » opens the move mode (board 06 B): drag anywhere or
four arrows move a preview only, clicks select nothing, « Valider la
position » commits once, « Annuler » and Escape restore; the focus comes
back to the button. Escape follows board 32 (escapeAction). The overlay
reads the preview from the work store and draws the old place in grey
dashes. Ctrl+Z now also works from a slider (not a text field).

Rewritten assertions:
- editor-annotations-tab « a finger drags the selected point »:
  drag(marker('anno-a')) -> drag(pointHandle()), same expected geometry.
- editor-geometry.spec « a point inherited out of its frame is repaired
  through the geometry group » (cx/cy typed 200) -> « ... repaired with
  the move mode »: a partial move refused and restored (cx 110, issue
  kept), then a move inside kept (issue gone, fewer errors).
This commit is contained in:
bchanot committed 2026-11-17 18:50:29 +01:00
1 parent 2882821661
commit 91e94952f0
23 files changed
+1679 -149

No files matched your search

@@ -1,5 +1,6 @@
import type { Dispatch, KeyboardEvent } from 'react'
import type {
Annotation,
AnatomicalSheetDocument,
Geometry,
Point,
@@ -96,24 +97,36 @@ function tracingActions(input: PlacementInput) {
return { closeTracing, trace, onTraceKey }
}
/** A drop commits one update; the line under the drawing says it, or the core's refusal. */
/** A move (drag, move mode, arrow keys) or a size change of the selection. */
export type GeometryChange = 'move' | 'size'
/** The message keys of a kept and of a refused change. */
function changeKeys(change: GeometryChange, kind: Annotation['kind']) {
return change === 'size'
? { kept: 'resized', refused: 'size_refused' }
: { kept: `moved.${kind}`, refused: 'move_refused' }
}
/**
* A drop commits one update; the line under the drawing says it, or the core's refusal
* with the refused place drawn (the shape stays where it was).
*/
function dropAction({ doc, context, message, dispatch }: PlacementInput) {
return (id: string, geometry: Geometry) => {
return (id: string, geometry: Geometry, change: GeometryChange = 'move') => {
const annotation = doc.annotations.find((a) => a.id === id)
if (!annotation) return
const keys = changeKeys(change, annotation.kind)
const result = updateGeometry(annotation, geometry, context)
if (result.ok) {
// A kept move ends any refusal the strip still shows.
dispatch({ type: 'hint', hint: null })
const text = context.t(
`editor.annotations.message.moved.${annotation.kind}`,
)
const text = context.t(`editor.annotations.message.${keys.kept}`)
return message.show(text, { undo: true, tone: 'info' })
}
const text = context
.t('editor.annotations.message.move_refused')
.t(`editor.annotations.message.${keys.refused}`)
.replace('{text}', () => result.messages.join(' '))
message.show(text, { undo: false, tone: 'error' })
message.show(text, { undo: false, tone: 'error', place: geometry })
}
}