diff --git a/browser_tests/tests/nodeSearchBox.spec.ts-snapshots/added-node-no-connection-chromium-linux.png b/browser_tests/tests/nodeSearchBox.spec.ts-snapshots/added-node-no-connection-chromium-linux.png
index 6fe53b0ed..1816c719a 100644
Binary files a/browser_tests/tests/nodeSearchBox.spec.ts-snapshots/added-node-no-connection-chromium-linux.png and b/browser_tests/tests/nodeSearchBox.spec.ts-snapshots/added-node-no-connection-chromium-linux.png differ
diff --git a/browser_tests/tests/nodeSearchBox.spec.ts-snapshots/link-release-context-menu-chromium-linux.png b/browser_tests/tests/nodeSearchBox.spec.ts-snapshots/link-release-context-menu-chromium-linux.png
index 1cdaa2820..a25b022d2 100644
Binary files a/browser_tests/tests/nodeSearchBox.spec.ts-snapshots/link-release-context-menu-chromium-linux.png and b/browser_tests/tests/nodeSearchBox.spec.ts-snapshots/link-release-context-menu-chromium-linux.png differ
diff --git a/src/components/searchbox/NodeSearchBoxPopover.vue b/src/components/searchbox/NodeSearchBoxPopover.vue
index bbcc8fb92..46c2c053b 100644
--- a/src/components/searchbox/NodeSearchBoxPopover.vue
+++ b/src/components/searchbox/NodeSearchBoxPopover.vue
@@ -33,43 +33,41 @@
diff --git a/src/stores/graphStore.ts b/src/stores/graphStore.ts
index 76baf860d..85d04f365 100644
--- a/src/stores/graphStore.ts
+++ b/src/stores/graphStore.ts
@@ -27,9 +27,15 @@ export const useCanvasStore = defineStore('canvas', () => {
selectedItems.value = items.map((item) => markRaw(item))
}
+ const getCanvas = () => {
+ if (!canvas.value) throw new Error('getCanvas: canvas is null')
+ return canvas.value
+ }
+
return {
canvas,
selectedItems,
- updateSelectedItems
+ updateSelectedItems,
+ getCanvas
}
})
diff --git a/src/types/litegraphTypes.ts b/src/types/litegraphTypes.ts
deleted file mode 100644
index 4aac13618..000000000
--- a/src/types/litegraphTypes.ts
+++ /dev/null
@@ -1,75 +0,0 @@
-import type {
- ConnectingLink,
- INodeInputSlot,
- INodeOutputSlot,
- INodeSlot,
- ISlotType,
- LGraphNode,
- Vector2
-} from '@comfyorg/litegraph'
-import { LiteGraph } from '@comfyorg/litegraph'
-import { RerouteId } from '@comfyorg/litegraph/dist/Reroute'
-
-export class ConnectingLinkImpl implements ConnectingLink {
- constructor(
- public node: LGraphNode,
- public slot: number,
- public input: INodeInputSlot | null | undefined | any,
- public output: INodeOutputSlot | null | undefined | any,
- public pos: Vector2,
- public afterRerouteId?: RerouteId
- ) {}
-
- static createFromPlainObject(obj: ConnectingLink) {
- return new ConnectingLinkImpl(
- obj.node,
- obj.slot,
- obj.input,
- obj.output,
- obj.pos,
- obj.afterRerouteId
- )
- }
-
- get type(): ISlotType | null {
- const result = this.input ? this.input.type : this.output?.type ?? null
- return result === -1 ? null : result
- }
-
- /**
- * Which slot type is release and need to be reconnected.
- * - 'output' means we need a new node's outputs slot to connect with this link
- */
- get releaseSlotType(): 'input' | 'output' {
- return this.output ? 'input' : 'output'
- }
-
- connectTo(newNode: LGraphNode) {
- const newNodeSlots =
- this.releaseSlotType === 'output' ? newNode.outputs : newNode.inputs
- if (!newNodeSlots) return
-
- const newNodeSlot = newNodeSlots.findIndex(
- (slot: INodeSlot) =>
- this.type && LiteGraph.isValidConnection(slot.type, this.type)
- )
-
- if (newNodeSlot === -1) {
- console.warn(
- `Could not find slot with type ${this.type} on node ${newNode.title}. This should never happen`
- )
- return
- }
-
- if (this.releaseSlotType === 'input') {
- this.node.connect(this.slot, newNode, newNodeSlot, this.afterRerouteId)
- } else {
- newNode.connect(newNodeSlot, this.node, this.slot, this.afterRerouteId)
- }
- }
-}
-
-export type CanvasDragAndDropData = {
- type: 'add-node'
- data: T
-}