Преглед на файлове

Fix positioning when zooming in and out

master
Fen Dweller преди 5 години
родител
ревизия
1f291d331c
променени са 1 файла, в които са добавени 7 реда и са изтрити 2 реда
  1. +7
    -2
      macrovision.js

+ 7
- 2
macrovision.js Целия файл

@@ -231,7 +231,12 @@ function snapRel(coords) {
} }


function adjustAbs(coords, oldHeight, newHeight) { function adjustAbs(coords, oldHeight, newHeight) {
return coords;
const ratio = math.divide(newHeight, oldHeight);

const x = coords.x * ratio;
const y = coords.y * ratio;

return { x: x, y: y};
} }


function pos2pix(coords) { function pos2pix(coords) {
@@ -2829,7 +2834,7 @@ function setWorldHeight(oldHeight, newHeight) {
const element = document.querySelector("#entity-" + key); const element = document.querySelector("#entity-" + key);
let newPosition; let newPosition;


if (!altHeld) {
if (altHeld) {
newPosition = adjustAbs({ x: element.dataset.x, y: element.dataset.y }, oldHeight, config.height); newPosition = adjustAbs({ x: element.dataset.x, y: element.dataset.y }, oldHeight, config.height);
} else { } else {
newPosition = { x: element.dataset.x, y: element.dataset.y }; newPosition = { x: element.dataset.x, y: element.dataset.y };


Loading…
Отказ
Запис