Fix part of snapped link follows pointer (#945)

Removes the green circle that always follows the pointer, even when a
link is snapped elsewhere.
This commit is contained in:
filtered
2025-04-20 18:52:01 +10:00
committed by GitHub
parent c607c53543
commit a76c50252b

View File

@@ -3851,11 +3851,9 @@ export class LGraphCanvas implements ConnectionColorContext {
ctx.beginPath()
if (connType === LiteGraph.EVENT || connShape === RenderShape.BOX) {
ctx.rect(pos[0] - 6 + 0.5, pos[1] - 5 + 0.5, 14, 10)
ctx.fill()
ctx.beginPath()
ctx.rect(
this.graph_mouse[0] - 6 + 0.5,
this.graph_mouse[1] - 5 + 0.5,
highlightPos[0] - 6 + 0.5,
highlightPos[1] - 5 + 0.5,
14,
10,
)
@@ -3866,9 +3864,7 @@ export class LGraphCanvas implements ConnectionColorContext {
ctx.closePath()
} else {
ctx.arc(pos[0], pos[1], 4, 0, Math.PI * 2)
ctx.fill()
ctx.beginPath()
ctx.arc(this.graph_mouse[0], this.graph_mouse[1], 4, 0, Math.PI * 2)
ctx.arc(highlightPos[0], highlightPos[1], 4, 0, Math.PI * 2)
}
ctx.fill()
}
@@ -3962,10 +3958,10 @@ export class LGraphCanvas implements ConnectionColorContext {
}
ctx.fill()
if (!LiteGraph.snap_highlights_node) return
const { linkConnector } = this
const { overReroute, overWidget } = linkConnector
if (!LiteGraph.snap_highlights_node || !linkConnector.isConnecting) return
// Reroute highlight
if (overReroute) {
const { globalAlpha } = ctx
@@ -3976,7 +3972,7 @@ export class LGraphCanvas implements ConnectionColorContext {
// Ensure we're mousing over a node and connecting a link
const node = this.node_over
if (!(node && linkConnector.isConnecting)) return
if (!node) return
const { strokeStyle, lineWidth } = ctx