diff --git a/src/browser/js/app/widgets/pads/xy.js b/src/browser/js/app/widgets/pads/xy.js
index 8c7e0827..84bea8c5 100644
--- a/src/browser/js/app/widgets/pads/xy.js
+++ b/src/browser/js/app/widgets/pads/xy.js
@@ -2,8 +2,6 @@ var _pads_base = require('./_pads_base'),
Fader = require('./_fake_fader'),
{sendOsc} = require('../utils')
-
-
module.exports.options = {
type:'xy',
id:'auto',
@@ -40,7 +38,22 @@ var Xy = function(widgetData) {
_pads_base.apply(this,arguments)
- this.value = []
+ this.widget.append(`
+
+ X
+ Y
+
+
+ `)
+
+ this.inputs = [
+ this.widget.find('.x').fakeInput({align:'center'}),
+ this.widget.find('.y').fakeInput({align:'center'})
+ ]
+
this.faders = {
x: new Fader({
@@ -66,18 +79,22 @@ var Xy = function(widgetData) {
})
}
+ this.value = [this.faders.x.value, this.faders.y.value]
+
this.wrapper.append(this.faders.x.widget)
this.wrapper.append(this.faders.y.widget)
this.widget.on('sync',(e)=>{
e.stopPropagation()
- var {id, widget} = e
+ var {id, widget, options} = e
var v = widget.getValue()
if (this.value[id] != v) {
this.value[id] = v
- this.sendValue()
+ if (options.send) this.sendValue()
+ this.showValue(id)
+ $('body').trigger({type:'sync',id:this.widgetData.id,widget:this.widget, linkId:this.widgetData.linkId, options:options})
}
})
@@ -90,6 +107,24 @@ var Xy = function(widgetData) {
this.faders.y.dragHandleProxy(e, data, traversing)
})
+ this.inputs[0].change(()=>{
+ this.faders.x.setValue(parseFloat(this.inputs[0].val()),{sync:true,send:true})
+ })
+ this.inputs[1].change(()=>{
+ this.faders.y.setValue(parseFloat(this.inputs[1].val()),{sync:true,send:true})
+ })
+
+ this.showValue(0)
+ this.showValue(1)
+
+ this.widget.getValue = () => {
+ return this.value
+ }
+ this.widget.setValue = (v,o) => {
+ this.setValue(v,o)
+ }
+
+
}
@@ -97,6 +132,17 @@ Xy.prototype = Object.create(_pads_base.prototype)
Xy.prototype.constructor = Xy
+Xy.prototype.setValue = function(v, options){
+ if (!v || v.length!=2) return
+ this.faders.x.setValue(v[0], {sync: true, send:options.send})
+ this.faders.y.setValue(v[1], {sync: true, send:options.send})
+}
+
+
+Xy.prototype.showValue = function(i){
+ this.inputs[i].val(this.value[i])
+}
+
module.exports.create = function(widgetData) {
var xy = new Xy(widgetData)
return xy.widget
diff --git a/src/browser/scss/widgets/_pads.scss b/src/browser/scss/widgets/_pads.scss
index fd366605..cae39130 100644
--- a/src/browser/scss/widgets/_pads.scss
+++ b/src/browser/scss/widgets/_pads.scss
@@ -3,10 +3,18 @@
width: 100%;
overflow: hidden;
display: flex;
+ flex-direction: column;
+ .row {
+ display: flex;
+ text-align: center;
+ flex-shrink: 0;
+ background: var(--color-fg);
+ }
> .wrapper {
position: relative;
height: 100%;
width: 100%;
+ background:var(--color-faded);
.fader {
--color-gauge:transparent;
--color-pips: var(--color-text-fade);