sanitize widget's value input, avoid unwanted sync between widget with preArgs and widgets without
This commit is contained in:
parent
7e09afd020
commit
cd8dd6f7bb
4 changed files with 10 additions and 2 deletions
|
|
@ -199,6 +199,8 @@ module.exports.create = function(widgetData,container) {
|
|||
|
||||
}
|
||||
widget.setValue = function(v,send,sync) {
|
||||
if (typeof v != 'number') return
|
||||
|
||||
var h,
|
||||
v=clip(Math.round(v*roundFactor)/roundFactor,[rangeVals[0],rangeVals.slice(-1)[0]])
|
||||
for (var i=0;i<rangeVals.length-1;i++) {
|
||||
|
|
@ -235,7 +237,7 @@ module.exports.create = function(widgetData,container) {
|
|||
}
|
||||
|
||||
input.change(function(){
|
||||
widget.setValue(input.val(),true,true)
|
||||
widget.setValue(parseFloat(input.val()),true,true)
|
||||
})
|
||||
|
||||
widget.setValue(rangeVals[0])
|
||||
|
|
|
|||
|
|
@ -192,6 +192,8 @@ module.exports.create = function(widgetData,container) {
|
|||
})
|
||||
}
|
||||
widget.setValue = function(v,send,sync) {
|
||||
if (typeof v != 'number') return
|
||||
|
||||
var r = mapToScale(Math.round(v*roundFactor)/roundFactor,[range.min,range.max],[0,270],widgetData.precision,logScale,true)
|
||||
knob.rotation = r
|
||||
|
||||
|
|
@ -205,7 +207,7 @@ module.exports.create = function(widgetData,container) {
|
|||
if (send) widget.sendValue(v)
|
||||
}
|
||||
input.change(function(){
|
||||
widget.setValue(input.val(),true,true)
|
||||
widget.setValue(parseFloat(input.val()),true,true)
|
||||
})
|
||||
|
||||
widget.setValue(range.min)
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ module.exports.create = function(widgetData,container) {
|
|||
if (widgetData.color!='auto') led.css('background-color',widgetData.color)
|
||||
|
||||
widget.setValue = function(v,send,sync){
|
||||
if (typeof v != 'number') return
|
||||
|
||||
led.css('opacity',mapToScale(v,[range.min,range.max],[0,1],widgetData.precision,widgetData.logScale,true))
|
||||
if (sync) widget.trigger('sync',[widgetData.id,widget])
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,6 +67,8 @@ module.exports.create = function(widgetData,container) {
|
|||
|
||||
|
||||
widget.setValue = function(v) {
|
||||
if (typeof v != 'number') return
|
||||
|
||||
var h,
|
||||
v=clip(v,[rangeVals[0],rangeVals.slice(-1)[0]])
|
||||
for (var i=0;i<rangeVals.length-1;i++) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue