feat(editor): new points take the view's most used size (A5, R-10)

proposePoint, correctedCircle and centreCircle take the wanted radius,
fitted to the frame; pendingForClick, keyboardPending and the C26 test
(correctionFor) use it. The size comes from newPointSize: the strip's
choice, else the most used radius of the view, else defaultRadius.
pointSize.ts (stops, snap, range) and escape.ts (board 32 order) land
with their tests; the repair dialog keeps defaultRadius (D1).

Rewritten assertions: editor-frame.test.ts calls now pass
defaultRadius(frame) explicitly, same expected values.
This commit is contained in:
bchanot committed 2026-11-17 18:20:58 +01:00
1 parent 9d03e0675c
commit 8cd1bda6c2
13 files changed
+513 -100

No files matched your search

@@ -8,6 +8,7 @@ import type { CommitContext } from '@/editor/annotations/annotationCommit'
import { useAnnotationRequest } from '@/editor/annotations/focusTarget'
import { keyboardPending, type NewKind } from '@/editor/annotations/creation'
import { parseFrame, type Frame } from '@/editor/annotations/frame'
import { newPointSize } from '@/editor/annotations/pointSize'
import { isEditable } from '@/editor/annotations/geometryEdit'
import { useSelectionEscape } from '@/editor/annotations/deselect'
import { usePlacement } from '@/editor/annotations/usePlacement'
@@ -200,7 +201,7 @@ function CanvasColumn({
<KeyboardAdd
disabled={!model.measured || noCategory || scene.frame === null}
linkDisabled={model.children.length === 0}
onAdd={(kind) => addAtCentre(kind, scene.frame, dispatch)}
onAdd={(kind) => addAtCentre(kind, scene)}
/>
</GestureMessage>
</div>
@@ -249,11 +250,11 @@ function CanvasStage({
function addAtCentre(
kind: NewKind,
frame: Frame | null,
dispatch: Dispatch<UiAction>,
{ frame, doc, viewId, ui, dispatch }: Scene,
) {
if (!frame) return
dispatch({ type: 'pending_new', pending: keyboardPending(kind, frame) })
const size = newPointSize(doc.annotations, viewId, frame, ui.size)
dispatch({ type: 'pending_new', pending: keyboardPending(kind, frame, size) })
}
/** The creation panel while an element is pending, else the selection's properties. */