Node library side bar tab (#237)

* Basic tree

* Add node filter

* Fix key issue

* Add icons

* Node count

* nit

* Add node preview basics

* Node preview

* Make comfy node in node lib draggable

* Set drop target

* Add node on drop

* Drop on dynamic location

* nit

* nit

* Fix hover preview issue

* nit

* More visual diff between node and folder

* Add playwright test

* Add dep

* Get rid of screenshot test
This commit is contained in:
Chenlei Hu
2024-07-27 21:28:48 -04:00
committed by GitHub
parent 980ed0083d
commit c0875d066a
11 changed files with 376 additions and 6 deletions

View File

@@ -42,6 +42,7 @@ import {
useNodeDefStore
} from '@/stores/nodeDefStore'
import { Vector2 } from '@comfyorg/litegraph'
import _ from 'lodash'
export const ANIM_PREVIEW_WIDGET = '$$comfy_animation_preview'
@@ -2951,6 +2952,14 @@ export class ComfyApp {
this.graph.add(node)
return node
}
clientPosToCanvasPos(pos: Vector2): Vector2 {
const rect = this.canvasContainer.getBoundingClientRect()
const containerOffsets = [rect.left, rect.top]
return _.zip(pos, this.canvas.ds.offset, containerOffsets).map(
([p, o1, o2]) => p / this.canvas.ds.scale - o1 - o2
) as Vector2
}
}
export const app = new ComfyApp()