Fix reroutes ignore change in radius (#379)

This commit is contained in:
filtered
2024-12-16 05:55:46 +11:00
committed by GitHub
parent 71f8a1decf
commit 6956973be1
2 changed files with 5 additions and 5 deletions

View File

@@ -1048,9 +1048,9 @@ export class LGraph implements LinkNetwork, Serialisable<SerialisableGraph> {
*/
getRerouteOnPos(x: number, y: number): Reroute | undefined {
for (const reroute of this.reroutes.values()) {
const pos = reroute.pos
const { pos } = reroute
if (isSortaInsideOctagon(x - pos[0], y - pos[1], 20))
if (isSortaInsideOctagon(x - pos[0], y - pos[1], 2 * Reroute.radius))
return reroute
}
}

View File

@@ -283,21 +283,21 @@ export class Reroute implements Positionable, LinkSegment, Serialisable<Serialis
ctx.arc(pos[0], pos[1], Reroute.radius, 0, 2 * Math.PI)
ctx.fill()
ctx.lineWidth = 1
ctx.lineWidth = Reroute.radius * 0.1
ctx.strokeStyle = "rgb(0,0,0,0.5)"
ctx.stroke()
ctx.fillStyle = "#ffffff55"
ctx.strokeStyle = "rgb(0,0,0,0.3)"
ctx.beginPath()
ctx.arc(pos[0], pos[1], 8, 0, 2 * Math.PI)
ctx.arc(pos[0], pos[1], Reroute.radius * 0.8, 0, 2 * Math.PI)
ctx.fill()
ctx.stroke()
if (this.selected) {
ctx.strokeStyle = "#fff"
ctx.beginPath()
ctx.arc(pos[0], pos[1], 12, 0, 2 * Math.PI)
ctx.arc(pos[0], pos[1], Reroute.radius * 1.2, 0, 2 * Math.PI)
ctx.stroke()
}
}