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

Fix changing area units causing an object's size to change

The default displayed unit was cm^2, but it was m^2 internally -
so it would wind up shrinking if you went to m^2. This needs to be
fixed more generally, though - it should be able to start at any unit
and still work properly.
tags/v0.0.6
Fen Dweller преди 5 години
родител
ревизия
1ec437157e
променени са 1 файла, в които са добавени 3 реда и са изтрити 3 реда
  1. +3
    -3
      macrovision.js

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

@@ -23,8 +23,8 @@ const unitChoices = {
"parsecs", "parsecs",
], ],
area: [ area: [
"cm^2",
"meters^2", "meters^2",
"cm^2",
"kilometers^2", "kilometers^2",
"acres", "acres",
"miles^2" "miles^2"
@@ -500,8 +500,8 @@ function updateViewOptions(entity, view, changed) {
const input = document.querySelector("#options-view-" + key + "-input"); const input = document.querySelector("#options-view-" + key + "-input");
const select = document.querySelector("#options-view-" + key + "-select"); const select = document.querySelector("#options-view-" + key + "-select");
const currentUnit = select.value; const currentUnit = select.value;
const convertedAmount = entity.views[view][key].to(currentUnit);
input.value = math.round(convertedAmount.value, 5);
const convertedAmount = entity.views[view][key].toNumber(currentUnit);
input.value = math.round(convertedAmount, 5);
} }


}); });


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