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

@@ -3,6 +3,7 @@ import type { Geometry, Point } from '@faunosteo/core-wasm/types'
import type { Correction } from '@/editor/annotations/correction'
import type { Frame } from '@/editor/annotations/frame'
import { isEditable } from '@/editor/annotations/geometryEdit'
import { useAnnotationWork } from '@/editor/annotations/workStore'
export interface OverlayProps {
svgRef: Ref<SVGSVGElement>
@@ -10,8 +11,11 @@ export interface OverlayProps {
viewBox: string
ratio: string
frame: Frame | null
selectedId: string | null
selected: Geometry | null
dragged: Geometry | null
/** The place the core just refused (red dashes while its message shows). */
refused: Geometry | null
pending: Geometry | null
tracing: Point[] | null
correction: Correction | null
@@ -105,16 +109,28 @@ function TracingPath({ points, size }: { points: Point[]; size: number }) {
)
}
/** The selection's pending preview (move mode, slider, keys), read without the tab. */
function usePreviewOf(selectedId: string | null): Geometry | null {
return useAnnotationWork((s) =>
selectedId !== null && s.preview?.annotationId === selectedId
? s.preview.geometry
: null,
)
}
/**
* The page-drawn overlay (docs/ANNOTATION-RENDERING.md « Editor overlay »): numbers only,
* no annotation. Selection outline, vertex circles, the tracing in progress, the pending
* or dragged outline, a corrected position with the click marked apart. It never takes
* the pointer: the canvas box does.
* or dragged outline, a corrected position with the click marked apart; during a gesture
* the old place in grey dashes, after a refusal the refused place in red dashes. It never
* takes the pointer: the canvas box does.
*/
export default function AnnotationOverlay(props: OverlayProps) {
const { frame, selected, dragged, pending, tracing, correction } = props
const { frame, selected, pending, tracing, correction } = props
const size = frame ? Math.max(frame.w, frame.h) / 200 : 1
const shown = dragged ?? selected
const preview = usePreviewOf(props.selectedId)
const moved = props.dragged ?? preview
const shown = moved ?? selected
return (
<svg
ref={props.svgRef}
@@ -124,6 +140,20 @@ export default function AnnotationOverlay(props: OverlayProps) {
preserveAspectRatio={props.ratio}
className="pointer-events-none absolute inset-0 h-full w-full"
>
{moved && selected && isEditable(selected) && (
<g data-testid="overlay-old-place">
<Outline geometry={selected} dashed colour="var(--color-ink-muted)" />
</g>
)}
{props.refused && (
<g data-testid="overlay-refused-place">
<Outline
geometry={props.refused}
dashed
colour="var(--color-danger-strong)"
/>
</g>
)}
{shown && isEditable(shown) && (
<>
<Outline geometry={shown} dashed colour="var(--color-ink)" />