Fix incorrect links highlighted (#670)

Fixes rare issue where incorrect links could be highlighted (and
seemingly remain highlighted).

Requires corrupt links & null coercion.
This commit is contained in:
filtered
2025-03-02 19:49:13 +11:00
committed by GitHub
parent 78175e2c1b
commit 1aba15bbca

View File

@@ -3753,11 +3753,13 @@ export class LGraphCanvas implements ConnectionColorContext {
// Highlight links
if (item.inputs) {
for (const input of item.inputs) {
if (input.link == null) continue
this.highlighted_links[input.link] = true
}
}
if (item.outputs) {
for (const id of item.outputs.flatMap(x => x.links)) {
if (id == null) continue
this.highlighted_links[id] = true
}
}
@@ -3783,11 +3785,13 @@ export class LGraphCanvas implements ConnectionColorContext {
// Clear link highlight
if (item.inputs) {
for (const input of item.inputs) {
if (input.link == null) continue
delete this.highlighted_links[input.link]
}
}
if (item.outputs) {
for (const id of item.outputs.flatMap(x => x.links)) {
if (id == null) continue
delete this.highlighted_links[id]
}
}
@@ -3882,11 +3886,13 @@ export class LGraphCanvas implements ConnectionColorContext {
// Highlight links
if (keepSelected.inputs) {
for (const input of keepSelected.inputs) {
if (input.link == null) continue
this.highlighted_links[input.link] = true
}
}
if (keepSelected.outputs) {
for (const id of keepSelected.outputs.flatMap(x => x.links)) {
if (id == null) continue
this.highlighted_links[id] = true
}
}