widgets: put sendOsc method in widgets base class

This commit is contained in:
jean-emmanuel 2016-10-20 01:11:08 +02:00
parent 9e2534c73b
commit 7b30e09320
6 changed files with 17 additions and 32 deletions

View file

@ -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
})
}

View file

@ -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)
}

View file

@ -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

View file

@ -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)
}

View file

@ -225,8 +225,6 @@ Knob.prototype.draw = function(){
this.ctx.restore()
}
}

View file

@ -15,6 +15,7 @@
position: absolute;
width:100%;
height:100%;
opacity: 0.5;
.wrapper canvas {
background:transparent;
}