浏览代码

Center the horiziontal axis

master
Fen Dweller 5 年前
父节点
当前提交
36b70fcdf2
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. +5
    -1
      macrovision.js

+ 5
- 1
macrovision.js 查看文件

@@ -470,11 +470,15 @@ function drawHorizontalScale(ifDirty = false) {
if (ifDirty && !worldSizeDirty)
return;
function drawTicks(/** @type {CanvasRenderingContext2D} */ ctx, pixelsPer, heightPer) {
console.log(heightPer);
let total = heightPer.clone();
total.value = math.unit(-config.x, "meters").toNumber(config.unit);

// further adjust it to put the current position in the center

total.value -= heightPer.toNumber("meters") / pixelsPer * (canvasWidth + 50) / 2;
let x = ctx.canvas.clientWidth - 50;


let offset = total.toNumber("meters") % heightPer.toNumber("meters");

x += offset / heightPer.toNumber("meters") * pixelsPer;


正在加载...
取消
保存