From 17c35638e8841a4abbcfaac8250a10c554f5b796 Mon Sep 17 00:00:00 2001 From: bchanot Date: Fri, 20 Nov 2026 16:34:58 +0100 Subject: [PATCH] fix(editor): bubble frame fallback, modified Enter, one tool rule, fr wording --- apps/app/src/editor/annotations/removeBubble.ts | 7 +++++-- apps/app/src/editor/annotations/uiState.ts | 11 ++++------- apps/app/src/editor/annotations/usePlacement.ts | 1 + apps/app/src/i18n/fr.ts | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/apps/app/src/editor/annotations/removeBubble.ts b/apps/app/src/editor/annotations/removeBubble.ts index bd4e444a..fe574ef2 100644 --- a/apps/app/src/editor/annotations/removeBubble.ts +++ b/apps/app/src/editor/annotations/removeBubble.ts @@ -144,10 +144,13 @@ function aroundVertex(scene: BubbleScene, chosen: number): Around { return { insertMids, vertices } } -/** The bound in force: `bounds`, or the whole frame when the vertex is off screen. */ +/** + * The bound in force: `bounds`, or the whole frame when the vertex is off screen or when + * nothing of the frame is on screen (`bounds` null). + */ function effectiveBounds(scene: BubbleScene, vertex: Point): Frame | null { const { bounds, frame } = scene - if (bounds === null) return null + if (bounds === null) return frame const slack = EDGE_PX * scene.unit const onScreen = vertex[0] >= bounds.x - slack && diff --git a/apps/app/src/editor/annotations/uiState.ts b/apps/app/src/editor/annotations/uiState.ts index 1370b060..491cc850 100644 --- a/apps/app/src/editor/annotations/uiState.ts +++ b/apps/app/src/editor/annotations/uiState.ts @@ -63,13 +63,10 @@ export const initialUi: UiState = { size: null, } -/** 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 - /** * The tool the drawing acts with: a redraw lends the zone tool to its tracing, which is - * not an armed tool (« Ajouter une zone » must not show pressed for it). + * not an armed tool (« Ajouter une zone » must not show pressed for it); whatever ends + * the tracing gives the select tool back. */ export const armedTool = (state: Pick): ToolId => state.tracing?.target === 'replace' ? 'select' : state.tool @@ -99,7 +96,7 @@ export function uiReducer(state: UiState, action: UiAction): UiState { case 'select': return { ...state, - tool: toolAfterTracing(state), + tool: armedTool(state), selectedId: action.id, tracing: null, hint: null, @@ -136,7 +133,7 @@ export function uiReducer(state: UiState, action: UiAction): UiState { case 'trace_cancel': return { ...state, - tool: toolAfterTracing(state), + tool: armedTool(state), tracing: null, hint: null, } diff --git a/apps/app/src/editor/annotations/usePlacement.ts b/apps/app/src/editor/annotations/usePlacement.ts index 2e8e5281..9bbb1838 100644 --- a/apps/app/src/editor/annotations/usePlacement.ts +++ b/apps/app/src/editor/annotations/usePlacement.ts @@ -101,6 +101,7 @@ function popTrace({ tracing, dispatch }: PlacementInput): void { function placeAtCentreOnEnter(input: PlacementInput, event: KeyboardEvent) { const { ui, frame, doc, viewId } = input if (event.key !== 'Enter' || ui.tool === 'select' || !frame) return + if (event.ctrlKey || event.metaKey || event.altKey || event.shiftKey) return if (useAnnotationWork.getState().creation) return event.preventDefault() const kind = TOOL_TARGET[ui.tool] diff --git a/apps/app/src/i18n/fr.ts b/apps/app/src/i18n/fr.ts index d739419e..2a37b131 100644 --- a/apps/app/src/i18n/fr.ts +++ b/apps/app/src/i18n/fr.ts @@ -1834,7 +1834,7 @@ export const fr: Dict = { 'editor.annotations.add.zone': 'Ajouter une zone', 'editor.annotations.add.detail_trigger': 'Ajouter un accès', 'editor.annotations.armed.point': - "Outil Point actif : touchez ou cliquez le dessin à l'endroit voulu, ou appuyez sur Entrée dans le dessin pour placer le point au centre.", + "Outil Point actif : touchez ou cliquez sur le dessin à l'endroit voulu, ou appuyez sur Entrée dans le dessin pour placer le point au centre.", 'editor.annotations.armed.zone': 'Outil Zone actif : posez les sommets sur le dessin, ou appuyez sur Entrée dans le dessin pour placer une zone au centre.', 'editor.annotations.armed.detail_trigger':