From a72b3f0c89bbacdd056be3338e164adf027c514b Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Mon, 22 Jun 2020 13:16:50 -0400 Subject: [PATCH] Improve drawing of the horizontal axis --- macrovision.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/macrovision.js b/macrovision.js index e20dd933..b41f63e5 100644 --- a/macrovision.js +++ b/macrovision.js @@ -484,8 +484,9 @@ function drawHorizontalScale(ifDirty = false) { x += offset / heightPer.toNumber("meters") * pixelsPer; total = math.subtract(total, math.unit(offset, "meters")); - for (; x >= 50; x -= pixelsPer) { - drawTick(ctx, x, 50, total); + for (; x >= 50 - pixelsPer; x -= pixelsPer) { + // negate it so that the left side is negative + drawTick(ctx, x, 50, math.multiply(-1, total)); total = math.add(total, heightPer); } } @@ -553,12 +554,12 @@ function drawHorizontalScale(ifDirty = false) { ctx.beginPath(); - ctx.moveTo(50, 50); - ctx.lineTo(ctx.canvas.clientWidth-50, 50); + ctx.moveTo(0, 50); + ctx.lineTo(ctx.canvas.clientWidth, 50); ctx.stroke(); ctx.beginPath(); - ctx.moveTo(50, ctx.canvas.clientHeight - 50); - ctx.lineTo(ctx.canvas.clientWidth - 50, ctx.canvas.clientHeight - 50); + ctx.moveTo(0, ctx.canvas.clientHeight - 50); + ctx.lineTo(ctx.canvas.clientWidth , ctx.canvas.clientHeight - 50); ctx.stroke(); drawTicks(ctx, pixelsPer, heightPer);