diff --git a/js/use_everywhere_classes.js b/js/use_everywhere_classes.js index 2f0053c..654d59f 100644 --- a/js/use_everywhere_classes.js +++ b/js/use_everywhere_classes.js @@ -152,10 +152,15 @@ function validity_errors(params) { } export class Ambiguity { + constructor( data ) { + Object.assign(this, data) + this.matches = [] + } /* name : display_name of node id : node.id input : input.name + graph : the graph the node is in matches : [ { type : m[i].controller.type, @@ -237,13 +242,11 @@ export class UseEverywhereList { if (matches.length>1) { matches.sort((a,b) => b.priority-a.priority); if(matches[0].priority == matches[1].priority) { - const msg = new Ambiguity() - Object.assign(msg, { name:display_name(node), id:node.id, input:input.name, matches:[] }) - + const msg = new Ambiguity( { name:display_name(node), id:node.id, input:input.name, graph:(node.graph || node.subgraph) } ) matches.filter((m)=>(m.priority == matches[0].priority)).forEach((m)=>{ var ni = node.inputs?.findIndex((i)=>(i==input)) - if (ni==undefined) ni = -10 + if (ni==undefined) ni = node.allSlots?.findIndex((i)=>(i==input)) msg.matches.push( { type : m.controller.type, id : m.controller.id, diff --git a/js/use_everywhere_ui.js b/js/use_everywhere_ui.js index 4d9aef7..b7d4365 100644 --- a/js/use_everywhere_ui.js +++ b/js/use_everywhere_ui.js @@ -194,13 +194,26 @@ export class LinkRenderController extends Pausable { highlight_subgraph_node_connections(subgraph, ctx) { if (!settingsCache.getSettingValue('Use Everywhere.Graphics.highlight')) return; - this.ue_list.all_connected_inputs(subgraph.outputNode).forEach((ue_connection)=>{ - const pos2 = subgraph?.outputNode?.slots[ue_connection.input_index]?.pos; + const node = subgraph?.outputNode + const ue_connections = this.ue_list.all_connected_inputs(subgraph.outputNode) + + ue_connections.forEach((ue_connection)=>{ + const pos2 = node.slots[ue_connection.input_index]?.pos; if (pos2) { drawcircle(ctx, pos2, CONNECTED_1, 5, "first", {strokeStyle:LGraphCanvas.link_type_colors[ue_connection.type]}) drawcircle(ctx, pos2, CONNECTED_2, 4, "last") } }) + + shared.graphAnalyser.ambiguities.filter((ambiguity)=>(ambiguity.id==-20)).forEach((ambiguity)=>{ + const index = ambiguity.matches[0]?.node_index + const pos2 = node.slots[index]?.pos + if (pos2) { + drawcross(ctx, pos2, AMBIGUITY, 7) + } + }) + + } highlight_ue_connections(node, ctx) { @@ -336,13 +349,13 @@ export class LinkRenderController extends Pausable { shared.graphAnalyser.ambiguities.forEach((ambiguity)=>{ ambiguity.matches.forEach((m)=>{ - if (app.canvas.node_over == m.node) { + if (app.canvas.node_over == m.node || ambiguity.id==-20 && ambiguity.graph.outputNode?.isPointerOver) { this._render_ue_link( { - graph : m.node.graph, + graph : ambiguity.graph, sending_to : m.node, input_index : m.node_index, - control_node : m.node.graph.getNodeById(m.id), + control_node : ambiguity.graph.getNodeById(m.id), control_node_input_index : m.index, type : m.type, }, ctx, 0, "#F00")