Reroute link styles (#845)

Improves linear & straight link styles to work with native reroutes
This commit is contained in:
filtered
2025-03-24 13:31:43 +11:00
committed by GitHub
parent 5a67044206
commit 642317f6bd

View File

@@ -4739,8 +4739,8 @@ export class LGraphCanvas implements ConnectionColorContext {
false,
0,
null,
start_dir,
end_dir,
startControl === undefined ? start_dir : LinkDirection.CENTER,
LinkDirection.CENTER,
{
startControl,
endControl: reroute.controlPoint,
@@ -4777,7 +4777,7 @@ export class LGraphCanvas implements ConnectionColorContext {
false,
0,
null,
start_dir,
LinkDirection.CENTER,
end_dir,
{ startControl, disabled },
)
@@ -4935,8 +4935,8 @@ export class LGraphCanvas implements ConnectionColorContext {
justPastCentre[0] - pos[0],
)
}
} else if (this.links_render_mode == LinkRenderType.LINEAR_LINK) {
const l = 15
} else {
const l = this.links_render_mode == LinkRenderType.LINEAR_LINK ? 15 : 10
switch (startDir) {
case LinkDirection.LEFT:
innerA[0] += -l
@@ -4965,6 +4965,7 @@ export class LGraphCanvas implements ConnectionColorContext {
innerB[1] += l
break
}
if (this.links_render_mode == LinkRenderType.LINEAR_LINK) {
path.moveTo(a[0], a[1] + offsety)
path.lineTo(innerA[0], innerA[1] + offsety)
path.lineTo(innerB[0], innerB[1] + offsety)
@@ -4981,16 +4982,6 @@ export class LGraphCanvas implements ConnectionColorContext {
)
}
} else if (this.links_render_mode == LinkRenderType.STRAIGHT_LINK) {
if (startDir == LinkDirection.RIGHT) {
innerA[0] += 10
} else {
innerA[1] += 10
}
if (endDir == LinkDirection.LEFT) {
innerB[0] -= 10
} else {
innerB[1] -= 10
}
const midX = (innerA[0] + innerB[0]) * 0.5
path.moveTo(a[0], a[1])
@@ -5014,6 +5005,7 @@ export class LGraphCanvas implements ConnectionColorContext {
return
}
}
}
// rendering the outline of the connection can be a little bit slow
if (this.render_connections_border && !this.low_quality && !skip_border) {