[Refactor] Move addNodeOnGraph to litegraphService (#2100)

This commit is contained in:
Chenlei Hu
2024-12-30 16:09:44 -05:00
committed by GitHub
parent be7e2c6505
commit 3bf0dfd218
7 changed files with 48 additions and 40 deletions

View File

@@ -37,8 +37,8 @@ import type { TreeNode } from 'primevue/treenode'
import { computed, nextTick, ref, watch } from 'vue'
import { useI18n } from 'vue-i18n'
import { useTreeExpansion } from '@/hooks/treeHooks'
import { app } from '@/scripts/app'
import { findNodeByKey } from '@/utils/treeUtil'
import { useLitegraphService } from '@/services/litegraphService'
const props = defineProps<{
filteredNodeDefs: ComfyNodeDefImpl[]
@@ -169,7 +169,7 @@ const renderedBookmarkedRoot = computed<TreeExplorerNode<ComfyNodeDefImpl>>(
e: MouseEvent
) => {
if (node.leaf) {
app.addNodeOnGraph(node.data, { pos: app.getCanvasCenter() })
useLitegraphService().addNodeOnGraph(node.data)
} else {
toggleNodeOnEvent(e, node)
}