Browse Source

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 years ago
parent
commit
1ec437157e
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      macrovision.js

+ 3
- 3
macrovision.js View File

@@ -23,8 +23,8 @@ const unitChoices = {
"parsecs",
],
area: [
"cm^2",
"meters^2",
"cm^2",
"kilometers^2",
"acres",
"miles^2"
@@ -500,8 +500,8 @@ function updateViewOptions(entity, view, changed) {
const input = document.querySelector("#options-view-" + key + "-input");
const select = document.querySelector("#options-view-" + key + "-select");
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…
Cancel
Save