Fix node bypass color (#971)

* Fix node bypass color

* Update test expectations [skip ci]

---------

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Chenlei Hu
2024-09-25 15:54:05 +09:00
committed by GitHub
parent 84fc0e9205
commit cf6367b649
6 changed files with 20 additions and 8 deletions

View File

@@ -251,6 +251,18 @@ test.describe('Node Interaction', () => {
await comfyPage.nextFrame()
await expect(comfyPage.canvas).toHaveScreenshot('nodes-unpinned.png')
})
test('Can bypass/unbypass nodes with keyboard shortcut', async ({
comfyPage
}) => {
await comfyPage.select2Nodes()
await comfyPage.canvas.press('Control+b')
await comfyPage.nextFrame()
await expect(comfyPage.canvas).toHaveScreenshot('nodes-bypassed.png')
await comfyPage.canvas.press('Control+b')
await comfyPage.nextFrame()
await expect(comfyPage.canvas).toHaveScreenshot('nodes-unbypassed.png')
})
})
test.describe('Group Interaction', () => {

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

View File

@@ -1551,9 +1551,9 @@ export class ComfyApp {
const origDrawNode = LGraphCanvas.prototype.drawNode
LGraphCanvas.prototype.drawNode = function (node, ctx) {
var editor_alpha = this.editor_alpha
var old_color = node.color
var old_bgcolor = node.bgcolor
const editor_alpha = this.editor_alpha
const old_color = node.color
const old_bgcolor = node.bgcolor
if (node.mode === 2) {
// never
@@ -1561,11 +1561,14 @@ export class ComfyApp {
}
// ComfyUI's custom node mode enum value 4 => bypass/never.
let bgColor: string
// @ts-expect-error
if (node.mode === 4) {
// never
node.bgcolor = '#FF00FF'
bgColor = '#FF00FF'
this.editor_alpha = 0.2
} else {
bgColor = old_bgcolor || LiteGraph.NODE_DEFAULT_BGCOLOR
}
const adjustments: ColorAdjustOptions = {}
@@ -1582,10 +1585,7 @@ export class ComfyApp {
}
}
node.bgcolor = adjustColor(
old_bgcolor || LiteGraph.NODE_DEFAULT_BGCOLOR,
adjustments
)
node.bgcolor = adjustColor(bgColor, adjustments)
const res = origDrawNode.apply(this, arguments)