Update Litegraph API - canvas.state (#1372)

* Update Litegraph API - canvas.state

* Update litegraph

---------

Co-authored-by: filtered <176114999+webfiltered@users.noreply.github.com>
This commit is contained in:
Chenlei Hu
2024-10-29 22:07:04 -04:00
committed by GitHub
parent 4b1104f52c
commit 324eff93fd
4 changed files with 11 additions and 20 deletions

View File

@@ -1847,19 +1847,10 @@ export class ComfyApp {
this.#addAfterConfigureHandler()
// Make LGraphCanvas shallow reactive so that any change on the root object
// triggers reactivity.
this.canvas = shallowReactive(
new LGraphCanvas(canvasEl, this.graph, {
skip_events: true,
skip_render: true
})
)
// Bind event/ start rendering later, so that event handlers get reactive canvas reference.
this.canvas.options.skip_events = false
this.canvas.options.skip_render = false
this.canvas.bindEvents()
this.canvas.startRendering()
// Make LGraphCanvas.state shallow reactive so that any change on the root
// object triggers reactivity.
this.canvas = new LGraphCanvas(canvasEl, this.graph)
this.canvas.state = shallowReactive(this.canvas.state)
this.ctx = canvasEl.getContext('2d')