fix(editor): no silent move loss, no empty commit, focus kept
- « Toutes les annotations » in the properties panel asks the drawing
guard before it drops a started move (R-12); tests also cover a tool
and « Ajouter un point ».
- A keyboard series back on its place, or a slider pinned at its stop,
commits nothing.
- Escape that deselects from the handle or the slider moves the focus to
the row (or the drawing) instead of losing it.
- A link circle keeps its handle, named « Accès {nom} », with no slider
and no move mode (no label for it in REVUE).
- The move-mode drop notice waits until the body is shown (R-14).
- No layout shift: the strip's lead has a fixed width, the commands and
the message pill get a new box per set or message.
- Doc: hit shapes use pointer-events auto; the fine « − » bubble is
board 05's size.
- Tests: R-14 flip, A5 through the Point tool click, the repair e2e
wrapped in expectNoShift.
This commit is contained in:
1 parent
91e94952f0
commit
44de465c6d
10 files changed
+240
-35
No files matched your search
@@ -4,7 +4,12 @@ import { useEditorStore } from '../state/editorStore'
|
||||
import { moveStep, type Frame } from './frame'
|
||||
import type { GeometryChange } from './usePlacement'
|
||||
import { takeMove, takePreview, stepSelection } from './previewCommit'
|
||||
import { endMode, startMove, useAnnotationWork } from './workStore'
|
||||
import {
|
||||
endMode,
|
||||
startMove,
|
||||
useAnnotationWork,
|
||||
type Preview,
|
||||
} from './workStore'
|
||||
|
||||
type Drop = (id: string, geometry: Geometry, change?: GeometryChange) => void
|
||||
|
||||
@@ -40,15 +45,26 @@ function step(input: PointEditInput, direction: Direction, big: boolean) {
|
||||
stepSelection(target.id, target.geometry, { x: x * size, y: y * size })
|
||||
}
|
||||
|
||||
/** The commits of the pending work: each takes its preview, fresh only (R-13). */
|
||||
function commits(onDrop: Drop) {
|
||||
/** A preview back on the stored shape (there and back, a pinned slider) is no change. */
|
||||
function changed(
|
||||
preview: Preview | null,
|
||||
target: Annotation | null,
|
||||
): preview is Preview {
|
||||
if (!preview || preview.annotationId !== target?.id) return false
|
||||
return JSON.stringify(preview.geometry) !== JSON.stringify(target.geometry)
|
||||
}
|
||||
|
||||
/** The commits of the pending work: each takes its preview, fresh and changed only (R-13). */
|
||||
function commits({ onDrop, target }: PointEditInput) {
|
||||
const keys = () => {
|
||||
const preview = takePreview('keys')
|
||||
if (preview) onDrop(preview.annotationId, preview.geometry)
|
||||
if (changed(preview, target)) onDrop(preview.annotationId, preview.geometry)
|
||||
}
|
||||
const size = () => {
|
||||
const preview = takePreview('size')
|
||||
if (preview) onDrop(preview.annotationId, preview.geometry, 'size')
|
||||
if (changed(preview, target)) {
|
||||
onDrop(preview.annotationId, preview.geometry, 'size')
|
||||
}
|
||||
}
|
||||
const move = () => {
|
||||
const preview = takeMove()
|
||||
@@ -80,7 +96,7 @@ function handleKeys(input: PointEditInput, commit: ReturnType<typeof commits>) {
|
||||
* « Valider la position » committing once, « Annuler »).
|
||||
*/
|
||||
export function usePointEdit(input: PointEditInput) {
|
||||
const commit = commits(input.onDrop)
|
||||
const commit = commits(input)
|
||||
return {
|
||||
onHandleKey: handleKeys(input, commit),
|
||||
// BDR-050: leaving the handle commits its series; a move mode waits for « Valider ».
|
||||
|
||||
Reference in new issue
Block a user