Browse Source

Improve drawing of the horizontal axis

master
Fen Dweller 5 years ago
parent
commit
a72b3f0c89
1 changed files with 7 additions and 6 deletions
  1. +7
    -6
      macrovision.js

+ 7
- 6
macrovision.js View File

@@ -484,8 +484,9 @@ function drawHorizontalScale(ifDirty = false) {
x += offset / heightPer.toNumber("meters") * pixelsPer; x += offset / heightPer.toNumber("meters") * pixelsPer;
total = math.subtract(total, math.unit(offset, "meters")); 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); total = math.add(total, heightPer);
} }
} }
@@ -553,12 +554,12 @@ function drawHorizontalScale(ifDirty = false) {


ctx.beginPath(); 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.stroke();
ctx.beginPath(); 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(); ctx.stroke();


drawTicks(ctx, pixelsPer, heightPer); drawTicks(ctx, pixelsPer, heightPer);


Loading…
Cancel
Save