diff --git a/browser_tests/assets/single_group_only.json b/browser_tests/assets/single_group_only.json new file mode 100644 index 000000000..1ee58f4d0 --- /dev/null +++ b/browser_tests/assets/single_group_only.json @@ -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 +} \ No newline at end of file diff --git a/browser_tests/nodeSearchBox.spec.ts b/browser_tests/nodeSearchBox.spec.ts index 8f622efda..ebe93c5ae 100644 --- a/browser_tests/nodeSearchBox.spec.ts +++ b/browser_tests/nodeSearchBox.spec.ts @@ -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) diff --git a/src/components/searchbox/NodeSearchBoxPopover.vue b/src/components/searchbox/NodeSearchBoxPopover.vue index bed7019a6..ce84a2088 100644 --- a/src/components/searchbox/NodeSearchBoxPopover.vue +++ b/src/components/searchbox/NodeSearchBoxPopover.vue @@ -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) + } } }