瀏覽代碼

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",
],
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…
取消
儲存