Просмотр исходного кода

Center the horiziontal axis

master
Fen Dweller 5 лет назад
Родитель
Сommit
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;


Загрузка…
Отмена
Сохранить