Add setting to show/hide canvas info (#533)

* Add setting to show/hide canvas info

* nit
This commit is contained in:
Chenlei Hu
2024-08-19 12:12:37 -04:00
committed by GitHub
parent ce75a29202
commit f5ce42d5d5
2 changed files with 18 additions and 0 deletions

View File

@@ -52,6 +52,16 @@ watch(
},
{ immediate: true }
)
const canvasInfoEnabled = computed<boolean>(() =>
settingStore.get('Comfy.Graph.CanvasInfo')
)
watch(
canvasInfoEnabled,
(newVal) => {
if (comfyApp.canvas) comfyApp.canvas.show_info = newVal
},
{ immediate: true }
)
let dropTargetCleanup = () => {}
@@ -72,6 +82,7 @@ onMounted(async () => {
workspaceStore.spinner = true
await comfyApp.setup(canvasRef.value)
comfyApp.canvas.allow_searchbox = !nodeSearchEnabled.value
comfyApp.canvas.show_info = canvasInfoEnabled.value
workspaceStore.spinner = false
window['app'] = comfyApp

View File

@@ -131,6 +131,13 @@ export const useSettingStore = defineStore('setting', {
type: 'boolean',
defaultValue: false
})
app.ui.settings.addSetting({
id: 'Comfy.Graph.CanvasInfo',
name: 'Show canvas info (fps, etc.)',
type: 'boolean',
defaultValue: true
})
},
set<K extends keyof Settings>(key: K, value: Settings[K]) {