From 50ae84b4fd2f8a80de0a6faede9d5017d125e689 Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Thu, 13 Feb 2020 17:41:00 -0500 Subject: [PATCH] Fix auto-size showing the wrong units for the scale --- macrovision.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/macrovision.js b/macrovision.js index ee7faa71..deb1d525 100644 --- a/macrovision.js +++ b/macrovision.js @@ -727,6 +727,7 @@ document.addEventListener("DOMContentLoaded", () => { }) document.querySelector("#options-height-unit").addEventListener("input", e => { + checkFitWorld(); updateWorldHeight(); }) @@ -925,7 +926,7 @@ function checkFitWorld() { } } function fitWorld() { - let max = math.unit(0, "meter"); + let max = math.unit(0, "meters"); Object.entries(entities).forEach(([key, entity]) => { const view = document.querySelector("#entity-" + key).dataset.view; @@ -937,15 +938,15 @@ function fitWorld() { } function updateWorldHeight() { - const value = Math.max(1, document.querySelector("#options-height-value").value); const unit = document.querySelector("#options-height-unit").value; + const value = Math.max(0.000000001, document.querySelector("#options-height-value").value); const oldHeight = config.height; setWorldHeight(oldHeight, math.unit(value, unit)); } function setWorldHeight(oldHeight, newHeight) { - config.height = newHeight; + config.height = newHeight.to(document.querySelector("#options-height-unit").value) const unit = document.querySelector("#options-height-unit").value; document.querySelector("#options-height-value").value = config.height.toNumber(unit);