Skip to content

Commit

Permalink
Add canvas maximum FPS setting (#1727)
Browse files Browse the repository at this point in the history
* Add canvas maximum FPS setting

* Update litegraph

---------

Co-authored-by: huchenlei <huchenlei@proton.me>
  • Loading branch information
webfiltered and huchenlei authored Nov 28, 2024
1 parent 05fab91 commit 578870d
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 8 deletions.
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"dependencies": {
"@atlaskit/pragmatic-drag-and-drop": "^1.3.1",
"@comfyorg/comfyui-electron-types": "^0.3.19",
"@comfyorg/litegraph": "^0.8.39",
"@comfyorg/litegraph": "^0.8.40",
"@primevue/themes": "^4.0.5",
"@vueuse/core": "^11.0.0",
"@xterm/addon-fit": "^0.10.0",
Expand Down
6 changes: 6 additions & 0 deletions src/components/graph/GraphCanvas.vue
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,12 @@ watchEffect(() => {
}
})
watchEffect(() => {
const maximumFps = settingStore.get('LiteGraph.Canvas.MaximumFps')
const { canvas } = canvasStore
if (canvas) canvas.maximumFps = maximumFps
})
watchEffect(() => {
CanvasPointer.doubleClickTime = settingStore.get(
'Comfy.Pointer.DoubleClickTime'
Expand Down
13 changes: 13 additions & 0 deletions src/constants/coreSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -636,5 +636,18 @@ export const CORE_SETTINGS: SettingParams[] = [
},
defaultValue: 64,
versionAdded: '1.4.12'
},
{
id: 'LiteGraph.Canvas.MaximumFps',
name: 'Maxium FPS',
tooltip:
'The maximum frames per second that the canvas is allowed to render. Caps GPU usage at the cost of smoothness. If 0, the screen refresh rate is used. Default: 0',
type: 'slider',
attrs: {
min: 0,
max: 120
},
defaultValue: 0,
versionAdded: '1.5.1'
}
]
3 changes: 2 additions & 1 deletion src/types/apiTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,8 @@ const zSettings = z.record(z.any()).and(
'Comfy.Node.AutoSnapLinkToSlot': z.boolean(),
'Comfy.Node.SnapHighlightsNode': z.boolean(),
'Comfy.Server.ServerConfigValues': z.record(z.string(), z.any()),
'Comfy.Server.LaunchArgs': z.record(z.string(), z.string())
'Comfy.Server.LaunchArgs': z.record(z.string(), z.string()),
'LiteGraph.Canvas.MaximumFps': z.number()
})
.optional()
)
Expand Down

0 comments on commit 578870d

Please sign in to comment.