Skip to content

Commit

Permalink
Handle Wall and Edge classes in Draw.segment
Browse files Browse the repository at this point in the history
  • Loading branch information
caewok committed Jun 9, 2024
1 parent dcf4896 commit a0e49a7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,12 @@ export class Draw {
* @param {Number} width Width of the line in pixels.
*/
segment(s, { color = Draw.COLORS.blue, alpha = 1, width = 1 } = {}) {
// Handle Wall, Edge, other
const A = s.edge?.a ?? s.a ?? s.A;
const B = s.edge?.b ?? s.b ?? s.B;
this.g.lineStyle(width, color, alpha)
.moveTo(s.A.x, s.A.y)
.lineTo(s.B.x, s.B.y);
.moveTo(A.x, A.y)
.lineTo(B.x, B.y);
}

/**
Expand Down

0 comments on commit a0e49a7

Please sign in to comment.