diff --git a/CHANGELOG.md b/CHANGELOG.md
index 619e17c8..9a185edb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,8 @@
## 0.24.0
+/!\ BREAKING CHANGES /!\
+
- bug fixes
- regression preventing dropdown to display no option selected
- crossfaders display issue on iOS
@@ -21,7 +23,10 @@
- property maths: added support for math expressions everywhere via `#{}`
- input: add glass effect when `editable` is `false`
- `linkId` can now be set as an array of linkIds
- - plot: added `dots` options
+ - plot: added `dots` options; **removed** `points` options (use `value` and property inheritance instead)
+ - eq: **removed** `filters` options (use `value` and property inheritance instead)
+ - plot/meter/led/rgbled/text: **removed** `widgetId` option
+ - input: **removed** `widgetId` option
## 0.23.1
diff --git a/app/main/ipc/server.js b/app/main/ipc/server.js
index 327db585..1fee1bea 100644
--- a/app/main/ipc/server.js
+++ b/app/main/ipc/server.js
@@ -23,7 +23,7 @@ class Ipc extends EventEmitter {
var client = new Client(socket, id)
this.clients[id] = client
-
+
this.emit('connection', client)
client.on('close', ()=>{
diff --git a/resources/docs/widgets/inputs.md b/resources/docs/widgets/inputs.md
index 6b4e45f6..8b71b9e3 100644
--- a/resources/docs/widgets/inputs.md
+++ b/resources/docs/widgets/inputs.md
@@ -10,11 +10,6 @@
}
```
-### `widgetId`
-- type: `object`
-- default: `empty`
-- usage: a widget's `id` whose value will be linked to the input
-
### `editable`
- type: `boolean`
- default: `true`
diff --git a/resources/docs/widgets/plots.md b/resources/docs/widgets/plots.md
index 04f30e60..5961a6eb 100644
--- a/resources/docs/widgets/plots.md
+++ b/resources/docs/widgets/plots.md
@@ -10,11 +10,6 @@ Plots are tools that display other widgets' state or incomming osc messages. The
}
```
-### `widgetId`
-- type: `string`
-- default: `empty`
-- usage: a widget's `id` whose value will be mapped to the led's color opacity
-
### `range`
- type: `object`
- default: `{"min":0,"max":1}`
@@ -52,11 +47,10 @@ The plot receives an array of coordinates and draws them on a chart. Coordinates
}
```
-### `points`
+### `value`
- type: `array|string`
-- default: `[]`
+- default: `['']`
- usage:
- - as a `string`: a widget's `id` whose values will be used
- as an `array`: where items can be
- `number`
- `string` (widget's `id`)
@@ -107,7 +101,7 @@ The Eq receives an array of filter objects and draws their frequency response be
}
```
-### `filters`
+### `value`
- type: `array`
- default: `[]`
- usage:
@@ -161,11 +155,6 @@ The visualizer displays the evolution in time of a received value (through osc)
}
```
-### `widgetId`
-- type: `string`
-- default: `empty`
-- usage: a widget's `id` whose value will be displayed (thus bypassing the incoming osc)
-
### `duration`
- type: `number`
- default: `1`
@@ -202,11 +191,6 @@ Text displays incoming values (via osc) as text. Sending a message with no argum
}
```
-### `widgetId`
-- type: `string`
-- default: `empty`
-- usage: a widget's `id` whose value will be displayed
-
### `vertical`
- type: `boolean`
- default: `false`
@@ -223,10 +207,6 @@ Meter displays incoming numerical values (via osc) as a gauge level
}
```
-### `widgetId`
-- type: `object`
-- default: `empty`
-- usage: a widget's `id` whose value will be displayed
### `horizontal`
- type: `boolean`
diff --git a/src/browser/js/app/parser.js b/src/browser/js/app/parser.js
index 89748814..d589b911 100644
--- a/src/browser/js/app/parser.js
+++ b/src/browser/js/app/parser.js
@@ -59,11 +59,6 @@ var Parser = class Parser {
// Generate default address
props.address = props.address == 'auto' ? '/' + props.id : props.address
- // Delete unrecognized options
- for (let i in props) {
- if (defaults[i]===undefined && i!='type') {delete props[i]}
- }
-
// create container
var widgetContainer = DOM.create(`
diff --git a/src/browser/js/app/ui/utils.js b/src/browser/js/app/ui/utils.js
index 405d9bf7..c9892498 100644
--- a/src/browser/js/app/ui/utils.js
+++ b/src/browser/js/app/ui/utils.js
@@ -59,7 +59,7 @@ module.exports = {
open() {
if (this.state) return
this.state = 1
-
+
if (this.escKey) document.addEventListener('keydown', this.escKeyHandler)
if (this.enterKey) document.addEventListener('keydown', this.enterKeyHandler)
document.body.appendChild(this.html)
diff --git a/src/browser/js/app/widgets/containers/modal.js b/src/browser/js/app/widgets/containers/modal.js
index 882243bf..b340b777 100644
--- a/src/browser/js/app/widgets/containers/modal.js
+++ b/src/browser/js/app/widgets/containers/modal.js
@@ -10,6 +10,7 @@ module.exports = class Modal extends Panel {
return {
type:'modal',
id:'auto',
+ linkId:'',
_geometry:'geometry',
diff --git a/src/browser/js/app/widgets/containers/panel.js b/src/browser/js/app/widgets/containers/panel.js
index 07fc084f..76e0cf3d 100644
--- a/src/browser/js/app/widgets/containers/panel.js
+++ b/src/browser/js/app/widgets/containers/panel.js
@@ -13,6 +13,7 @@ class Panel extends Widget {
return {
type:'panel',
id:'auto',
+ linkId:'',
_geometry:'geometry',
diff --git a/src/browser/js/app/widgets/containers/root.js b/src/browser/js/app/widgets/containers/root.js
index 3836d8d3..67fbab69 100644
--- a/src/browser/js/app/widgets/containers/root.js
+++ b/src/browser/js/app/widgets/containers/root.js
@@ -12,6 +12,7 @@ module.exports = class Root extends Panel {
return {
type:'root',
+ linkId:'',
_style:'style',
diff --git a/src/browser/js/app/widgets/containers/strip.js b/src/browser/js/app/widgets/containers/strip.js
index e8bb9195..5635e5c8 100644
--- a/src/browser/js/app/widgets/containers/strip.js
+++ b/src/browser/js/app/widgets/containers/strip.js
@@ -7,6 +7,7 @@ module.exports = class Strip extends Panel {
return {
type:'strip',
id:'auto',
+ linkId:'',
_style:'style',
diff --git a/src/browser/js/app/widgets/containers/tab.js b/src/browser/js/app/widgets/containers/tab.js
index 554345e8..521759d0 100644
--- a/src/browser/js/app/widgets/containers/tab.js
+++ b/src/browser/js/app/widgets/containers/tab.js
@@ -11,6 +11,7 @@ module.exports = class Tab extends Panel {
return {
type:'tab',
id:'auto',
+ linkId:'',
_style:'style',
diff --git a/src/browser/js/app/widgets/inputs/input.js b/src/browser/js/app/widgets/inputs/input.js
index 3fd25861..4a4bc484 100644
--- a/src/browser/js/app/widgets/inputs/input.js
+++ b/src/browser/js/app/widgets/inputs/input.js
@@ -29,7 +29,6 @@ module.exports = class Input extends Canvas {
vertical:false,
unit: '',
- widgetId:'',
editable:true,
value:'',
@@ -76,12 +75,6 @@ module.exports = class Input extends Canvas {
this.widget.classList.add('not-editable')
}
- if (this.getProp('widgetId').length) {
-
- widgetManager.on(`change.${this.hash}`, this.syncHandle.bind(this))
-
- }
-
}
focus() {
@@ -114,14 +107,6 @@ module.exports = class Input extends Canvas {
}
- syncHandle(e) {
-
- if (this.getProp('widgetId')!=e.id || !widgetManager.getWidgetById(e.id).length || !e.widget) return
-
- this.setValue(e.widget.getValue(), {...e.options, internal:true})
-
- }
-
resizeHandle(event){
super.resizeHandle(event)
@@ -149,19 +134,6 @@ module.exports = class Input extends Canvas {
this.value = v
}
- if (!options.internal && this.getProp('widgetId').length) {
- var widget = widgetManager.getWidgetById(this.getProp('widgetId'))
- for (var i=widget.length-1; i>=0; i--) {
- if (widget[i].setValue) {
- widget[i].setValue(this.value, options)
- this.setValue(widget[i].getValue(), {...options, internal:true, sentOnce:options.send})
- return
- }
- }
- }
-
- if (options.sentOnce) options.send = false
-
this.stringValue = this.getStringValue()
this.batchDraw()
diff --git a/src/browser/js/app/widgets/inputs/keys.js b/src/browser/js/app/widgets/inputs/keys.js
index f86cd0d8..fa72ebaf 100644
--- a/src/browser/js/app/widgets/inputs/keys.js
+++ b/src/browser/js/app/widgets/inputs/keys.js
@@ -11,6 +11,7 @@ module.exports = class Keys extends Widget {
return {
type:'led',
id:'auto',
+ linkId:'',
_geometry:'geometry',
@@ -88,7 +89,6 @@ module.exports = class Keys extends Widget {
var widget = this.getLinkedWidget()
if (widget) {
-
var v = this.keydownMath.eval({
value: widget.getValue(),
key: e.key,
diff --git a/src/browser/js/app/widgets/plots/_plots_base.js b/src/browser/js/app/widgets/plots/_plots_base.js
index 586d7fe1..c4972c4c 100644
--- a/src/browser/js/app/widgets/plots/_plots_base.js
+++ b/src/browser/js/app/widgets/plots/_plots_base.js
@@ -16,7 +16,6 @@ module.exports = class _plots_base extends Canvas {
super({...options, html: html})
this.data = []
- this.linkedWidgets = []
this.rangeX = this.getProp('rangeX') || {min:0,max:1}
this.rangeY = this.getProp('rangeY') || {min:0,max:1}
this.logScaleX = this.getProp('logScaleX')
@@ -33,24 +32,6 @@ module.exports = class _plots_base extends Canvas {
}
this.smooth = this.getProp('smooth') === true ? 0.25 : this.getProp('smooth') === false ? 0 : parseFloat(this.getProp('smooth')) || 0
-
-
- widgetManager.on(`change.${this.hash}`, this.syncHandleProxy.bind(this), this)
-
- }
-
- syncHandleProxy() {
-
- this.syncHandle(...arguments)
-
- }
-
- syncHandle(e) {
-
- if (this.linkedWidgets.indexOf(e.id)==-1 || !widgetManager.getWidgetById(e.id).length) return
- this.updateData()
- this.batchDraw()
-
}
resizeHandle() {
diff --git a/src/browser/js/app/widgets/plots/eq.js b/src/browser/js/app/widgets/plots/eq.js
index 526f44fc..0f33f618 100644
--- a/src/browser/js/app/widgets/plots/eq.js
+++ b/src/browser/js/app/widgets/plots/eq.js
@@ -10,6 +10,7 @@ module.exports = class Eq extends _plots_base {
return {
type:'eq',
id:'auto',
+ linkId:'',
_geometry:'geometry',
@@ -27,12 +28,12 @@ module.exports = class Eq extends _plots_base {
_eq:'eq',
pips:true,
- filters:[],
resolution:128,
rangeY: {min:-20,max:20},
origin: 'auto',
logScaleX: false,
smooth: false,
+ value: '',
_osc:'osc',
@@ -45,6 +46,9 @@ module.exports = class Eq extends _plots_base {
constructor(options) {
+ // backward compat
+ if (options.props.filters && options.props.filters.length) options.props.value = options.props.filters
+
super(options)
this.rangeX = {min:20,max:22050}
@@ -53,45 +57,12 @@ module.exports = class Eq extends _plots_base {
this.resolution = clip(this.getProp('resolution'),[64,1024])
- for (let i in this.getProp('filters')) {
-
- for (let j in this.getProp('filters')[i]) {
- if (typeof this.getProp('filters')[i][j]=='string' && !(j=='type' && this.getProp('filters')[i][j].match(/peak|notch|highpass|highshelf|lowpass|lowshelf/))) {
- this.linkedWidgets.push(this.getProp('filters')[i][j])
- }
- }
-
- }
-
}
- updateData() {
+ setValue(v, options={}) {
- var filters = [],
- eqResponse = []
-
-
- for (let i in this.getProp('filters')) {
- var filter = this.getProp('filters')[i]
-
- filters[i] = {}
-
- for (let j in filter) {
- let widget = widgetManager.getWidgetById(filter[j])
-
- if (typeof filter[j]=='string' && widget.length) {
-
- filters[i][j] = widget[widget.length-1].getValue()
-
- } else {
-
- filters[i][j] = filter[j]
-
- }
-
- }
-
- }
+ var filters = v,
+ eqResponse = []
for (let i in filters) {
@@ -115,7 +86,7 @@ module.exports = class Eq extends _plots_base {
}
- if (eqResponse.length) this.data = eqResponse
+ if (eqResponse.length) super.setValue(eqResponse, options)
}
diff --git a/src/browser/js/app/widgets/plots/image.js b/src/browser/js/app/widgets/plots/image.js
index 52bf9727..01c8d8ed 100644
--- a/src/browser/js/app/widgets/plots/image.js
+++ b/src/browser/js/app/widgets/plots/image.js
@@ -8,6 +8,7 @@ module.exports = class Led extends Widget {
return {
type:'image',
id:'auto',
+ linkId:'',
_geometry:'geometry',
diff --git a/src/browser/js/app/widgets/plots/led.js b/src/browser/js/app/widgets/plots/led.js
index ea24aa23..b695aace 100644
--- a/src/browser/js/app/widgets/plots/led.js
+++ b/src/browser/js/app/widgets/plots/led.js
@@ -9,6 +9,7 @@ module.exports = class Led extends Widget {
return {
type:'led',
id:'auto',
+ linkId:'',
_geometry:'geometry',
@@ -25,7 +26,6 @@ module.exports = class Led extends Widget {
_led:'led',
- widgetId:'',
range:{min:0,max:1},
logScale:false,
value:'',
@@ -41,6 +41,9 @@ module.exports = class Led extends Widget {
constructor(options) {
+ // backward compat
+ if (options.props.widgetId) options.props.value = '@{' + options.props.widgetId + '}'
+
var html = `
@@ -48,28 +51,14 @@ module.exports = class Led extends Widget {
super({...options, html: html})
- if (this.getProp('widgetId').length) widgetManager.on(`change.${this.hash}`, this.syncHandle.bind(this))
-
this.setValue(this.getProp('range').min)
}
- syncHandle(e) {
-
- if (this.getProp('widgetId')!=e.id || !widgetManager.getWidgetById(e.id).length) return
- var widget = widgetManager.getWidgetById(e.id),
- value
- for (var i=widget.length-1; i>=0; i--) {
- if (widget[i].getValue) {
- this.setValue(widget[i].getValue(), {sync: e.options.sync})
- return
- }
- }
-
- }
setValue(v, options={}) {
if (typeof v != 'number') return
+
this.value = v
this.widget.style.setProperty('--opacity', mapToScale(v,[this.getProp('range').min,this.getProp('range').max],[0,1],false,this.getProp('logScale'),true))
diff --git a/src/browser/js/app/widgets/plots/meter.js b/src/browser/js/app/widgets/plots/meter.js
index a1a56f28..6b01eab9 100644
--- a/src/browser/js/app/widgets/plots/meter.js
+++ b/src/browser/js/app/widgets/plots/meter.js
@@ -9,6 +9,7 @@ module.exports = class Meter extends Fader {
return {
type:'fader',
id:'auto',
+ linkId:'',
_geometry:'geometry',
@@ -26,7 +27,6 @@ module.exports = class Meter extends Fader {
_meter:'meter',
- widgetId:'',
range:{min:0,max:1},
logScale:false,
origin:'auto',
@@ -47,6 +47,9 @@ module.exports = class Meter extends Fader {
constructor(options) {
+ // backward compat
+ if (options.props.widgetId) options.props.value = '@{' + options.props.widgetId + '}'
+
options.props.compact = true
options.props.input = false
@@ -56,23 +59,6 @@ module.exports = class Meter extends Fader {
this.off(/drag(.*)?/)
- if (this.getProp('widgetId').length) widgetManager.on(`change.${this.hash}`,this.syncHandle.bind(this))
-
-
- }
-
- syncHandle(e) {
-
- if (this.getProp('widgetId')!=e.id || !widgetManager.getWidgetById(e.id).length) return
- var widget = widgetManager.getWidgetById(e.id),
- value
- for (var i=widget.length-1; i>=0; i--) {
- if (widget[i].getValue) {
- this.setValue(widget[i].getValue(), {sync: e.options.sync})
- return
- }
- }
-
}
sendValue() {
diff --git a/src/browser/js/app/widgets/plots/plot.js b/src/browser/js/app/widgets/plots/plot.js
index 4d88675f..6db9e6ff 100644
--- a/src/browser/js/app/widgets/plots/plot.js
+++ b/src/browser/js/app/widgets/plots/plot.js
@@ -9,6 +9,7 @@ module.exports = class Plot extends _plots_base {
return {
type:'plot',
id:'auto',
+ linkId:'',
_geometry:'geometry',
@@ -25,7 +26,6 @@ module.exports = class Plot extends _plots_base {
_plot:'plot',
- points:[],
rangeX: {min:0,max:1},
rangeY: {min:0,max:1},
origin: 'auto',
@@ -35,6 +35,7 @@ module.exports = class Plot extends _plots_base {
logScaleY: false,
smooth: false,
pips:true,
+ value: '',
_osc:'osc',
@@ -47,56 +48,11 @@ module.exports = class Plot extends _plots_base {
constructor(options) {
+ // backward compat
+ if (options.props.points && options.props.points.length) options.props.value = options.props.points
+
super(options)
- if (typeof this.getProp('points')=='string') {
-
- this.linkedWidgets.push(this.getProp('points'))
-
- } else if (typeof this.getProp('points')=='object') {
-
- for (let i in this.getProp('points')) {
- for (let j in this.getProp('points')[i]) {
- if (typeof this.getProp('points')[i][j] == 'string') {
- this.linkedWidgets.push(this.getProp('points')[i][j])
- }
- }
- }
- }
-
- }
-
- updateData() {
-
- var data = [],
- points = this.getProp('points'),
- widget = widgetManager.getWidgetById(points)
-
- if (typeof points=='string' && widget.length) {
-
- data = widget[widget.length-1].getValue()
-
- } else if (typeof points=='object') {
-
- for (let i in points) {
-
- data[i] = []
-
- for (var k in [0,1]) {
- let widget = widgetManager.getWidgetById(points[i][k])
- if (typeof points[i][k] == 'string' && widget.length) {
- data[i][k] = widget[widget.length-1].getValue()
- } else {
- data[i][k] = points[i][k]
- }
- }
-
- }
-
- }
-
- if (data.length) this.data = data
-
}
}
diff --git a/src/browser/js/app/widgets/plots/rgbled.js b/src/browser/js/app/widgets/plots/rgbled.js
index 4dba26c0..35d62f14 100644
--- a/src/browser/js/app/widgets/plots/rgbled.js
+++ b/src/browser/js/app/widgets/plots/rgbled.js
@@ -10,6 +10,7 @@ module.exports = class Rbgled extends Widget {
return {
type:'rgbled',
id:'auto',
+ linkId:'',
_geometry:'geometry',
@@ -25,7 +26,6 @@ module.exports = class Rbgled extends Widget {
_rgbled:'rgbled',
- widgetId:'',
value:'',
_osc:'osc',
@@ -39,6 +39,10 @@ module.exports = class Rbgled extends Widget {
constructor(options) {
+ // backward compat
+ if (options.props.widgetId) options.props.value = '@{' + options.props.widgetId + '}'
+
+
var html = `
@@ -46,27 +50,11 @@ module.exports = class Rbgled extends Widget {
super({...options, html: html})
- if (this.getProp('widgetId').length) widgetManager.on(`change.${this.hash}`,this.syncHandle.bind(this))
-
this.setValue([0,0,0,0])
}
- syncHandle(e) {
- if (this.getProp('widgetId')!=e.id || !widgetManager.getWidgetById(e.id).length) return
-
- var widget = widgetManager.getWidgetById(e.id),
- value
-
- for (var i=widget.length-1; i>=0; i--) {
- if (widget[i].getValue) {
- this.setValue(widget[i].getValue(), {sync: e.options.sync})
- return
- }
- }
-
- }
setValue(v, options={}) {
var c = ''
diff --git a/src/browser/js/app/widgets/plots/text.js b/src/browser/js/app/widgets/plots/text.js
index bf4f1d11..292fd125 100644
--- a/src/browser/js/app/widgets/plots/text.js
+++ b/src/browser/js/app/widgets/plots/text.js
@@ -9,6 +9,7 @@ module.exports = class Text extends Widget {
return {
type:'text',
id:'auto',
+ linkId:'',
_geometry:'geometry',
@@ -25,7 +26,6 @@ module.exports = class Text extends Widget {
_text: 'text',
- widgetId:'',
vertical:false,
value:'',
@@ -39,6 +39,9 @@ module.exports = class Text extends Widget {
constructor(options) {
+ // backward compat
+ if (options.props.widgetId) options.props.value = '@{' + options.props.widgetId + '}'
+
super({...options, html: '
'})
if (this.getProp('vertical')) this.widget.classList.add('vertical')
@@ -51,25 +54,10 @@ module.exports = class Text extends Widget {
this.value = this.defaultValue
- if (this.getProp('widgetId').length) widgetManager.on(`change.${this.hash}`,this.syncHandle.bind(this))
-
this.setValue(this.value)
}
- syncHandle(e) {
-
- if (this.getProp('widgetId')!=e.id || !widgetManager.getWidgetById(e.id).length) return
- var widget = widgetManager.getWidgetById(e.id),
- value
- for (var i=widget.length-1; i>=0; i--) {
- if (widget[i].getValue) {
- this.setValue(widget[i].getValue(true), {sync: e.options.sync})
- return
- }
- }
-
- }
setValue(v, options={}) {
diff --git a/src/browser/js/app/widgets/plots/visualizer.js b/src/browser/js/app/widgets/plots/visualizer.js
index aa53c697..ea076af2 100644
--- a/src/browser/js/app/widgets/plots/visualizer.js
+++ b/src/browser/js/app/widgets/plots/visualizer.js
@@ -9,6 +9,7 @@ module.exports = class Visualizer extends _plots_base {
return {
type:'visualizer',
id:'auto',
+ linkId:'',
_geometry:'geometry',
@@ -25,7 +26,6 @@ module.exports = class Visualizer extends _plots_base {
_visualizer:'visualizer',
- widgetId:'',
duration:1,
range: {min:0,max:1},
origin: 'auto',
@@ -44,6 +44,9 @@ module.exports = class Visualizer extends _plots_base {
constructor(options) {
+ // backward compat
+ if (options.props.widgetId) options.props.value = '@{' + options.props.widgetId + '}'
+
super(options)
this.fps = 30
@@ -64,13 +67,6 @@ module.exports = class Visualizer extends _plots_base {
}
- syncHandle(e) {
-
- if (this.getProp('widgetId')!=e.id || !widgetManager.getWidgetById(e.id).length || !e.widget) return
- this.setValue(e.widget.getValue(), {sync: e.options.sync})
-
- }
-
startLoop() {
this.clock = new Date().getTime()