Skip to content

Commit

Permalink
Fix reroutes ignore change in radius (#379)
Browse files Browse the repository at this point in the history
  • Loading branch information
webfiltered authored Dec 15, 2024
1 parent 71f8a1d commit 6956973
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/LGraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/Reroute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
Expand Down

0 comments on commit 6956973

Please sign in to comment.