From 6b1776450b0a851efd78594a98cb3cbdbc679b5e Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Tue, 6 Aug 2024 21:40:05 -0400 Subject: [PATCH] Explicitly bind litegraph names to global scope (#331) --- src/components/graph/GraphCanvas.vue | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/components/graph/GraphCanvas.vue b/src/components/graph/GraphCanvas.vue index 45024b6f6..e5ea76cd5 100644 --- a/src/components/graph/GraphCanvas.vue +++ b/src/components/graph/GraphCanvas.vue @@ -22,6 +22,16 @@ import { useSettingStore } from '@/stores/settingStore' import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter' import { useNodeDefStore } from '@/stores/nodeDefStore' import { useWorkspaceStore } from '@/stores/workspaceStateStore' +import { + LiteGraph, + LGraph, + LLink, + LGraphNode, + LGraphGroup, + DragAndScale, + LGraphCanvas, + ContextMenu +} from '@comfyorg/litegraph' const emit = defineEmits(['ready']) const canvasRef = ref(null) @@ -41,6 +51,17 @@ watch(nodeSearchEnabled, (newVal) => { let dropTargetCleanup = () => {} onMounted(async () => { + // Backward compatible + // Assign all properties of lg to window + window['LiteGraph'] = LiteGraph + window['LGraph'] = LGraph + window['LLink'] = LLink + window['LGraphNode'] = LGraphNode + window['LGraphGroup'] = LGraphGroup + window['DragAndScale'] = DragAndScale + window['LGraphCanvas'] = LGraphCanvas + window['ContextMenu'] = ContextMenu + comfyApp.vueAppReady = true workspaceStore.spinner = true