allow set default text in text widget
This commit is contained in:
parent
0ee25352fd
commit
97e8389d4f
3 changed files with 26 additions and 7 deletions
|
|
@ -19,20 +19,27 @@ module.exports.options = {
|
|||
separator2:'osc',
|
||||
|
||||
preArgs:[],
|
||||
path:'auto'
|
||||
path:'auto',
|
||||
defaultText:''
|
||||
}
|
||||
module.exports.create = function(widgetData,container) {
|
||||
var widget = $(`
|
||||
<div class="text">
|
||||
</div>
|
||||
`),
|
||||
label = widgetData.label===false?widgetData.id:widgetData.label=='auto'?widgetData.id:widgetData.label=='auto'
|
||||
label = widgetData.defaultText!==''?
|
||||
widgetData.defaultText:
|
||||
widgetData.label===false?
|
||||
widgetData.id:
|
||||
widgetData.label=='auto'?
|
||||
widgetData.id:
|
||||
widgetData.label
|
||||
|
||||
|
||||
if (widgetData.vertical) widget.addClass('vertical')
|
||||
|
||||
widget.setValue = function(v,send,sync){
|
||||
widget.text(v)
|
||||
widget.text(v==='default'?label:v)
|
||||
}
|
||||
|
||||
widget.setValue(label)
|
||||
|
|
|
|||
|
|
@ -3486,20 +3486,27 @@ module.exports.options = {
|
|||
separator2:'osc',
|
||||
|
||||
preArgs:[],
|
||||
path:'auto'
|
||||
path:'auto',
|
||||
defaultText:''
|
||||
}
|
||||
module.exports.create = function(widgetData,container) {
|
||||
var widget = $(`
|
||||
<div class="text">
|
||||
</div>
|
||||
`),
|
||||
label = widgetData.label===false?widgetData.id:widgetData.label=='auto'?widgetData.id:widgetData.label=='auto'
|
||||
label = widgetData.defaultText!==''?
|
||||
widgetData.defaultText:
|
||||
widgetData.label===false?
|
||||
widgetData.id:
|
||||
widgetData.label=='auto'?
|
||||
widgetData.id:
|
||||
widgetData.label
|
||||
|
||||
|
||||
if (widgetData.vertical) widget.addClass('vertical')
|
||||
|
||||
widget.setValue = function(v,send,sync){
|
||||
widget.text(v)
|
||||
widget.text(v==='default'?label:v)
|
||||
}
|
||||
|
||||
widget.setValue(label)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
Text displays incoming values (via osc) as text. Setting its value to `default` will display the default text.
|
||||
|
||||
```js
|
||||
{
|
||||
|
|
@ -109,6 +109,11 @@ Text displays incoming values (via osc) as text
|
|||
- default: `false`
|
||||
- usage: set to `true` display vertically
|
||||
|
||||
#### `defaultText`
|
||||
- type: `string`
|
||||
- default: `empty`
|
||||
- usage: default text to be displayed. If not set, `label` or `id` is used
|
||||
|
||||
|
||||
## Meter
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue