Skip to content

Commit 17c7f57

Browse files
authored
Update litegraph (Zoom speed adjustment) (#580)
1 parent 5542845 commit 17c7f57

File tree

5 files changed

+28
-5
lines changed

5 files changed

+28
-5
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
},
5757
"dependencies": {
5858
"@atlaskit/pragmatic-drag-and-drop": "^1.2.1",
59-
"@comfyorg/litegraph": "^0.7.47",
59+
"@comfyorg/litegraph": "^0.7.48",
6060
"@primevue/themes": "^4.0.0-rc.2",
6161
"@vitejs/plugin-vue": "^5.0.5",
6262
"@vueuse/core": "^11.0.0",

src/components/graph/GraphCanvas.vue

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,15 @@ watch(
6464
{ immediate: true }
6565
)
6666
67+
const zoomSpeed = computed(() => settingStore.get('Comfy.Graph.ZoomSpeed'))
68+
watch(
69+
zoomSpeed,
70+
(newVal: number) => {
71+
if (comfyApp.canvas) comfyApp.canvas['zoom_speed'] = newVal
72+
},
73+
{ immediate: true }
74+
)
75+
6776
watchEffect(() => {
6877
nodeDefStore.showDeprecated = settingStore.get('Comfy.Node.ShowDeprecated')
6978
})
@@ -94,6 +103,7 @@ onMounted(async () => {
94103
await comfyApp.setup(canvasRef.value)
95104
comfyApp.canvas.allow_searchbox = !nodeSearchEnabled.value
96105
comfyApp.canvas.show_info = canvasInfoEnabled.value
106+
comfyApp.canvas['zoom_speed'] = zoomSpeed.value
97107
workspaceStore.spinner = false
98108
99109
window['app'] = comfyApp

src/stores/settingStore.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,18 @@ export const useSettingStore = defineStore('setting', {
172172
type: 'boolean',
173173
defaultValue: true
174174
})
175+
176+
app.ui.settings.addSetting({
177+
id: 'Comfy.Graph.ZoomSpeed',
178+
name: 'Canvas zoom speed',
179+
type: 'slider',
180+
defaultValue: 1.1,
181+
attrs: {
182+
min: 1.01,
183+
max: 2.5,
184+
step: 0.01
185+
}
186+
})
175187
},
176188

177189
set<K extends keyof Settings>(key: K, value: Settings[K]) {

src/types/apiTypes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@ const zSettings = z.record(z.any()).and(
410410
'Comfy.EnableTooltips': z.boolean(),
411411
'Comfy.EnableWorkflowViewRestore': z.boolean(),
412412
'Comfy.FloatRoundingPrecision': z.number(),
413+
'Comfy.Graph.ZoomSpeed': z.number(),
413414
'Comfy.InvertMenuScrolling': z.boolean(),
414415
'Comfy.Logging.Enabled': z.boolean(),
415416
'Comfy.NodeInputConversionSubmenus': z.boolean(),

0 commit comments

Comments
 (0)