Skip to content

Commit 6b17764

Browse files
authored
Explicitly bind litegraph names to global scope (#331)
1 parent 7804b25 commit 6b17764

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/components/graph/GraphCanvas.vue

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ import { useSettingStore } from '@/stores/settingStore'
2222
import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter'
2323
import { useNodeDefStore } from '@/stores/nodeDefStore'
2424
import { useWorkspaceStore } from '@/stores/workspaceStateStore'
25+
import {
26+
LiteGraph,
27+
LGraph,
28+
LLink,
29+
LGraphNode,
30+
LGraphGroup,
31+
DragAndScale,
32+
LGraphCanvas,
33+
ContextMenu
34+
} from '@comfyorg/litegraph'
2535
2636
const emit = defineEmits(['ready'])
2737
const canvasRef = ref<HTMLCanvasElement | null>(null)
@@ -41,6 +51,17 @@ watch(nodeSearchEnabled, (newVal) => {
4151
let dropTargetCleanup = () => {}
4252
4353
onMounted(async () => {
54+
// Backward compatible
55+
// Assign all properties of lg to window
56+
window['LiteGraph'] = LiteGraph
57+
window['LGraph'] = LGraph
58+
window['LLink'] = LLink
59+
window['LGraphNode'] = LGraphNode
60+
window['LGraphGroup'] = LGraphGroup
61+
window['DragAndScale'] = DragAndScale
62+
window['LGraphCanvas'] = LGraphCanvas
63+
window['ContextMenu'] = ContextMenu
64+
4465
comfyApp.vueAppReady = true
4566
4667
workspaceStore.spinner = true

0 commit comments

Comments
 (0)