Skip to content

Commit 49400c6

Browse files
christian-byrnegithub-actions
andauthored
Set output as background (#3079)
Co-authored-by: github-actions <[email protected]>
1 parent 32605ee commit 49400c6

File tree

19 files changed

+95
-2
lines changed

19 files changed

+95
-2
lines changed

src/components/graph/GraphCanvas.vue

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,20 @@ watch(
168168
await colorPaletteService.loadColorPalette(currentPaletteId)
169169
}
170170
)
171+
172+
watch(
173+
() => settingStore.get('Comfy.Canvas.BackgroundImage'),
174+
async () => {
175+
if (!canvasStore.canvas) return
176+
const currentPaletteId = colorPaletteStore.activePaletteId
177+
if (!currentPaletteId) return
178+
179+
// Reload color palette to apply background image
180+
await colorPaletteService.loadColorPalette(currentPaletteId)
181+
// Mark background canvas as dirty
182+
canvasStore.canvas.setDirty(false, true)
183+
}
184+
)
171185
watch(
172186
() => colorPaletteStore.activePaletteId,
173187
async (newValue) => {

src/components/sidebar/tabs/QueueSidebarTab.vue

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,16 @@ const menuItems = computed<MenuItem[]>(() => [
219219
useLitegraphService().goToNode(menuTargetNode.value.id)
220220
},
221221
visible: !!menuTargetNode.value
222+
},
223+
{
224+
label: t('g.setAsBackground'),
225+
icon: 'pi pi-image',
226+
command: () => {
227+
const url = menuTargetTask.value?.previewOutput?.url
228+
if (url) {
229+
void settingStore.set('Comfy.Canvas.BackgroundImage', url)
230+
}
231+
}
222232
}
223233
])
224234

src/constants/coreSettings.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -826,6 +826,20 @@ export const CORE_SETTINGS: SettingParams[] = [
826826
defaultValue: false,
827827
versionAdded: '1.18.0'
828828
},
829+
{
830+
id: 'Comfy.Canvas.BackgroundImage',
831+
category: ['Appearance', 'Canvas', 'Background'],
832+
name: 'Canvas background image',
833+
type: 'text',
834+
tooltip:
835+
'Image URL for the canvas background. You can right-click an image in the outputs panel and select "Set as Background" to use it.',
836+
defaultValue: '',
837+
versionAdded: '1.20.4',
838+
attrs: {
839+
inputmode: 'url',
840+
placeholder: 'https://example.com/image.png'
841+
}
842+
},
829843
{
830844
id: 'LiteGraph.Pointer.TrackpadGestures',
831845
category: ['LiteGraph', 'Pointer', 'Trackpad Gestures'],

src/locales/en/main.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@
5757
"deprecated": "DEPR",
5858
"loadWorkflow": "Load Workflow",
5959
"goToNode": "Go to Node",
60+
"setAsBackground": "Set as Background",
61+
"customBackground": "Custom Background",
6062
"settings": "Settings",
6163
"searchWorkflows": "Search Workflows",
6264
"searchSettings": "Search Settings",

src/locales/en/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
"custom": "custom"
2626
}
2727
},
28+
"Comfy_Canvas_BackgroundImage": {
29+
"name": "Canvas background image",
30+
"tooltip": "Image URL for the canvas background. You can right-click an image in the outputs panel and select \"Set as Background\" to use it."
31+
},
2832
"Comfy_Canvas_SelectionToolbox": {
2933
"name": "Show selection toolbox"
3034
},

src/locales/es/main.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@
267267
"copy": "Copiar",
268268
"copyToClipboard": "Copiar al portapapeles",
269269
"currentUser": "Usuario actual",
270+
"customBackground": "Fondo personalizado",
270271
"customize": "Personalizar",
271272
"customizeFolder": "Personalizar carpeta",
272273
"delete": "Eliminar",
@@ -342,6 +343,7 @@
342343
"searchNodes": "Buscar nodos",
343344
"searchSettings": "Buscar configuraciones",
344345
"searchWorkflows": "Buscar flujos de trabajo",
346+
"setAsBackground": "Establecer como fondo",
345347
"settings": "Configuraciones",
346348
"showReport": "Mostrar informe",
347349
"sort": "Ordenar",

src/locales/es/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
},
2626
"tooltip": "Personalizado: Reemplace la barra de título del sistema con el menú superior de ComfyUI"
2727
},
28+
"Comfy_Canvas_BackgroundImage": {
29+
"name": "Imagen de fondo del lienzo",
30+
"tooltip": "URL de la imagen para el fondo del lienzo. Puedes hacer clic derecho en una imagen del panel de resultados y seleccionar \"Establecer como fondo\" para usarla."
31+
},
2832
"Comfy_Canvas_SelectionToolbox": {
2933
"name": "Mostrar caja de herramientas de selección"
3034
},

src/locales/fr/main.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@
267267
"copy": "Copier",
268268
"copyToClipboard": "Copier dans le presse-papiers",
269269
"currentUser": "Utilisateur actuel",
270+
"customBackground": "Arrière-plan personnalisé",
270271
"customize": "Personnaliser",
271272
"customizeFolder": "Personnaliser le dossier",
272273
"delete": "Supprimer",
@@ -342,6 +343,7 @@
342343
"searchNodes": "Rechercher des nœuds",
343344
"searchSettings": "Rechercher des paramètres",
344345
"searchWorkflows": "Rechercher des flux de travail",
346+
"setAsBackground": "Définir comme arrière-plan",
345347
"settings": "Paramètres",
346348
"showReport": "Afficher le rapport",
347349
"sort": "Trier",

src/locales/fr/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
},
2626
"tooltip": "Choisissez l'option personnalisée pour masquer la barre de titre du système"
2727
},
28+
"Comfy_Canvas_BackgroundImage": {
29+
"name": "Image de fond du canevas",
30+
"tooltip": "URL de l'image pour le fond du canevas. Vous pouvez faire un clic droit sur une image dans le panneau de sortie et sélectionner « Définir comme fond » pour l'utiliser."
31+
},
2832
"Comfy_Canvas_SelectionToolbox": {
2933
"name": "Afficher la boîte à outils de sélection"
3034
},

src/locales/ja/main.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@
267267
"copy": "コピー",
268268
"copyToClipboard": "クリップボードにコピー",
269269
"currentUser": "現在のユーザー",
270+
"customBackground": "カスタム背景",
270271
"customize": "カスタマイズ",
271272
"customizeFolder": "フォルダーをカスタマイズ",
272273
"delete": "削除",
@@ -342,6 +343,7 @@
342343
"searchNodes": "ノードを検索",
343344
"searchSettings": "設定を検索",
344345
"searchWorkflows": "ワークフローを検索",
346+
"setAsBackground": "背景として設定",
345347
"settings": "設定",
346348
"showReport": "レポートを表示",
347349
"sort": "並び替え",

0 commit comments

Comments
 (0)