feat: add commands for clearing candidates and reusing candidate settings, update UI controls

This commit is contained in:
syntaxbullet
2026-07-11 11:23:25 +02:00
parent 556fd685a2
commit 1236b6dd2f
5 changed files with 85 additions and 3 deletions

View File

@@ -24,6 +24,10 @@ export type GenerationRemoveCandidatePayload = {
candidateId: GenerationCandidateId;
};
export type GenerationReuseCandidateSettingsPayload = {
candidateId: GenerationCandidateId;
};
export type GenerationApplyCandidateAsLayerPayload = {
candidateId: GenerationCandidateId;
assetId: AssetId;
@@ -140,6 +144,30 @@ export const generationClearCandidatesCommand: Command = {
},
};
export const generationReuseCandidateSettingsCommand: Command<GenerationReuseCandidateSettingsPayload> = {
id: commandIds.generationReuseCandidateSettings,
name: "Reuse generation candidate settings",
execute({ state }, payload) {
const candidate = state.editor.generation.candidates.find((item) => item.id === payload.candidateId);
if (!candidate) return state;
return {
...state,
editor: {
...state.editor,
tools: {
...state.editor.tools,
generate: {
...candidate.settings,
seed: candidate.seed,
outpaint: { ...candidate.settings.outpaint },
inpaint: { ...candidate.settings.inpaint },
},
},
},
};
},
};
export const generationApplyCandidateAsLayerCommand: Command<GenerationApplyCandidateAsLayerPayload> = {
id: commandIds.generationApplyCandidateAsLayer,
name: "Apply generation candidate as layer",
@@ -284,6 +312,7 @@ export const generationCommands = [
generationSetCompareModeCommand,
generationRemoveCandidateCommand,
generationClearCandidatesCommand,
generationReuseCandidateSettingsCommand,
generationApplyCandidateAsLayerCommand,
generationReplaceCandidatePixelsCommand,
generationStartJobCommand,