浏览代码

Keep entity sizes constant when changing units

tags/v0.0.4
Fen Dweller 5 年前
父节点
当前提交
458939cf7d
共有 1 个文件被更改,包括 12 次插入3 次删除
  1. +12
    -3
      macrovision.js

+ 12
- 3
macrovision.js 查看文件

@@ -325,7 +325,7 @@ function configEntityOptions(entity, view) {
scaleInput.id = "options-entity-scale";

scaleInput.addEventListener("input", e => {
entity.scale = e.target.value;
entity.scale = e.target.value == 0 ? 1 : e.target.value;

if (config.autoFit) {
fitWorld();
@@ -412,7 +412,8 @@ function configViewOptions(entity, view) {


input.addEventListener("input", e => {
entity.views[view][key] = math.unit(input.value, select.value);
const value = input.value == 0 ? 1 : input.value;
entity.views[view][key] = math.unit(value, select.value);

if (config.autoFit) {
fitWorld();
@@ -422,12 +423,20 @@ function configViewOptions(entity, view) {
updateViewOptions(entity, view, key);
});

select.setAttribute("oldUnit", select.value);
select.addEventListener("input", e => {
entity.views[view][key] = math.unit(input.value, select.value);
const value = input.value == 0 ? 1 : input.value;
const oldUnit = select.getAttribute("oldUnit");
entity.views[view][key] = math.unit(value, oldUnit).to(select.value);
input.value = entity.views[view][key].toNumber(select.value);

select.setAttribute("oldUnit", select.value);

if (config.autoFit) {
fitWorld();
}

updateSizes();
updateEntityOptions(entity, view);
updateViewOptions(entity, view, key);


正在加载...
取消
保存