diff --git a/CHANGELOG.md b/CHANGELOG.md index bc46bf8c..2c19084b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - widgets - inputs: **new** `keys` widget, for keyboard bindings - property inheritance: new special property name `_value` (retrieve the widget's value, and update when it changes) + - switch: added `showValues` to display both values and labels in the buttons ## 0.22.0 diff --git a/resources/docs/widgets/buttons.md b/resources/docs/widgets/buttons.md index 13cdb383..a4bc92b1 100644 --- a/resources/docs/widgets/buttons.md +++ b/resources/docs/widgets/buttons.md @@ -78,7 +78,6 @@ Setting the `push`'s value externally (via osc) will toggle it's inner light. // etc } ``` - ### `values` - type: `array|object` - default: `{"Value 1":1,"Value 2":2}` @@ -86,6 +85,12 @@ Setting the `push`'s value externally (via osc) will toggle it's inner light. - `array` of possible values to switch between : `[1,2,3]` - `object` of `"label":value` pairs +### `showValues` +- type: `boolean` +- default: `false` +- usage: if `values` is an `object`, set to `true` to display both values and labels instead of labels only + + ## Dropdown ```js { diff --git a/src/browser/js/app/widgets/buttons/switch.js b/src/browser/js/app/widgets/buttons/switch.js index 7ddbe3af..f34601e0 100644 --- a/src/browser/js/app/widgets/buttons/switch.js +++ b/src/browser/js/app/widgets/buttons/switch.js @@ -51,7 +51,7 @@ module.exports = class Switch extends _widgets_base { this.values = [] - var isArray = Array.isArray(this.getProp('values')) + var isArray = Array.isArray(this.getProp('values')) for (var k in this.getProp('values')) {