feat(editor): fixed edit strip and message line without layout shift
U2 Task 3 (A6, A14, R-2). A fixed-height strip over the drawing and the right column replaces the tool line, the sr-only selection tag of the edit body and TracingBar: lead (name + status, type + detail), notice (refusal, first geometry issue + n, unmeasured view with its link, no category, no child view), commands (Fermer le trace, Retirer le dernier sommet, Annuler le trace). A fixed-height line under the drawing holds the add buttons and the gesture message: a kept drop says « Point deplace » with « Defaire » (same store undo as the header), a refused drop says « Deplacement refuse : ... » as a red alert. 6 s, held by mouse hover and focus inside, closed by any commit, undo or redo. trace_pop and Backspace remove the last vertex. The busy « Aller a » target is the strip's tracing commands. scrollbar-gutter stable, scoped to the editor. e2e helper expectNoShift (boxes, scroll height, gutter, client width, layout-shift sum). DraftHeader untouched: no shift seen. Rewritten assertions (old -> new): - tab unit « Sélection : point » on annotation-selection-tag -> strip detail « Point » - tab unit tag sr-only, not live -> strip lead outside any live region - tab unit « 1 sommet posé. » -> « 1 sommet posé » (board 04 wording) - tab unit D6b tag present / « zone » -> strip detail « Point » / « Zone · 3 sommets » - keep-alive, sections, escape units: tracing-bar -> tracing-commands - e2e selectionTag helper -> strip title with data-selection; the twin's tag is twinSelectionTag (deselect 375 px describe) - e2e deselect « tag position absolute » (edit) -> strip height 64 px, drawing top unchanged; twin Escape test keeps tag 0, properties 0, overview visible - e2e deselect and journey tracing-bar / annotation-selection-tag -> tracing-commands / selectionTag - e2e historyButton scoped to history-buttons (the message's « Défaire » has the same accessible name)
This commit is contained in:
1 parent
b2d78f9621
commit
1deb037fac
23 files changed
+1228
-181
No files matched your search
@@ -9,6 +9,7 @@ import { updateGeometry, type CommitContext } from './annotationCommit'
|
||||
import { pendingForClick, type NewKind } from './creation'
|
||||
import { round2, type Frame, type XY } from './frame'
|
||||
import type { ToolId, Tracing, UiAction, UiState } from './uiState'
|
||||
import type { GestureMessages } from './useGestureMessage'
|
||||
|
||||
/** A click on the first vertex closes the tracing when within this share of F's span. */
|
||||
const CLOSE_SHARE = 0.015
|
||||
@@ -25,6 +26,8 @@ export interface PlacementInput {
|
||||
frame: Frame | null
|
||||
doc: AnatomicalSheetDocument
|
||||
context: CommitContext
|
||||
/** The line under the drawing: a kept drop says so with « Défaire », a refused one in red. */
|
||||
message: Pick<GestureMessages, 'show'>
|
||||
}
|
||||
|
||||
const asPoint = (at: XY): Point => [round2(at.x), round2(at.y)]
|
||||
@@ -62,7 +65,7 @@ export function closingActions(
|
||||
]
|
||||
}
|
||||
|
||||
/** Tracing with the zone and link tools: vertices, closing, Enter and Escape. */
|
||||
/** Tracing with the zone and link tools: vertices, closing, Enter, Backspace and Escape. */
|
||||
function tracingActions(input: PlacementInput) {
|
||||
const { ui, dispatch, frame } = input
|
||||
const closeTracing = () =>
|
||||
@@ -79,6 +82,10 @@ function tracingActions(input: PlacementInput) {
|
||||
const onTraceKey = (event: KeyboardEvent) => {
|
||||
if (!ui.tracing) return
|
||||
if (event.key === 'Enter') closeTracing()
|
||||
if (event.key === 'Backspace') {
|
||||
event.preventDefault()
|
||||
dispatch({ type: 'trace_pop' })
|
||||
}
|
||||
if (event.key === 'Escape') {
|
||||
event.preventDefault()
|
||||
dispatch({ type: 'trace_cancel' })
|
||||
@@ -87,14 +94,22 @@ function tracingActions(input: PlacementInput) {
|
||||
return { closeTracing, trace, onTraceKey }
|
||||
}
|
||||
|
||||
/** A drop commits one update; the hint holds the core's words on a refusal. */
|
||||
function dropAction(input: PlacementInput) {
|
||||
/** A drop commits one update; the line under the drawing says it, or the core's refusal. */
|
||||
function dropAction({ doc, context, message }: PlacementInput) {
|
||||
return (id: string, geometry: Geometry) => {
|
||||
const annotation = input.doc.annotations.find((a) => a.id === id)
|
||||
const annotation = doc.annotations.find((a) => a.id === id)
|
||||
if (!annotation) return
|
||||
const result = updateGeometry(annotation, geometry, input.context)
|
||||
const hint = result.ok ? null : result.messages.join(' ')
|
||||
input.dispatch({ type: 'hint', hint })
|
||||
const result = updateGeometry(annotation, geometry, context)
|
||||
if (result.ok) {
|
||||
const text = context.t(
|
||||
`editor.annotations.message.moved.${annotation.kind}`,
|
||||
)
|
||||
return message.show(text, { undo: true, tone: 'info' })
|
||||
}
|
||||
const text = context
|
||||
.t('editor.annotations.message.move_refused')
|
||||
.replace('{text}', () => result.messages.join(' '))
|
||||
message.show(text, { undo: false, tone: 'error' })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,5 +137,6 @@ export function usePlacement(input: PlacementInput) {
|
||||
onDrop: dropAction(input),
|
||||
onTraceKey: tracing.onTraceKey,
|
||||
closeTracing: tracing.closeTracing,
|
||||
popVertex: () => dispatch({ type: 'trace_pop' }),
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user