Browse Source

Fix delete keypresses propagating from inputs and removing entities

Also makes the scale input behave like the rest - change, not input
tags/v0.1.0
Fen Dweller 5 years ago
parent
commit
91fd8dd780
1 changed files with 18 additions and 1 deletions
  1. +18
    -1
      macrovision.js

+ 18
- 1
macrovision.js View File

@@ -488,7 +488,7 @@ function configEntityOptions(entity, view) {
scaleInput.classList.add("options-field-numeric");
scaleInput.id = "options-entity-scale";

scaleInput.addEventListener("input", e => {
scaleInput.addEventListener("change", e => {
entity.scale = e.target.value == 0 ? 1 : e.target.value;
entity.dirty = true;
if (config.autoFit) {
@@ -500,6 +500,10 @@ function configEntityOptions(entity, view) {
updateViewOptions(entity, view);
});

scaleInput.addEventListener("keydown", e => {
e.stopPropagation();
})

scaleInput.setAttribute("min", 1);
scaleInput.setAttribute("type", "number");
setNumericInput(scaleInput, entity.scale);
@@ -525,6 +529,10 @@ function configEntityOptions(entity, view) {
updateSizes(true);
})

nameInput.addEventListener("keydown", e => {
e.stopPropagation();
})

nameRow.appendChild(nameInput);

holder.appendChild(nameLabel);
@@ -630,6 +638,10 @@ function configViewOptions(entity, view) {
updateViewOptions(entity, view, key);
});

input.addEventListener("keydown", e => {
e.stopPropagation();
})

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

// TODO does this ever cause a change in the world?
@@ -1414,6 +1426,11 @@ document.addEventListener("DOMContentLoaded", () => {
document.querySelector("#options-height-value").addEventListener("change", e => {
updateWorldHeight();
})

document.querySelector("#options-height-value").addEventListener("keydown", e => {
e.stopPropagation();
})

unitSelector.addEventListener("input", e => {
checkFitWorld();
updateWorldHeight();


Loading…
Cancel
Save