feat(editor): repair out-of-frame annotations when attaching a drawing
This commit is contained in:
1 parent
4ab85adeb0
commit
3776a33b79
22 files changed
+1277
-19
No files matched your search
@@ -23,10 +23,11 @@ export interface CommitContext {
|
||||
locale: Locale
|
||||
}
|
||||
|
||||
function describe(
|
||||
/** The words for a geometry commit that was not kept. */
|
||||
export function describeOutcome(
|
||||
outcome: Exclude<CommitOutcome<GeometryRefusal>, { ok: true }>,
|
||||
{ t, locale }: CommitContext,
|
||||
): CommitResult {
|
||||
): Extract<CommitResult, { ok: false }> {
|
||||
if (outcome.reason !== 'refused') {
|
||||
const duplicate =
|
||||
outcome.reason === 'core' && outcome.failure.kind === 'duplicate_key'
|
||||
@@ -67,7 +68,7 @@ function commitGeometry(
|
||||
}
|
||||
const accept = geometryAccept({ before, changedIds: [annotationId] })
|
||||
const outcome = store.commit(command, { accept })
|
||||
return outcome.ok ? { ok: true } : describe(outcome, context)
|
||||
return outcome.ok ? { ok: true } : describeOutcome(outcome, context)
|
||||
}
|
||||
|
||||
/** Inserts a new annotation under a fresh id; one regeneration on `duplicate_key`. */
|
||||
|
||||
Reference in new issue
Block a user