Skip to content

Commit 4b83ee3

Browse files
huchenleigithub-actions
andauthored
link release pops up searchbox by default (#348) (#350)
* link release pops up searchbox by default (#348) * link release pops up searchbox by default * Update browser test * Fix tests * Update test expectations [skip ci] --------- Co-authored-by: github-actions <[email protected]>
1 parent 078df41 commit 4b83ee3

File tree

7 files changed

+13
-21
lines changed

7 files changed

+13
-21
lines changed

browser_tests/interaction.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ test.describe('Node Interaction', () => {
2727

2828
test('Can disconnect/connect edge', async ({ comfyPage }) => {
2929
await comfyPage.disconnectEdge()
30+
// Close search menu poped up.
31+
await comfyPage.page.keyboard.press('Escape')
32+
await comfyPage.nextFrame()
3033
await expect(comfyPage.canvas).toHaveScreenshot(
3134
'disconnected-edge-with-menu.png'
3235
)
-8.38 KB
Loading

browser_tests/nodeSearchBox.spec.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,10 @@ test.describe('Node search box', () => {
88
})
99

1010
test('Can trigger on link release', async ({ comfyPage }) => {
11-
await comfyPage.page.keyboard.down('Shift')
1211
await comfyPage.disconnectEdge()
1312
await expect(comfyPage.searchBox.input).toHaveCount(1)
1413
})
1514

16-
test('Does not trigger on link release (no shift)', async ({ comfyPage }) => {
17-
await comfyPage.disconnectEdge()
18-
await expect(comfyPage.searchBox.input).toHaveCount(0)
19-
})
20-
2115
test('Can add node', async ({ comfyPage }) => {
2216
await comfyPage.doubleClickCanvas()
2317
await expect(comfyPage.searchBox.input).toHaveCount(1)
@@ -26,9 +20,7 @@ test.describe('Node search box', () => {
2620
})
2721

2822
test('Can auto link node', async ({ comfyPage }) => {
29-
await comfyPage.page.keyboard.down('Shift')
3023
await comfyPage.disconnectEdge()
31-
await comfyPage.page.keyboard.up('Shift')
3224
await comfyPage.searchBox.fillAndSelectFirstNode('CLIPTextEncode')
3325
await expect(comfyPage.canvas).toHaveScreenshot('auto-linked-node.png')
3426
})
@@ -44,7 +36,6 @@ test.describe('Node search box', () => {
4436
x: 5,
4537
y: 5
4638
}
47-
4839
await comfyPage.page.keyboard.down('Shift')
4940
await comfyPage.dragAndDrop(outputSlot1Pos, emptySpacePos)
5041
await comfyPage.page.keyboard.up('Shift')

playwright.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export default defineConfig({
3636
{
3737
name: 'chromium',
3838
use: { ...devices['Desktop Chrome'] },
39-
timeout: 5000
39+
timeout: 15000
4040
}
4141

4242
// {

src/components/graph/GraphCanvas.vue

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,14 @@ const betaMenuEnabled = computed(
4444
const nodeSearchEnabled = computed<boolean>(
4545
() => settingStore.get('Comfy.NodeSearchBoxImpl') === 'default'
4646
)
47-
watch(nodeSearchEnabled, (newVal) => {
48-
if (comfyApp.canvas) comfyApp.canvas.allow_searchbox = !newVal
49-
})
47+
watch(
48+
nodeSearchEnabled,
49+
(newVal) => {
50+
LiteGraph.release_link_on_empty_shows_menu = !newVal
51+
if (comfyApp.canvas) comfyApp.canvas.allow_searchbox = !newVal
52+
},
53+
{ immediate: true }
54+
)
5055
5156
let dropTargetCleanup = () => {}
5257

src/components/searchbox/NodeSearchBoxPopover.vue

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import { LiteGraphCanvasEvent, ConnectingLink } from '@comfyorg/litegraph'
2929
import { FilterAndValue } from '@/services/nodeSearchService'
3030
import { ComfyNodeDefImpl, useNodeDefStore } from '@/stores/nodeDefStore'
3131
import { ConnectingLinkImpl } from '@/types/litegraphTypes'
32+
import { LiteGraph } from '@comfyorg/litegraph'
3233
3334
interface LiteGraphPointerEvent extends Event {
3435
canvasX: number
@@ -83,13 +84,6 @@ const addNode = (nodeDef: ComfyNodeDefImpl) => {
8384
}
8485
8586
const canvasEventHandler = (e: LiteGraphCanvasEvent) => {
86-
const shiftPressed = (e.detail.originalEvent as KeyboardEvent).shiftKey
87-
// Ignore empty releases unless shift is pressed
88-
// Empty release without shift is trigger right click menu
89-
if (e.detail.subType === 'empty-release' && !shiftPressed) {
90-
return
91-
}
92-
9387
if (e.detail.subType === 'empty-release') {
9488
const context = e.detail.linkReleaseContext
9589
if (context.links.length === 0) {

src/scripts/app.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1875,7 +1875,6 @@ export class ComfyApp {
18751875
this.canvas = new LGraphCanvas(canvasEl, this.graph)
18761876
this.ctx = canvasEl.getContext('2d')
18771877

1878-
LiteGraph.release_link_on_empty_shows_menu = true
18791878
LiteGraph.alt_drag_do_clone_nodes = true
18801879

18811880
this.graph.start()

0 commit comments

Comments
 (0)