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:
1 parent
9d03e0675c
commit
8cd1bda6c2
13 files changed
+513
-100
No files matched your search
@@ -8,6 +8,7 @@ import { useT } from '@/i18n/useT'
|
||||
import { updateGeometry, type CommitContext } from './annotationCommit'
|
||||
import { pendingForClick, type NewKind } from './creation'
|
||||
import { round2, type Frame, type XY } from './frame'
|
||||
import { newPointSize } from './pointSize'
|
||||
import type { ToolId, Tracing, UiAction, UiState } from './uiState'
|
||||
import type { GestureMessages } from './useGestureMessage'
|
||||
|
||||
@@ -25,6 +26,7 @@ export interface PlacementInput {
|
||||
dispatch: Dispatch<UiAction>
|
||||
frame: Frame | null
|
||||
doc: AnatomicalSheetDocument
|
||||
viewId: string
|
||||
context: CommitContext
|
||||
/** The line under the drawing: a kept drop says so with « Défaire », a refused one in red. */
|
||||
message: Pick<GestureMessages, 'show'>
|
||||
@@ -128,7 +130,9 @@ export function usePlacement(input: PlacementInput) {
|
||||
if (ui.tool === 'zone' || ui.tool === 'link')
|
||||
return tracing.trace(ui.tool, at)
|
||||
if (ui.tool !== 'point' || !frame) return
|
||||
const outcome = pendingForClick(frame, at)
|
||||
const { doc, viewId } = input
|
||||
const size = newPointSize(doc.annotations, viewId, frame, ui.size)
|
||||
const outcome = pendingForClick(frame, at, size)
|
||||
if (outcome.kind === 'pending') {
|
||||
return dispatch({ type: 'pending_new', pending: outcome.pending })
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user