make Text's value storable/recallable. Reset it on messages with no arg

This commit is contained in:
bordun 2016-06-08 10:03:49 +02:00
parent 1710683295
commit 2e821aff7c
3 changed files with 17 additions and 5 deletions

View file

@ -33,13 +33,19 @@ module.exports.create = function(widgetData,container) {
widgetData.id:
widgetData.label=='auto'?
widgetData.id:
widgetData.label
widgetData.label,
text = label
if (widgetData.vertical) widget.addClass('vertical')
widget.setValue = function(v,send,sync){
widget.text(v==='default'?label:v)
text = typeof v=='object' && !v.length?label:v
widget.text(text)
}
widget.getValue = function(){
return text
}
widget.setValue(label)

View file

@ -3500,13 +3500,19 @@ module.exports.create = function(widgetData,container) {
widgetData.id:
widgetData.label=='auto'?
widgetData.id:
widgetData.label
widgetData.label,
text = label
if (widgetData.vertical) widget.addClass('vertical')
widget.setValue = function(v,send,sync){
widget.text(v==='default'?label:v)
text = typeof v=='object' && !v.length?label:v
widget.text(text)
}
widget.getValue = function(){
return text
}
widget.setValue(label)

View file

@ -95,7 +95,7 @@ The visualizer displays the evolution in time of a received value (through osc)
## Text
Text displays incoming values (via osc) as text. Setting its value to `default` will display the default text.
Text displays incoming values (via osc) as text. Sending a message with no argument to the widget will reset it to its default text.
```js
{