Double click group title to edit (#714)

* Double click group title to edit

* Add playwright test

* Update test expectations [skip ci]

---------

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Chenlei Hu
2024-09-02 18:01:02 -04:00
committed by GitHub
parent 80e4384644
commit 4ad1e67ebf
12 changed files with 228 additions and 13 deletions

View File

@@ -1,3 +1,4 @@
import { LGraphGroup } from '@comfyorg/litegraph'
import { app } from '../../scripts/app'
import { LGraphCanvas, LiteGraph } from '@comfyorg/litegraph'
@@ -77,8 +78,7 @@ app.registerExtension({
content: 'Add Group For Selected Nodes',
disabled: !Object.keys(app.canvas.selected_nodes || {}).length,
callback: () => {
// @ts-expect-error
var group = new LiteGraph.LGraphGroup()
const group = new LGraphGroup()
addNodesToGroup(group, this.selected_nodes)
app.canvas.graph.add(group)
this.graph.change()

View File

@@ -156,13 +156,11 @@ app.registerExtension({
if (this.selected_group_resizing) {
roundVectorToGrid(this.selected_group.size)
} else if (selectedAndMovingGroup) {
// @ts-expect-error
const [x, y] = roundVectorToGrid([...selectedAndMovingGroup.pos])
const f = ctx.fillStyle
const s = ctx.strokeStyle
ctx.fillStyle = 'rgba(100, 100, 100, 0.33)'
ctx.strokeStyle = 'rgba(100, 100, 100, 0.66)'
// @ts-expect-error
ctx.rect(x, y, ...selectedAndMovingGroup.size)
ctx.fill()
ctx.stroke()
@@ -183,9 +181,7 @@ app.registerExtension({
// @ts-expect-error
const lastGroup = app.graph._groups[app.graph._groups.length - 1]
if (lastGroup) {
// @ts-expect-error
roundVectorToGrid(lastGroup.pos)
// @ts-expect-error
roundVectorToGrid(lastGroup.size)
}
}