Quellcode durchsuchen

Allow scrolling to adjust the world scale

tags/v0.0.2
Fen Dweller vor 5 Jahren
Ursprung
Commit
f4e263247e
1 geänderte Dateien mit 16 neuen und 0 gelöschten Zeilen
  1. +16
    -0
      macrovision.js

+ 16
- 0
macrovision.js Datei anzeigen

@@ -336,6 +336,14 @@ function clearViewList() {
list.style.display = "none";
}

function updateWorldOptions(entity, view) {
const heightInput = document.querySelector("#options-height-value");
const heightSelect = document.querySelector("#options-height-unit");

const converted = config.height.to(heightSelect.value);
heightInput.value = math.round(converted.value, 3);
}
function configEntityOptions(entity, view) {
const holder = document.querySelector("#options-entity");

@@ -570,7 +578,15 @@ document.addEventListener("DOMContentLoaded", () => {
displayEntity(makeBuilding(), "building", 1 - x, 1);
}

window.addEventListener("wheel", e => {
console.log(e);

const dir = e.deltaY < 0 ? 0.9 : 1.1;

config.height = math.multiply(config.height, dir);
updateSizes();
updateWorldOptions();
})
document.querySelector("body").appendChild(testCtx.canvas);

updateSizes();


Laden…
Abbrechen
Speichern