mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-30 03:01:54 +00:00
fix bad fallback and remove logging
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
import { type Fn, useEventListener } from '@vueuse/core'
|
import { type Fn, useEventListener } from '@vueuse/core'
|
||||||
import log from 'loglevel'
|
|
||||||
import { onBeforeUnmount } from 'vue'
|
import { onBeforeUnmount } from 'vue'
|
||||||
|
|
||||||
import { useSharedCanvasPositionConversion } from '@/composables/element/useCanvasPositionConversion'
|
import { useSharedCanvasPositionConversion } from '@/composables/element/useCanvasPositionConversion'
|
||||||
@@ -25,8 +24,6 @@ import type { Point } from '@/renderer/core/layout/types'
|
|||||||
import { toPoint } from '@/renderer/core/layout/utils/geometry'
|
import { toPoint } from '@/renderer/core/layout/utils/geometry'
|
||||||
import { app } from '@/scripts/app'
|
import { app } from '@/scripts/app'
|
||||||
|
|
||||||
const logger = log.getLogger('useSlotLinkInteraction')
|
|
||||||
|
|
||||||
interface SlotInteractionOptions {
|
interface SlotInteractionOptions {
|
||||||
nodeId: string
|
nodeId: string
|
||||||
index: number
|
index: number
|
||||||
@@ -199,35 +196,15 @@ export function useSlotLinkInteraction({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const resolveLinkOrigin = (
|
const resolveLinkOrigin = (
|
||||||
graph: LGraph,
|
|
||||||
link: LLink | undefined
|
link: LLink | undefined
|
||||||
): { position: Point; direction: LinkDirection } | null => {
|
): { position: Point; direction: LinkDirection } | null => {
|
||||||
if (!link) return null
|
if (!link) return null
|
||||||
|
|
||||||
const originNodeId = link.origin_id
|
const slotKey = getSlotKey(String(link.origin_id), link.origin_slot, false)
|
||||||
const originSlotIndex = link.origin_slot
|
|
||||||
|
|
||||||
const slotKey = getSlotKey(String(originNodeId), originSlotIndex, false)
|
|
||||||
const layout = layoutStore.getSlotLayout(slotKey)
|
const layout = layoutStore.getSlotLayout(slotKey)
|
||||||
|
if (!layout) return null
|
||||||
|
|
||||||
if (layout) {
|
return { position: { ...layout.position }, direction: LinkDirection.NONE }
|
||||||
return { position: { ...layout.position }, direction: LinkDirection.NONE }
|
|
||||||
} else {
|
|
||||||
const originNode = graph.getNodeById(originNodeId)
|
|
||||||
|
|
||||||
logger.warn('Slot layout missing', {
|
|
||||||
slotKey,
|
|
||||||
originNodeId,
|
|
||||||
originSlotIndex,
|
|
||||||
linkId: link.id,
|
|
||||||
fallback: originNode ? 'graph' : 'none'
|
|
||||||
})
|
|
||||||
|
|
||||||
if (!originNode) return null
|
|
||||||
|
|
||||||
const [x, y] = originNode.getOutputPos(originSlotIndex)
|
|
||||||
return { position: toPoint(x, y), direction: LinkDirection.NONE }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const resolveExistingInputLinkAnchor = (
|
const resolveExistingInputLinkAnchor = (
|
||||||
@@ -258,7 +235,7 @@ export function useSlotLinkInteraction({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const directAnchor = resolveLinkOrigin(graph, directLink)
|
const directAnchor = resolveLinkOrigin(directLink)
|
||||||
if (directAnchor) return directAnchor
|
if (directAnchor) return directAnchor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user