fix(editor): slider while replacing, announced drop, review minors
Task 7 fix round 1 (review task-7-review.md). - Important 1: « Taille » shows beside « Revenir aux propriétés » while a point is replaced (still hidden under the modal dialog); it feeds the hover preview and the re-placed point (R-10). - Important 2: a creation whose view leaves the document is dropped and said, « Création abandonnée : la fiche a changé. » (dropped: 'creation', read by useDroppedNotice). - Minor 3: DrawingGuardDialog leaves a creation question to the creation dialog only while that dialog is really on screen (creationShown, set by the dialog). - Minor 7: the dialog's long className strings split into constants. - Minor 8: dead TOOL_OF removed; trace_start is a redraw's only. Tests added (no assertion removed): slider while replacing (unit, RED then GREEN; e2e under expectNoShift at three widths, last strip command inside the strip); view removed during a creation (RED then GREEN); question shown by the workspace when the dialog is not on screen (RED then GREEN); « Abandonner » while read-only; R-13 with a restored copy during a started move; leaving the route resets the work (fails with the session reset removed). The unit Back test's comment is corrected: it does pin the modal branch.
This commit is contained in:
1 parent
fe333c2bbd
commit
837ec9f436
14 files changed
+315
-29
No files matched your search
@@ -139,6 +139,15 @@ export function dropCreation(): void {
|
||||
useAnnotationWork.setState({ creation: null, question: lapsed() })
|
||||
}
|
||||
|
||||
/** A document change removed the creation's view (R-13): dropped, and said by the tab. */
|
||||
export function dropCreationGone(): void {
|
||||
useAnnotationWork.setState({
|
||||
creation: null,
|
||||
question: lapsed(),
|
||||
dropped: 'creation',
|
||||
})
|
||||
}
|
||||
|
||||
/** « Créer » succeeded: the creation ends, the drawing selects `id` (A7). */
|
||||
export function finishCreation(id: string, kind: NewKind): void {
|
||||
useAnnotationWork.setState({
|
||||
|
||||
@@ -32,7 +32,8 @@ export type UiAction =
|
||||
| { type: 'view'; viewId: string }
|
||||
| { type: 'tool'; tool: ToolId }
|
||||
| { type: 'select'; id: string | null }
|
||||
| { type: 'trace_start'; target: Tracing['target']; annotationId?: string }
|
||||
/** A redraw's tracing (a new shape's is the creation's, U2 Task 7). */
|
||||
| { type: 'trace_start'; target: 'replace'; annotationId: string }
|
||||
| { type: 'trace_add'; point: Point }
|
||||
| { type: 'trace_pop' }
|
||||
| { type: 'trace_cancel' }
|
||||
@@ -51,13 +52,6 @@ export const initialUi: UiState = {
|
||||
size: null,
|
||||
}
|
||||
|
||||
const TOOL_OF: Record<Tracing['target'], ToolId> = {
|
||||
point: 'point',
|
||||
zone: 'zone',
|
||||
detail_trigger: 'link',
|
||||
replace: 'zone',
|
||||
}
|
||||
|
||||
/** A redraw lends the zone tool to its tracing: whatever ends it gives the select tool back. */
|
||||
const toolAfterTracing = (state: UiState): ToolId =>
|
||||
state.tracing?.target === 'replace' ? 'select' : state.tool
|
||||
@@ -89,11 +83,12 @@ export function uiReducer(state: UiState, action: UiAction): UiState {
|
||||
case 'trace_start':
|
||||
return {
|
||||
...state,
|
||||
tool: TOOL_OF[action.target],
|
||||
// A redraw lends the zone tool to its tracing.
|
||||
tool: 'zone',
|
||||
hint: null,
|
||||
tracing: {
|
||||
target: action.target,
|
||||
annotationId: action.annotationId ?? null,
|
||||
annotationId: action.annotationId,
|
||||
points: [],
|
||||
refused: false,
|
||||
},
|
||||
|
||||
@@ -2,7 +2,7 @@ import { useEffect, useRef, type Dispatch } from 'react'
|
||||
import type { AnatomicalSheetDocument } from '@faunosteo/core-wasm/types'
|
||||
import { landAfterModalsClosed } from '@/components/ui/afterModalsClosed'
|
||||
import type { NewKind } from './creation'
|
||||
import { dropCreation } from './creationWork'
|
||||
import { dropCreationGone } from './creationWork'
|
||||
import { focusRowOrDrawing } from './deselect'
|
||||
import type { ToolId, UiAction, UiState } from './uiState'
|
||||
import type { GestureMessages } from './useGestureMessage'
|
||||
@@ -26,7 +26,7 @@ export interface CreationFollow {
|
||||
/**
|
||||
* The drawing kept in step with the creation: nothing selected once its shape is placed, its tool
|
||||
* on while the dialog is hidden (« Replacer le point » places with the point tool, a
|
||||
* resumed tracing traces), and dropped when its view no longer exists.
|
||||
* resumed tracing traces), and dropped, said, when its view no longer exists (R-13).
|
||||
*/
|
||||
function useDrawingFollows({ doc, ui, dispatch, creation }: CreationFollow) {
|
||||
const wanted =
|
||||
@@ -43,7 +43,7 @@ function useDrawingFollows({ doc, ui, dispatch, creation }: CreationFollow) {
|
||||
if (selected) dispatch({ type: 'select', id: null })
|
||||
}, [selected, dispatch])
|
||||
useEffect(() => {
|
||||
if (gone) dropCreation()
|
||||
if (gone) dropCreationGone()
|
||||
}, [gone])
|
||||
}
|
||||
|
||||
|
||||
@@ -59,16 +59,25 @@ export interface DrawingQuestion {
|
||||
}
|
||||
interface Work {
|
||||
creation: Creation | null
|
||||
/**
|
||||
* The creation dialog is really on screen (its place shown): only then does it ask the
|
||||
* creation's question in its own footer instead of the workspace's dialog.
|
||||
*/
|
||||
creationShown: boolean
|
||||
created: Created | null
|
||||
mode: ModeWork | null
|
||||
preview: Preview | null
|
||||
chosen: Chosen | null
|
||||
/** A started mode a document change dropped (R-13): the tab says so, then clears it. */
|
||||
dropped: ModeWork['kind'] | null
|
||||
/**
|
||||
* Work a document change dropped (R-13): a started mode, or a creation whose view left the
|
||||
* document. The tab says so, then clears it.
|
||||
*/
|
||||
dropped: ModeWork['kind'] | 'creation' | null
|
||||
question: DrawingQuestion | null
|
||||
}
|
||||
const NO_WORK: Work = {
|
||||
creation: null,
|
||||
creationShown: false,
|
||||
created: null,
|
||||
mode: null,
|
||||
preview: null,
|
||||
|
||||
Reference in new issue
Block a user