Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix(migrate): lift a v2 zoom's click impact into the cursor setting

EtienneLescot388804abf773
diff --git a/src/lib/ai-edition/document/migrate.test.ts b/src/lib/ai-edition/document/migrate.test.ts
index d0f7f8092..4d97909c5 100644
--- a/src/lib/ai-edition/document/migrate.test.ts
+++ b/src/lib/ai-edition/document/migrate.test.ts
@@ -132,6 +132,27 @@ describe("migrateProjectDataToAxcutDocument", () => {
expect(z.hideCursor).toBe(true);
});
+ // Up to v1.13.0 the click impact was a zoom option; it is the cursor setting now.
+ it("turns a zoom's click impact into the cursor setting", () => {
+ const zoom = {
+ id: "z_1",
+ startMs: 0,
+ endMs: 2000,
+ depth: 3 as const,
+ focus: { cx: 0.5, cy: 0.5 },
+ };
+ const doc = migrateProjectDataToAxcutDocument(
+ makeV2Project({
+ editor: {
+ ...makeV2Project().editor,
+ zoomRegions: [{ ...zoom, clickImpact: true } as never],
+ },
+ }),
+ );
+ expect(getEditorSettings(doc).cursor.clickImpact).toBe(true);
+ expect("clickImpact" in doc.zoomRanges[0]).toBe(false);
+ });
+
it("converts annotationRegions to seconds with type and content preserved", () => {
const doc = migrateProjectDataToAxcutDocument(
makeV2Project({
diff --git a/src/lib/ai-edition/document/migrate.ts b/src/lib/ai-edition/document/migrate.ts
index cb7516660..d0f7f2ea6 100644
--- a/src/lib/ai-edition/document/migrate.ts
+++ b/src/lib/ai-edition/document/migrate.ts
@@ -221,6 +221,9 @@ export function migrateProjectDataToAxcutDocument(
...(typeof region.customScale === "number" ? { customScale: region.customScale } : {}),
...(region.source === "auto" || region.source === "manual" ? { source: region.source } : {}),
...(region.hideCursor ? { hideCursor: true } : {}),
+ // Up to v1.13.0 a zoom stored its click impact; it is a cursor setting now. Carried on
+ // the draft so `migrateRawDocumentToCurrent` lifts it there, as for a stored document.
+ ...("clickImpact" in region && region.clickImpact === true ? { clickImpact: true } : {}),
}));
const migratedAnnotations: AxcutAnnotationRegion[] = annotationRegions