diff --git a/demo/menu.js b/demo/menu.js index 493efc06..014521d9 100644 --- a/demo/menu.js +++ b/demo/menu.js @@ -133,10 +133,15 @@ class Menu { async addRange(title, object, variable, min, max, step, callback) { const el = document.createElement('div'); el.className = 'menu-item'; - el.innerHTML = `${title}`; + const arr = Array.isArray(variable); + el.innerHTML = `${title}`; this.container.appendChild(el); el.addEventListener('change', (evt) => { - object[variable] = evt.target.value; + const int = parseInt(evt.target.value) === parseFloat(evt.target.value); + const val = Array.isArray(variable) ? variable : [variable]; + for (const item of val) { + object[item] = int ? parseInt(evt.target.value) : parseFloat(evt.target.value); + } evt.target.setAttribute('value', evt.target.value); if (callback) callback(evt.target.value); });