feat(project): optimize image imports and converter

- Optimize imported scene preview images (smart WebP/JPEG/PNG, preserve alpha, keep pixel size)

- Update converter to re-encode existing image assets with same algorithm

- Improve import/export progress overlay and reduce presentation slide stutter

Made-with: Cursor
This commit is contained in:
Ivan Fontosh
2026-04-23 17:59:57 +08:00
parent 1d051f8bf9
commit 8f8eef53c9
33 changed files with 3684 additions and 68 deletions
+20 -1
View File
@@ -45,6 +45,8 @@ export const ipcChannels = {
importZip: 'project.importZip',
exportZip: 'project.exportZip',
deleteProject: 'project.deleteProject',
importZipProgress: 'project.importZipProgress',
exportZipProgress: 'project.exportZipProgress',
},
windows: {
openMultiWindow: 'windows.openMultiWindow',
@@ -73,6 +75,22 @@ export const ipcChannels = {
},
} as const;
export type ZipProgressEvent = {
kind: 'import' | 'export';
stage: 'copy' | 'unzip' | 'zip' | 'done';
percent: number; // 0..100
detail?: string;
};
export type IpcEventMap = {
[ipcChannels.session.stateChanged]: { state: SessionState };
[ipcChannels.effects.stateChanged]: { state: EffectsState };
[ipcChannels.video.stateChanged]: { state: VideoPlaybackState };
[ipcChannels.license.statusChanged]: { snapshot: LicenseSnapshot };
[ipcChannels.project.importZipProgress]: ZipProgressEvent;
[ipcChannels.project.exportZipProgress]: ZipProgressEvent;
};
export type IpcInvokeMap = {
[ipcChannels.app.quit]: {
req: Record<string, never>;
@@ -237,7 +255,7 @@ export type SessionState = {
currentSceneId: SceneId | null;
};
export type IpcEventMap = {
export type LegacyIpcEventMap = {
[ipcChannels.session.stateChanged]: { state: SessionState };
[ipcChannels.effects.stateChanged]: { state: EffectsState };
[ipcChannels.video.stateChanged]: { state: VideoPlaybackState };
@@ -249,6 +267,7 @@ export type ScenePatch = {
description?: string;
previewAssetId?: AssetId | null;
previewAssetType?: 'image' | 'video' | null;
previewThumbAssetId?: AssetId | null;
previewVideoAutostart?: boolean;
previewRotationDeg?: 0 | 90 | 180 | 270;
settings?: Partial<Scene['settings']>;