修复画布快速编辑还原生成器

直接点击生成图时还原原生成器对话框

非生成图直接点击只选中不打开生成器

快速编辑按钮和右键入口按素材元数据打开对应生成器

补齐资源元数据回填和入口边界测试

(cherry picked from commit 45e4b6e64a)
This commit is contained in:
2026-06-29 16:06:51 +08:00
parent 08f188e26e
commit b3501f6fed
6 changed files with 336 additions and 613 deletions
@@ -649,9 +649,55 @@ function resolveGeneratedSourceDialogMode({
if (sourceLayer.assetKind === 'character-animation') {
return 'character-animation';
}
if (sourceLayer.sourceType === 'generated') {
return 'generate';
}
return null;
}
function buildLayerGenerationPlaceholder(sourceLayer: CanvasLayer) {
return {
x: sourceLayer.x,
y: sourceLayer.y,
width: sourceLayer.width,
height: sourceLayer.height,
originalWidth: sourceLayer.originalWidth,
originalHeight: sourceLayer.originalHeight,
};
}
export function createLayerGenerationDialogDraft({
sourceLayer,
canvasSize,
viewport,
sourceDialog,
sourceAnimationLayer,
}: Omit<SourceGenerationDialogDraftContext, 'mode'>): Omit<
CanvasGenerationDialogState,
'id'
> | null {
const draft = createSameSourceGenerationDialogDraft({
sourceLayer,
canvasSize,
viewport,
sourceDialog,
sourceAnimationLayer,
mode: 'redraw',
});
if (!draft) {
return null;
}
return {
...draft,
prompt: draft.prompt || sourceLayer.prompt?.trim() || '',
imageModel: sourceDialog?.imageModel ?? sourceLayer.model ?? draft.imageModel,
status: 'idle',
composerOpen: true,
generatedLayerId: sourceLayer.id,
placeholder: buildLayerGenerationPlaceholder(sourceLayer),
};
}
function getSourceDraftPrompt({
sourceLayer,
mode,