Skip to content

Commit

Permalink
better looking wires part2
Browse files Browse the repository at this point in the history
  • Loading branch information
Lubin Pappalardo committed Oct 5, 2023
1 parent 1ff569e commit da58142
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions assets/scripts/wires.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,16 @@ function draw () {

pen.beginPath();
pen.moveTo(start.x, start.y);
pen.lineTo(end.x - (Math.abs(start.x - end.x) / 2), start.y);
pen.lineTo(end.x - (Math.abs(start.x - end.x) / 2), end.y);
if (end.x > start.x) {
pen.lineTo(end.x - (Math.abs(start.x - end.x) / 2), start.y);
pen.lineTo(end.x - (Math.abs(start.x - end.x) / 2), end.y);
} else {
pen.lineTo(start.x, end.y - (Math.abs(start.y - end.y) / 2));
pen.lineTo(end.x, end.y - (Math.abs(start.y - end.y) / 2));
}
pen.lineTo(end.x, end.y);
pen.stroke();

}
}
}
Expand Down

0 comments on commit da58142

Please sign in to comment.