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

8
package-lock.json generated
View File

@@ -9,7 +9,7 @@
"version": "1.2.30", "version": "1.2.30",
"dependencies": { "dependencies": {
"@atlaskit/pragmatic-drag-and-drop": "^1.2.1", "@atlaskit/pragmatic-drag-and-drop": "^1.2.1",
"@comfyorg/litegraph": "^0.7.47", "@comfyorg/litegraph": "^0.7.48",
"@primevue/themes": "^4.0.0-rc.2", "@primevue/themes": "^4.0.0-rc.2",
"@vitejs/plugin-vue": "^5.0.5", "@vitejs/plugin-vue": "^5.0.5",
"@vueuse/core": "^11.0.0", "@vueuse/core": "^11.0.0",
@@ -1880,9 +1880,9 @@
"dev": true "dev": true
}, },
"node_modules/@comfyorg/litegraph": { "node_modules/@comfyorg/litegraph": {
"version": "0.7.47", "version": "0.7.48",
"resolved": "https://registry.npmjs.org/@comfyorg/litegraph/-/litegraph-0.7.47.tgz", "resolved": "https://registry.npmjs.org/@comfyorg/litegraph/-/litegraph-0.7.48.tgz",
"integrity": "sha512-MCN2cF6XK2tMFLad0OQhDT1kGSO99ixGLpDszh6TVbZLGawq/2kjL6bnynOv/tGoBzVTFVZZnI7JkmlDijm9MA==", "integrity": "sha512-BmR91huOjoMvVvdQ8Pw+L/Iez+ZIxHXA/ApfLwUTOVFa+SvwlFY76qD6C0Hw64jOx9fous1jIQUp35X0xF0RGw==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/@cspotcode/source-map-support": { "node_modules/@cspotcode/source-map-support": {

View File

@@ -56,7 +56,7 @@
}, },
"dependencies": { "dependencies": {
"@atlaskit/pragmatic-drag-and-drop": "^1.2.1", "@atlaskit/pragmatic-drag-and-drop": "^1.2.1",
"@comfyorg/litegraph": "^0.7.47", "@comfyorg/litegraph": "^0.7.48",
"@primevue/themes": "^4.0.0-rc.2", "@primevue/themes": "^4.0.0-rc.2",
"@vitejs/plugin-vue": "^5.0.5", "@vitejs/plugin-vue": "^5.0.5",
"@vueuse/core": "^11.0.0", "@vueuse/core": "^11.0.0",

View File

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

View File

@@ -172,6 +172,18 @@ export const useSettingStore = defineStore('setting', {
type: 'boolean', type: 'boolean',
defaultValue: true 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]) { 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.EnableTooltips': z.boolean(),
'Comfy.EnableWorkflowViewRestore': z.boolean(), 'Comfy.EnableWorkflowViewRestore': z.boolean(),
'Comfy.FloatRoundingPrecision': z.number(), 'Comfy.FloatRoundingPrecision': z.number(),
'Comfy.Graph.ZoomSpeed': z.number(),
'Comfy.InvertMenuScrolling': z.boolean(), 'Comfy.InvertMenuScrolling': z.boolean(),
'Comfy.Logging.Enabled': z.boolean(), 'Comfy.Logging.Enabled': z.boolean(),
'Comfy.NodeInputConversionSubmenus': z.boolean(), 'Comfy.NodeInputConversionSubmenus': z.boolean(),