diff --git a/browser_tests/tests/vueNodes/linkInteraction.spec.ts-snapshots/vue-node-reroute-output-shift-drag-chromium-linux.png b/browser_tests/tests/vueNodes/linkInteraction.spec.ts-snapshots/vue-node-reroute-output-shift-drag-chromium-linux.png index 36fc0282f0..de003b4ed3 100644 Binary files a/browser_tests/tests/vueNodes/linkInteraction.spec.ts-snapshots/vue-node-reroute-output-shift-drag-chromium-linux.png and b/browser_tests/tests/vueNodes/linkInteraction.spec.ts-snapshots/vue-node-reroute-output-shift-drag-chromium-linux.png differ diff --git a/browser_tests/tests/vueNodes/linkInteraction.spec.ts-snapshots/vue-node-shift-output-multi-link-chromium-linux.png b/browser_tests/tests/vueNodes/linkInteraction.spec.ts-snapshots/vue-node-shift-output-multi-link-chromium-linux.png index 70f2a8d3f2..05a22b8d21 100644 Binary files a/browser_tests/tests/vueNodes/linkInteraction.spec.ts-snapshots/vue-node-shift-output-multi-link-chromium-linux.png and b/browser_tests/tests/vueNodes/linkInteraction.spec.ts-snapshots/vue-node-shift-output-multi-link-chromium-linux.png differ diff --git a/src/renderer/core/canvas/links/slotLinkPreviewRenderer.ts b/src/renderer/core/canvas/links/slotLinkPreviewRenderer.ts index c4d344352f..c8e5137797 100644 --- a/src/renderer/core/canvas/links/slotLinkPreviewRenderer.ts +++ b/src/renderer/core/canvas/links/slotLinkPreviewRenderer.ts @@ -36,6 +36,8 @@ export function attachSlotLinkPreviewRenderer(canvas: LGraphCanvas) { originalOnDrawForeground?.(ctx, area) const { state } = useSlotLinkDragState() + // If LiteGraph's own connector is active, let it handle rendering to avoid double-draw + if (canvas.linkConnector?.isConnecting) return if (!state.active || !state.source) return const { pointer } = state @@ -48,11 +50,9 @@ export function attachSlotLinkPreviewRenderer(canvas: LGraphCanvas) { const renderLinks = adapter?.renderLinks if (!adapter || !renderLinks || renderLinks.length === 0) return - const uniqueLinks = dedupeRenderLinks(renderLinks) - const to: ReadOnlyPoint = [pointer.canvas.x, pointer.canvas.y] ctx.save() - for (const link of uniqueLinks) { + for (const link of renderLinks) { const startDir = link.fromDirection ?? LinkDirection.RIGHT const endDir = link.dragDirection ?? LinkDirection.CENTER const colour = resolveConnectingLinkColor(link.fromSlot.type) @@ -75,42 +75,6 @@ export function attachSlotLinkPreviewRenderer(canvas: LGraphCanvas) { canvas.onDrawForeground = patched } -function dedupeRenderLinks(links: ReadonlyArray): RenderLink[] { - const uniqueByKey = new Map() - const fallback: RenderLink[] = [] - - for (const link of links) { - const key = getRenderLinkKey(link) - if (!key) { - fallback.push(link) - continue - } - - const existing = uniqueByKey.get(key) - if (!existing) { - uniqueByKey.set(key, link) - continue - } - - // Prefer links that originate from reroutes to keep anchors stable - if (!existing.fromReroute && link.fromReroute) { - uniqueByKey.set(key, link) - } else if (existing.fromReroute === link.fromReroute) { - // Prefer the one with an explicit drag direction when both share the same origin - if ( - (!existing.dragDirection || - existing.dragDirection === LinkDirection.CENTER) && - link.dragDirection && - link.dragDirection !== LinkDirection.CENTER - ) { - uniqueByKey.set(key, link) - } - } - } - - return [...uniqueByKey.values(), ...fallback] -} - function resolveRenderLinkOrigin(link: RenderLink): ReadOnlyPoint { if (link.fromReroute) { const rerouteLayout = layoutStore.getRerouteLayout(link.fromReroute.id) @@ -143,26 +107,3 @@ function getRenderLinkNodeId(link: RenderLink): number | null { } return null } - -function getRenderLinkKey(link: RenderLink): string | null { - const linkId = getUnderlyingLinkId(link) - if (linkId != null) return `link:${linkId}` - - const rerouteId = link.fromReroute?.id - if (typeof rerouteId === 'number') { - return `reroute:${rerouteId}` - } - - const nodeId = getRenderLinkNodeId(link) - if (nodeId != null) { - return `node:${nodeId}:slot:${link.fromSlotIndex}:to:${link.toType}` - } - - return null -} - -function getUnderlyingLinkId(link: RenderLink): number | null { - const maybeLink = (link as { link?: { id?: unknown } }).link - const maybeId = maybeLink?.id - return typeof maybeId === 'number' ? maybeId : null -}