diff --git a/src/client/widgets/basics/menu.js b/src/client/widgets/basics/menu.js index fe88a688..9791c96c 100644 --- a/src/client/widgets/basics/menu.js +++ b/src/client/widgets/basics/menu.js @@ -61,7 +61,7 @@ class Menu extends Widget { this.opened = false this.values = [] - this.stringValues = [] + this.keys = [] this.selected = -1 this.value = undefined @@ -201,6 +201,8 @@ class Menu extends Widget { if (this.opened) this.widget.removeChild(this.menu) this.menu.innerHTML = '' + this.keys = !Array.isArray(values) ? Object.keys(values) : values + this.values = !Array.isArray(values) ? Object.values(values) : values nval = Array.isArray(values) ? values.length : Object.keys(values).length weights = Array.isArray(weights) ? weights.slice(0, nval) : Array(nval).fill(1) @@ -211,12 +213,7 @@ class Menu extends Widget { for (let k in values) { let angle = Math.min(360 * weights[i] / totalWeight, 120), skew = 90 - angle - this.values.push(values[k]) - if (typeof values[k] == 'object') { - this.stringValues.push(JSON.stringify(values[k])) - } else { - this.stringValues.push(0) - } + this.menu.appendChild(html`