恢复画布视频生成入口
恢复画布底部工具栏的视频生成和 UI 设计入口 恢复视频生成弹窗的参数、模型和提交状态处理 补齐规范参考、快捷键和生成流程相关测试
This commit is contained in:
@@ -18,6 +18,7 @@ import {
|
||||
DEFAULT_IMAGE_MODEL,
|
||||
DEFAULT_SPEC_FORM_VALUES,
|
||||
EDITOR_IMAGE_DIMENSION_OPTIONS,
|
||||
EDITOR_VIDEO_MODEL_OPTIONS,
|
||||
ICON_DESCRIPTION_LIMIT,
|
||||
ICON_FRAME_DISPLAY_SIZE,
|
||||
ICON_FRAME_ORIGINAL_SIZE,
|
||||
@@ -25,6 +26,8 @@ import {
|
||||
SPEC_FRAME_ORIGINAL_SIZE,
|
||||
UI_DESIGN_FRAME_DISPLAY_SIZE,
|
||||
UI_DESIGN_FRAME_ORIGINAL_SIZE,
|
||||
VIDEO_FRAME_DISPLAY_SIZE,
|
||||
VIDEO_FRAME_ORIGINAL_SIZE,
|
||||
} from './ImageCanvasGenerationModel';
|
||||
|
||||
type CanvasSize = { width: number; height: number };
|
||||
@@ -182,6 +185,37 @@ export function createIconGenerationDialogDraft({
|
||||
};
|
||||
}
|
||||
|
||||
export function createVideoGenerationDialogDraft({
|
||||
canvasSize,
|
||||
viewport,
|
||||
}: {
|
||||
canvasSize: CanvasSize;
|
||||
viewport: CanvasViewport;
|
||||
}): Omit<CanvasGenerationDialogState, 'id'> {
|
||||
const worldCenter = getViewportWorldCenter({ canvasSize, viewport });
|
||||
return {
|
||||
mode: 'video',
|
||||
prompt: '',
|
||||
status: 'idle',
|
||||
composerOpen: true,
|
||||
generationReferences: [],
|
||||
videoModel: EDITOR_VIDEO_MODEL_OPTIONS[0].value,
|
||||
videoAspectRatio: '16:9',
|
||||
videoResolution: '480p',
|
||||
videoDurationSeconds: 4,
|
||||
videoMode: 'std',
|
||||
videoSound: 'off',
|
||||
placeholder: {
|
||||
x: worldCenter.x - VIDEO_FRAME_DISPLAY_SIZE.width / 2,
|
||||
y: worldCenter.y - VIDEO_FRAME_DISPLAY_SIZE.height / 2,
|
||||
width: VIDEO_FRAME_DISPLAY_SIZE.width,
|
||||
height: VIDEO_FRAME_DISPLAY_SIZE.height,
|
||||
originalWidth: VIDEO_FRAME_ORIGINAL_SIZE.width,
|
||||
originalHeight: VIDEO_FRAME_ORIGINAL_SIZE.height,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function createUiDesignGenerationDialogDraft({
|
||||
canvasSize,
|
||||
viewport,
|
||||
@@ -200,7 +234,7 @@ export function createUiDesignGenerationDialogDraft({
|
||||
composerOpen: true,
|
||||
uiDesignSpecReference: null,
|
||||
imageModel,
|
||||
aspectRatio: dimensionDefaults.aspectRatio,
|
||||
aspectRatio: '16:9',
|
||||
imageSize: dimensionDefaults.imageSize,
|
||||
placeholder: {
|
||||
x: worldCenter.x - UI_DESIGN_FRAME_DISPLAY_SIZE.width / 2,
|
||||
@@ -292,9 +326,14 @@ export function appendGenerationReference(
|
||||
dialog: GenerateDialogState | null,
|
||||
layer: CanvasLayer,
|
||||
): GenerateDialogState | null {
|
||||
return dialog?.mode === 'generate' ||
|
||||
dialog?.mode === 'video' ||
|
||||
dialog?.mode === 'spec'
|
||||
if (dialog?.mode === 'spec') {
|
||||
return {
|
||||
...resetFailedGenerationDialog(dialog),
|
||||
specReference: createCanvasLayerReference(layer),
|
||||
composerOpen: true,
|
||||
};
|
||||
}
|
||||
return dialog?.mode === 'generate' || dialog?.mode === 'video'
|
||||
? {
|
||||
...resetFailedGenerationDialog(dialog),
|
||||
generationReferences: [
|
||||
@@ -326,6 +365,9 @@ export function assignUiDesignSpecReference(
|
||||
dialog: GenerateDialogState | null,
|
||||
layer: CanvasLayer,
|
||||
): GenerateDialogState | null {
|
||||
if (layer.assetKind !== 'icon-spec') {
|
||||
return dialog;
|
||||
}
|
||||
return dialog?.mode === 'ui-design'
|
||||
? {
|
||||
...resetFailedGenerationDialog(dialog),
|
||||
|
||||
Reference in New Issue
Block a user