Update litegraph (Zoom speed adjustment) (#580)

This commit is contained in:
Chenlei Hu
2024-08-21 17:16:06 -04:00
committed by GitHub
parent 5542845710
commit 17c7f57d8f
5 changed files with 28 additions and 5 deletions

View File

@@ -64,6 +64,15 @@ watch(
{ immediate: true }
)
const zoomSpeed = computed(() => settingStore.get('Comfy.Graph.ZoomSpeed'))
watch(
zoomSpeed,
(newVal: number) => {
if (comfyApp.canvas) comfyApp.canvas['zoom_speed'] = newVal
},
{ immediate: true }
)
watchEffect(() => {
nodeDefStore.showDeprecated = settingStore.get('Comfy.Node.ShowDeprecated')
})
@@ -94,6 +103,7 @@ onMounted(async () => {
await comfyApp.setup(canvasRef.value)
comfyApp.canvas.allow_searchbox = !nodeSearchEnabled.value
comfyApp.canvas.show_info = canvasInfoEnabled.value
comfyApp.canvas['zoom_speed'] = zoomSpeed.value
workspaceStore.spinner = false
window['app'] = comfyApp

View File

@@ -172,6 +172,18 @@ export const useSettingStore = defineStore('setting', {
type: 'boolean',
defaultValue: true
})
app.ui.settings.addSetting({
id: 'Comfy.Graph.ZoomSpeed',
name: 'Canvas zoom speed',
type: 'slider',
defaultValue: 1.1,
attrs: {
min: 1.01,
max: 2.5,
step: 0.01
}
})
},
set<K extends keyof Settings>(key: K, value: Settings[K]) {

View File

@@ -410,6 +410,7 @@ const zSettings = z.record(z.any()).and(
'Comfy.EnableTooltips': z.boolean(),
'Comfy.EnableWorkflowViewRestore': z.boolean(),
'Comfy.FloatRoundingPrecision': z.number(),
'Comfy.Graph.ZoomSpeed': z.number(),
'Comfy.InvertMenuScrolling': z.boolean(),
'Comfy.Logging.Enabled': z.boolean(),
'Comfy.NodeInputConversionSubmenus': z.boolean(),