From d5275e5e28e3ff1c1ee9f420b5cc0bff566ff08f Mon Sep 17 00:00:00 2001 From: release-bot Date: Thu, 12 Feb 2026 15:42:00 +0100 Subject: [PATCH] wip --- .../lib/graph-interface/graph-state.svelte.ts | 64 ++++++++++++------- .../graph-interface/node/NodeHeader.svelte | 4 ++ .../graph-interface/node/NodeParameter.svelte | 21 +++--- app/src/lib/node-registry/debugNode.ts | 23 +++++++ app/src/lib/runtime/runtime-executor.ts | 17 +++++ .../worker-runtime-executor-backend.ts | 7 +- app/src/routes/+page.svelte | 14 +--- 7 files changed, 101 insertions(+), 49 deletions(-) create mode 100644 app/src/lib/node-registry/debugNode.ts diff --git a/app/src/lib/graph-interface/graph-state.svelte.ts b/app/src/lib/graph-interface/graph-state.svelte.ts index 512fe39..c3d3561 100644 --- a/app/src/lib/graph-interface/graph-state.svelte.ts +++ b/app/src/lib/graph-interface/graph-state.svelte.ts @@ -1,4 +1,4 @@ -import type { NodeInstance, Socket } from '@nodarium/types'; +import type { NodeDefinition, NodeInstance, Socket } from '@nodarium/types'; import { getContext, setContext } from 'svelte'; import { SvelteMap, SvelteSet } from 'svelte/reactivity'; import type { OrthographicCamera, Vector3 } from 'three'; @@ -159,6 +159,24 @@ export class GraphState { return 1; } + getParameterHeight(node: NodeDefinition, inputKey: string) { + const input = node.inputs?.[inputKey]; + if (!input) { + return 100; + } + + if (input.type === 'shape' && input.external !== true) { + return 200; + } + if ( + input?.label !== '' && !input.external && input.type !== 'path' + && input.type !== 'geometry' + ) { + return 100; + } + return 50; + } + getSocketPosition( node: NodeInstance, index: string | number @@ -169,10 +187,21 @@ export class GraphState { (node?.state?.y ?? node.position[1]) + 2.5 + 10 * index ]; } else { - const _index = Object.keys(node.state?.type?.inputs || {}).indexOf(index); + let height = 5; + let nodeType = node.state.type!; + const inputs = nodeType.inputs || {}; + for (const inputKey in inputs) { + const h = this.getParameterHeight(nodeType, inputKey) / 10; + console.log({ inputKey, h }); + if (inputKey === index) { + height += h / 2; + break; + } + height += h; + } return [ node?.state?.x ?? node.position[0], - (node?.state?.y ?? node.position[1]) + 10 + 10 * _index + (node?.state?.y ?? node.position[1]) + height ]; } } @@ -187,25 +216,16 @@ export class GraphState { return 5; } let height = 5; + console.log('Get Node Height', nodeTypeId); - for (const key of Object.keys(node.inputs)) { - if (key === 'seed') continue; - if (!node.inputs) continue; - if (node?.inputs?.[key] === undefined) continue; - if ('setting' in node.inputs[key]) continue; - if (node.inputs[key].hidden) continue; - if ( - node.inputs[key].type === 'shape' - && node.inputs[key].external !== true - && node.inputs[key].internal !== false - ) { - height += 20; - continue; - } - height += 10; + for (const key in node.inputs) { + const h = this.getParameterHeight(node, key); + console.log({ key, h }); + height += h; } this.nodeHeightCache[nodeTypeId] = height; + console.log(this.nodeHeightCache); return height; } @@ -337,12 +357,12 @@ export class GraphState { isNodeInView(node: NodeInstance) { const height = this.getNodeHeight(node.type); const width = 20; - return ( - node.position[0] > this.cameraBounds[0] - width + const inView = node.position[0] > this.cameraBounds[0] - width && node.position[0] < this.cameraBounds[1] && node.position[1] > this.cameraBounds[2] - height - && node.position[1] < this.cameraBounds[3] - ); + && node.position[1] < this.cameraBounds[3]; + console.log({ inView, height }); + return inView; } openNodePalette() { diff --git a/app/src/lib/graph-interface/node/NodeHeader.svelte b/app/src/lib/graph-interface/node/NodeHeader.svelte index a3bdb11..e1752fd 100644 --- a/app/src/lib/graph-interface/node/NodeHeader.svelte +++ b/app/src/lib/graph-interface/node/NodeHeader.svelte @@ -1,4 +1,5 @@