Trigger searchbox on group body db click (#731)

This commit is contained in:
Chenlei Hu
2024-09-04 10:16:12 -04:00
committed by GitHub
parent ada8500d21
commit b396d1a9fe
3 changed files with 46 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
{
"last_node_id": 9,
"last_link_id": 13,
"nodes": [],
"links": [],
"groups": [
{
"title": "Group",
"bounding": [
0,
0,
335,
346
],
"color": "#3f789e",
"font_size": 24
}
],
"config": {},
"extra": {
"ds": {
"scale": 1.2100000000000006,
"offset": [
104.34159172650945,
241.35965953210126
]
}
},
"version": 0.4
}

View File

@@ -13,6 +13,13 @@ test.describe('Node search box', () => {
await expect(comfyPage.searchBox.input).toHaveCount(1)
})
test(`Can trigger on group body double click`, async ({ comfyPage }) => {
await comfyPage.loadWorkflow('single_group_only')
await comfyPage.page.mouse.dblclick(50, 50)
await comfyPage.nextFrame()
await expect(comfyPage.searchBox.input).toHaveCount(1)
})
test('Can trigger on link release', async ({ comfyPage }) => {
await comfyPage.disconnectEdge()
await expect(comfyPage.searchBox.input).toHaveCount(1)

View File

@@ -164,6 +164,15 @@ const canvasEventHandler = (e: LiteGraphCanvasEvent) => {
showSearchBox(e)
} else if (e.detail.subType === 'empty-release') {
handleCanvasEmptyRelease(e)
} else if (e.detail.subType === 'group-double-click') {
const group = e.detail.group
const [x, y] = group.pos
// @ts-expect-error LiteGraphCanvasEvent is not typed
const relativeY = e.detail.originalEvent.canvasY - y
// Show search box if the click is NOT on the title bar
if (relativeY > group.titleHeight) {
showSearchBox(e)
}
}
}