Fix corruption of selected link highlights (#897)

Occurred when deselecting one side of a link when both sides were
selected.
This commit is contained in:
filtered
2025-04-07 00:30:22 +10:00
committed by GitHub
parent 7360e09172
commit 6cafeeff19
4 changed files with 37 additions and 3 deletions

View File

@@ -3365,16 +3365,28 @@ export class LGraphCanvas implements ConnectionColorContext {
this.onNodeDeselected?.(item)
// Should be moved to top of function, and throw if null
const { graph } = this
if (!graph) return
// Clear link highlight
if (item.inputs) {
for (const input of item.inputs) {
if (input.link == null) continue
const node = LLink.getOriginNode(graph, input.link)
if (node && this.selectedItems.has(node)) continue
delete this.highlighted_links[input.link]
}
}
if (item.outputs) {
for (const id of item.outputs.flatMap(x => x.links)) {
if (id == null) continue
const node = LLink.getTargetNode(graph, id)
if (node && this.selectedItems.has(node)) continue
delete this.highlighted_links[id]
}
}