diff --git a/src/components/image-editor/useImageCanvasGenerationWorkflow.ts b/src/components/image-editor/useImageCanvasGenerationWorkflow.ts index e0e7fb364..dbd68a7f4 100644 --- a/src/components/image-editor/useImageCanvasGenerationWorkflow.ts +++ b/src/components/image-editor/useImageCanvasGenerationWorkflow.ts @@ -316,34 +316,25 @@ function findSourceAnimationLayer( ); } +const CANVAS_TOOL_BY_GENERATION_MODE = { + generate: 'generate', + spec: 'spec', + character: 'character', + icon: 'icon', + publication: 'publication', + 'ui-design': 'ui-design', + 'quick-edit': 'generate', + 'character-animation': 'character', + video: 'video', + 'audio-sound-effect': 'music', + 'audio-background-music': 'music', + scene: 'scene', +} as const satisfies Record; + function getCanvasToolForGenerationMode( mode: CanvasGenerationDialogState['mode'], ): CanvasTool { - if (mode === 'video') { - return 'video'; - } - if (mode === 'scene') { - return 'scene'; - } - if (mode === 'audio-sound-effect' || mode === 'audio-background-music') { - return 'music'; - } - if (mode === 'character' || mode === 'character-animation') { - return 'character'; - } - if (mode === 'icon') { - return 'icon'; - } - if (mode === 'publication') { - return 'publication'; - } - if (mode === 'ui-design') { - return 'ui-design'; - } - if (mode === 'spec') { - return 'spec'; - } - return 'generate'; + return CANVAS_TOOL_BY_GENERATION_MODE[mode] ?? 'generate'; } const LAST_CHARACTER_SPEC_REFERENCE_CACHE_KEY =