fix(editor): bubble frame fallback, modified Enter, one tool rule, fr wording
This commit is contained in:
1 parent
cab976e5c9
commit
17c35638e8
4 files changed
+11
-10
No files matched your search
@@ -144,10 +144,13 @@ function aroundVertex(scene: BubbleScene, chosen: number): Around {
|
|||||||
return { insertMids, vertices }
|
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 {
|
function effectiveBounds(scene: BubbleScene, vertex: Point): Frame | null {
|
||||||
const { bounds, frame } = scene
|
const { bounds, frame } = scene
|
||||||
if (bounds === null) return null
|
if (bounds === null) return frame
|
||||||
const slack = EDGE_PX * scene.unit
|
const slack = EDGE_PX * scene.unit
|
||||||
const onScreen =
|
const onScreen =
|
||||||
vertex[0] >= bounds.x - slack &&
|
vertex[0] >= bounds.x - slack &&
|
||||||
|
|||||||
@@ -63,13 +63,10 @@ export const initialUi: UiState = {
|
|||||||
size: null,
|
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
|
* 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<UiState, 'tool' | 'tracing'>): ToolId =>
|
export const armedTool = (state: Pick<UiState, 'tool' | 'tracing'>): ToolId =>
|
||||||
state.tracing?.target === 'replace' ? 'select' : state.tool
|
state.tracing?.target === 'replace' ? 'select' : state.tool
|
||||||
@@ -99,7 +96,7 @@ export function uiReducer(state: UiState, action: UiAction): UiState {
|
|||||||
case 'select':
|
case 'select':
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
tool: toolAfterTracing(state),
|
tool: armedTool(state),
|
||||||
selectedId: action.id,
|
selectedId: action.id,
|
||||||
tracing: null,
|
tracing: null,
|
||||||
hint: null,
|
hint: null,
|
||||||
@@ -136,7 +133,7 @@ export function uiReducer(state: UiState, action: UiAction): UiState {
|
|||||||
case 'trace_cancel':
|
case 'trace_cancel':
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
tool: toolAfterTracing(state),
|
tool: armedTool(state),
|
||||||
tracing: null,
|
tracing: null,
|
||||||
hint: null,
|
hint: null,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ function popTrace({ tracing, dispatch }: PlacementInput): void {
|
|||||||
function placeAtCentreOnEnter(input: PlacementInput, event: KeyboardEvent) {
|
function placeAtCentreOnEnter(input: PlacementInput, event: KeyboardEvent) {
|
||||||
const { ui, frame, doc, viewId } = input
|
const { ui, frame, doc, viewId } = input
|
||||||
if (event.key !== 'Enter' || ui.tool === 'select' || !frame) return
|
if (event.key !== 'Enter' || ui.tool === 'select' || !frame) return
|
||||||
|
if (event.ctrlKey || event.metaKey || event.altKey || event.shiftKey) return
|
||||||
if (useAnnotationWork.getState().creation) return
|
if (useAnnotationWork.getState().creation) return
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
const kind = TOOL_TARGET[ui.tool]
|
const kind = TOOL_TARGET[ui.tool]
|
||||||
|
|||||||
@@ -1834,7 +1834,7 @@ export const fr: Dict = {
|
|||||||
'editor.annotations.add.zone': 'Ajouter une zone',
|
'editor.annotations.add.zone': 'Ajouter une zone',
|
||||||
'editor.annotations.add.detail_trigger': 'Ajouter un accès',
|
'editor.annotations.add.detail_trigger': 'Ajouter un accès',
|
||||||
'editor.annotations.armed.point':
|
'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':
|
'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.',
|
'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':
|
'editor.annotations.armed.detail_trigger':
|
||||||
|
|||||||
Reference in new issue
Block a user