feat(scenes): add scene darkness reveal and fix project reopen crash

Add darkenScene with Opening brush in presentation, persist reveal strokes per scene during a session, and close projects properly on return to home. Harden dnd asset streaming to avoid Windows main-process crashes when reopening projects.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Ivan Fontosh
2026-07-02 19:41:26 +08:00
parent d54e9ed02d
commit 4631a1bece
19 changed files with 526 additions and 11 deletions
+14
View File
@@ -457,6 +457,7 @@ export class ZipProjectStore {
previewThumbAssetId: null,
previewVideoAutostart: false,
previewRotationDeg: 0,
darkenScene: false,
} satisfies Scene);
const next: Scene = {
@@ -472,6 +473,7 @@ export class ZipProjectStore {
? { previewVideoAutostart: patch.previewVideoAutostart }
: null),
...(patch.previewRotationDeg !== undefined ? { previewRotationDeg: patch.previewRotationDeg } : null),
...(patch.darkenScene !== undefined ? { darkenScene: patch.darkenScene } : null),
...(patch.settings ? { settings: { ...base.settings, ...patch.settings } } : null),
...(patch.media ? { media: { ...base.media, ...patch.media } } : null),
...(patch.layout ? { layout: { ...base.layout, ...patch.layout } } : null),
@@ -760,6 +762,16 @@ export class ZipProjectStore {
await this.packZipExclusive(open.cacheDir, open.zipPath);
}
async closeOpenProject(): Promise<void> {
if (!this.openProject) return;
await this.saveNow();
await this.waitWhilePacking();
await this.projectWriteChain;
this.saveQueued = false;
this.openProject = null;
this.projectSession += 1;
}
async renameOpenProject(name: string, fileBaseName: string): Promise<Project> {
const open = this.openProject;
if (!open) throw new Error('No open project');
@@ -1123,6 +1135,7 @@ function normalizeScene(s: Scene): Scene {
);
const previewThumbAssetId =
(s as unknown as { previewThumbAssetId?: AssetId | null }).previewThumbAssetId ?? null;
const darkenScene = Boolean((s as unknown as { darkenScene?: boolean }).darkenScene);
const rawAudios = Array.isArray(raw.audios) ? raw.audios : [];
const audios = rawAudios
@@ -1150,6 +1163,7 @@ function normalizeScene(s: Scene): Scene {
previewThumbAssetId,
previewVideoAutostart,
previewRotationDeg,
darkenScene,
layout: layoutIn ?? { x: 0, y: 0 },
media: {
videos: raw.videos ?? [],