diff options
author | emkael <emkael@tlen.pl> | 2019-06-06 12:45:08 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2019-06-06 12:45:44 +0200 |
commit | 2933caa662921883884d5bb5fe7c730341873a89 (patch) | |
tree | 9873f3389ef402e0c2a991b6d0eb813374a07802 | |
parent | adb8523a62de11c92d205bb61f83ba038b3652dd (diff) |
Fix for overlapping lines if match boxes are wider than expected
-rw-r--r-- | playoff.js | 22 |
1 files changed, 18 insertions, 4 deletions
@@ -198,6 +198,18 @@ var playoff = { (lines.vTo[1] + lines.vTo[3]) / 2 ] ] + for (var h in lines.hTo) { + lines.hTo[h][2] = Math.max( + lines.hTo[h][2], + lines.midpoints[2][0] + ); + } + for (var h in lines.hFrom) { + lines.hFrom[h][2] = Math.min( + lines.hFrom[h][2], + lines.midpoints[0][0] + ); + } return lines; } }; @@ -220,10 +232,12 @@ var playoff = { } this.drawLine(ctx, linesToDraw.vTo); for (var m = 0; m < linesToDraw.midpoints.length-1; m++) { - this.drawLine(ctx, [ - linesToDraw.midpoints[m][0], linesToDraw.midpoints[m][1], - linesToDraw.midpoints[m+1][0], linesToDraw.midpoints[m+1][1] - ]); + if (linesToDraw.midpoints[m][0] <= linesToDraw.midpoints[m+1][0]) { + this.drawLine(ctx, [ + linesToDraw.midpoints[m][0], linesToDraw.midpoints[m][1], + linesToDraw.midpoints[m+1][0], linesToDraw.midpoints[m+1][1] + ]); + } } } } |