widgets: put sendOsc method in widgets base class
This commit is contained in:
parent
9e2534c73b
commit
7b30e09320
6 changed files with 17 additions and 32 deletions
|
|
@ -1,3 +1,19 @@
|
|||
var {sendOsc} = require('../utils')
|
||||
|
||||
|
||||
var _widget_base = module.exports = function(widgetData) {
|
||||
this.widgetData = widgetData
|
||||
}
|
||||
|
||||
_widget_base.prototype.sendValue = function() {
|
||||
|
||||
var args = this.widgetData.preArgs.concat(this.value)
|
||||
|
||||
sendOsc({
|
||||
target:this.widgetData.target,
|
||||
path:this.widgetData.path,
|
||||
precision:this.widgetData.precision,
|
||||
args:args
|
||||
})
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,12 +26,6 @@ _pads_base.prototype.setValue = function(v,options={}) {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
_pads_base.prototype.sendValue = function(value) {
|
||||
|
||||
}
|
||||
|
||||
_pads_base.prototype.showValue = function() {
|
||||
this.input.val(this.value + this.unit)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,18 +97,6 @@ Xy.prototype = Object.create(_pads_base.prototype)
|
|||
|
||||
Xy.prototype.constructor = Xy
|
||||
|
||||
Xy.prototype.sendValue = function() {
|
||||
var args = this.widgetData.preArgs.concat(this.value)
|
||||
|
||||
sendOsc({
|
||||
target:this.widgetData.target,
|
||||
path:this.widgetData.path,
|
||||
precision:this.widgetData.precision,
|
||||
args:args
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
module.exports.create = function(widgetData) {
|
||||
var xy = new Xy(widgetData)
|
||||
return xy.widget
|
||||
|
|
|
|||
|
|
@ -163,18 +163,6 @@ _sliders_base.prototype.setValue = function(v,options={}) {
|
|||
if (options.send) this.sendValue(v)
|
||||
}
|
||||
|
||||
_sliders_base.prototype.sendValue = function(value) {
|
||||
var args = this.widgetData.preArgs.concat(value)
|
||||
|
||||
sendOsc({
|
||||
target:this.widgetData.target,
|
||||
path:this.widgetData.path,
|
||||
precision:this.widgetData.precision,
|
||||
args:args
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
_sliders_base.prototype.showValue = function() {
|
||||
this.input.val(this.value + this.unit)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -225,8 +225,6 @@ Knob.prototype.draw = function(){
|
|||
this.ctx.restore()
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue