Let a Sequence grow an output as you connect the last one
The Outputs setting is gone. A Sequence now keeps one free output below the last connected one: nothing plugged in is one output, connecting the spare grows a new one, unplugging the bottom edge shrinks it back. It counts the last *connected* port rather than the number of edges, so unplugging a middle one leaves a gap instead of silently dropping an edge. Removing the setting also removes a bug it caused. Typing in the Outputs field did nothing and the arrow keys did nothing, while dragging the value worked: onInput fires per keystroke, the preview writes into node.params, that emits 'project', and Inspector.refreshValues() sees the node's signature change -- the port list is part of it -- so it rebuilds and destroys the row being typed in. A drag survives because it keeps receiving globalpointermove on the old widget. refreshValues() has no focus guard where refreshLive() does; the trap is still there for the next typed field that changes a node's shape. Ports that depend on the edges around a node mean derivePorts needs the graph, not just the params, so resolveDef and portSignature take it too. And a node whose ports are derived cannot know how many it has from its type, so run is handed the definition resolved for it.
This commit is contained in:
1 parent
b6a609ae24
commit
3c76106fd2
15 files changed
+159
-111
No files matched your search
@@ -12,7 +12,7 @@ export interface PortSide {
|
||||
|
||||
export function portTypeOf(graph: Graph, side: PortSide, lookup: BehaviorLookup): PortType | undefined {
|
||||
const node = findNode(graph, side.nodeId);
|
||||
const def = node && resolveDef(node, lookup);
|
||||
const def = node && resolveDef(node, graph, lookup);
|
||||
const list = side.isOutput ? def?.outputs : def?.inputs;
|
||||
return list?.find((p) => p.key === side.port)?.type;
|
||||
}
|
||||
@@ -40,7 +40,7 @@ export function dropTargetPort(
|
||||
): PortSide | null {
|
||||
if (nodeId === from.nodeId) return null;
|
||||
const node = findNode(graph, nodeId);
|
||||
const def = node && resolveDef(node, lookup);
|
||||
const def = node && resolveDef(node, graph, lookup);
|
||||
const fromType = portTypeOf(graph, from, lookup);
|
||||
if (!def || fromType === undefined) return null;
|
||||
const candidates = compatiblePorts(def, fromType, from.isOutput)
|
||||
|
||||
Reference in new issue
Block a user