Manage canvas element in Vue (#255)

* Manage canvas element in Vue

* nit

* Fix unittest
This commit is contained in:
Chenlei Hu
2024-07-29 10:29:29 -04:00
committed by GitHub
parent 6e27b884fc
commit 66b690e5c8
5 changed files with 72 additions and 56 deletions

View File

@@ -1853,17 +1853,13 @@ export class ComfyApp {
/**
* Set up the app on the page
*/
async setup() {
async setup(canvasEl: HTMLCanvasElement) {
this.canvasEl = canvasEl
await this.#setUser()
// Create and mount the LiteGraph in the DOM
const mainCanvas = document.createElement('canvas')
mainCanvas.style.touchAction = 'none'
const canvasEl = (this.canvasEl = Object.assign(mainCanvas, {
id: 'graph-canvas'
}))
canvasEl.tabIndex = 1
this.canvasContainer.prepend(canvasEl)
this.resizeCanvas()