events: rename sync to change
This commit is contained in:
parent
f4c0656577
commit
d7dc96391a
20 changed files with 33 additions and 30 deletions
|
|
@ -13,7 +13,7 @@ var WidgetManager = function(){
|
|||
this.preArgsSeparator = '||||'
|
||||
|
||||
$(document).ready(()=>{
|
||||
$('body').off('sync.global').on('sync.global',(e)=>{
|
||||
$('body').off('change.global').on('change.global',(e)=>{
|
||||
|
||||
var {id, widget, linkId, fromExternal, options} = e,
|
||||
widgetsById = this.getWidgetById(id),
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ Osc.prototype.send = function(data) {
|
|||
|
||||
Osc.prototype.sync = function(data) {
|
||||
|
||||
ipc.send('syncOsc', data)
|
||||
ipc.send('changeOsc', data)
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,12 +65,12 @@ module.exports = class Dropdown extends _widgets_base {
|
|||
this.value = this.values[i]
|
||||
if (!options.fromLocal) this.select[0].selectedIndex = i
|
||||
if (options.send) this.sendValue()
|
||||
if (options.sync) this.widget.trigger({type:'sync',id:this.getProp('id'),widget:this.widget, linkId:this.getProp('linkId'), options})
|
||||
if (options.sync) this.widget.trigger({type:'change',id:this.getProp('id'),widget:this.widget, linkId:this.getProp('linkId'), options})
|
||||
this.container.removeClass('noselect')
|
||||
} else {
|
||||
this.value = undefined
|
||||
this.select[0].selectedIndex = -1
|
||||
if (options.sync) this.widget.trigger({type:'sync',id:this.getProp('id'),widget:this.widget, linkId:this.getProp('linkId'), options})
|
||||
if (options.sync) this.widget.trigger({type:'change',id:this.getProp('id'),widget:this.widget, linkId:this.getProp('linkId'), options})
|
||||
this.container.addClass('noselect')
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -83,14 +83,14 @@ module.exports = class Push extends _widgets_base {
|
|||
this.lastChanged = 'active'
|
||||
this.updateValue()
|
||||
if (options.send) this.sendValue(v)
|
||||
if (options.sync) this.widget.trigger({type:'sync',id:this.getProp('id'),widget:this.widget, linkId:this.getProp('linkId'), options:options})
|
||||
if (options.sync) this.widget.trigger({type:'change',id:this.getProp('id'),widget:this.widget, linkId:this.getProp('linkId'), options:options})
|
||||
} else if (v===this.getProp('off') || (this.getProp('off') != null && v === this.getProp('off').value && v !== undefined)) {
|
||||
this.widget.removeClass('active')
|
||||
this.active = 0
|
||||
this.lastChanged = 'active'
|
||||
this.updateValue()
|
||||
if (options.send) this.sendValue(v, this.getProp('norelease'))
|
||||
if (options.sync) this.widget.trigger({type:'sync',id:this.getProp('id'),widget:this.widget, linkId:this.getProp('linkId'), options:options})
|
||||
if (options.sync) this.widget.trigger({type:'change',id:this.getProp('id'),widget:this.widget, linkId:this.getProp('linkId'), options:options})
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -107,13 +107,13 @@ module.exports = class Push extends _widgets_base {
|
|||
this.state = 1
|
||||
if (options.send) this.sendValue(v)
|
||||
this.lastChanged = 'state'
|
||||
if (options.sync) this.widget.trigger({type:'sync',id:this.getProp('id'),widget:this.widget, linkId:this.getProp('linkId'),options:options})
|
||||
if (options.sync) this.widget.trigger({type:'change',id:this.getProp('id'),widget:this.widget, linkId:this.getProp('linkId'),options:options})
|
||||
} else if (v===this.getProp('off') || (this.getProp('off') != null && v === this.getProp('off').value && v !== undefined)) {
|
||||
this.widget.removeClass('on')
|
||||
this.state = 0
|
||||
if (options.send) this.sendValue(v)
|
||||
this.lastChanged = 'state'
|
||||
if (options.sync) this.widget.trigger({type:'sync',id:this.getProp('id'),widget:this.widget, linkId:this.getProp('linkId'),options:options})
|
||||
if (options.sync) this.widget.trigger({type:'change',id:this.getProp('id'),widget:this.widget, linkId:this.getProp('linkId'),options:options})
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,11 +75,11 @@ module.exports = class Switch extends _widgets_base {
|
|||
this.widget.find('.on').removeClass('on')
|
||||
this.widget.find('.value').eq(i).addClass('on')
|
||||
if (options.send) this.sendValue(this.value)
|
||||
if (options.sync) this.widget.trigger({type:'sync',id:this.getProp('id'),widget:this.widget, linkId:this.getProp('linkId'), options})
|
||||
if (options.sync) this.widget.trigger({type:'change',id:this.getProp('id'),widget:this.widget, linkId:this.getProp('linkId'), options})
|
||||
} else {
|
||||
this.widget.find('.on').removeClass('on')
|
||||
this.value = undefined
|
||||
if (options.sync) this.widget.trigger({type:'sync',id:this.getProp('id'),widget:this.widget, linkId:this.getProp('linkId'), options})
|
||||
if (options.sync) this.widget.trigger({type:'change',id:this.getProp('id'),widget:this.widget, linkId:this.getProp('linkId'), options})
|
||||
}
|
||||
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ module.exports = class Toggle extends _widgets_base {
|
|||
if (options.send) this.sendValue()
|
||||
}
|
||||
|
||||
if (options.sync) this.widget.trigger({type:'sync',id:this.getProp('id'),widget:this.widget, linkId:this.getProp('linkId'), options})
|
||||
if (options.sync) this.widget.trigger({type:'change',id:this.getProp('id'),widget:this.widget, linkId:this.getProp('linkId'), options})
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,6 +66,9 @@ module.exports = class _canvas_base extends _widgets_base {
|
|||
this.colors.fg = style.getPropertyValue('--color-fg')
|
||||
this.colors.faded = style.getPropertyValue('--color-faded')
|
||||
this.colors.light = style.getPropertyValue('--color-light')
|
||||
this.fontSize = parseFloat(style.getPropertyValue("font-size"))
|
||||
this.fontFamily = style.getPropertyValue("font-family")
|
||||
this.textAlign = style.getPropertyValue("text-align")
|
||||
}
|
||||
|
||||
requestAnimationFrame(this.draw.bind(this))
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ module.exports = class Modal extends Panel {
|
|||
if (!this.init && this.value) this.init = true
|
||||
|
||||
if (options.send) this.sendValue()
|
||||
if (options.sync) this.light.trigger({type:'sync',id:this.getProp('id'),widget:this.widget, linkId:this.getProp('linkId'), options})
|
||||
if (options.sync) this.light.trigger({type:'change',id:this.getProp('id'),widget:this.widget, linkId:this.getProp('linkId'), options})
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ module.exports = class Panel extends _widgets_base {
|
|||
$(window).resize()
|
||||
|
||||
if (options.send) this.sendValue()
|
||||
if (options.sync) this.widget.trigger({type:'sync',id:this.getProp('id'),widget:this.widget, linkId:this.getProp('linkId'), options})
|
||||
if (options.sync) this.widget.trigger({type:'change',id:this.getProp('id'),widget:this.widget, linkId:this.getProp('linkId'), options})
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ module.exports = class Tab extends Panel {
|
|||
|
||||
var $body = $('body')
|
||||
|
||||
this.widget.on('sync.detached', (e)=>{
|
||||
this.widget.on('change.detached', (e)=>{
|
||||
if (this.detached) $body.trigger(e)
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ module.exports = class Formula extends _widgets_base {
|
|||
|
||||
this.showValue()
|
||||
|
||||
if (e.options.sync && this.conditionState) this.widget.trigger({type: 'sync',id: this.getProp('id'),widget: this.widget, linkId: this.getProp('linkId'), options: e.options})
|
||||
if (e.options.sync && this.conditionState) this.widget.trigger({type: 'change',id: this.getProp('id'),widget: this.widget, linkId: this.getProp('linkId'), options: e.options})
|
||||
if (e.options.send && this.conditionState) this.sendValue()
|
||||
|
||||
} catch(err) {
|
||||
|
|
|
|||
|
|
@ -10,11 +10,11 @@ module.exports = class _matrices_base extends _widgets_base {
|
|||
|
||||
this.start = parseInt(this.getProp('start'))
|
||||
|
||||
this.widget.on('sync',(e)=>{
|
||||
this.widget.on('change',(e)=>{
|
||||
|
||||
if (e.id==this.getProp('id')) return
|
||||
this.value[e.widget.parent().index()] = e.widget.abstract.getValue()
|
||||
this.widget.trigger({type:'sync',id:this.getProp('id'),widget:this.widget,options:e.options})
|
||||
this.widget.trigger({type:'change',id:this.getProp('id'),widget:this.widget,options:e.options})
|
||||
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ module.exports = class MultiXy extends _pads_base {
|
|||
|
||||
})
|
||||
|
||||
this.wrapper.on('sync',(e)=>{
|
||||
this.wrapper.on('change',(e)=>{
|
||||
e.stopPropagation()
|
||||
this.setValue(this.getValue(), e.options)
|
||||
})
|
||||
|
|
@ -247,7 +247,7 @@ module.exports = class MultiXy extends _pads_base {
|
|||
}
|
||||
|
||||
if (options.send) this.sendValue()
|
||||
if (options.sync) this.widget.trigger({type:'sync', id:this.getProp('id'),widget:this.widget, linkId:this.getProp('linkId'), options:options})
|
||||
if (options.sync) this.widget.trigger({type:'change', id:this.getProp('id'),widget:this.widget, linkId:this.getProp('linkId'), options:options})
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -112,11 +112,11 @@ module.exports = class Rgb extends _pads_base {
|
|||
|
||||
this.hueWrapper.append(this.faders.h.widget)
|
||||
|
||||
this.wrapper.on('sync',(e)=>{
|
||||
this.wrapper.on('change',(e)=>{
|
||||
e.stopPropagation()
|
||||
})
|
||||
|
||||
this.faders.h.widget.on('sync',(e)=>{
|
||||
this.faders.h.widget.on('change',(e)=>{
|
||||
e.stopPropagation()
|
||||
this.dragHandle(true)
|
||||
})
|
||||
|
|
@ -185,7 +185,7 @@ module.exports = class Rgb extends _pads_base {
|
|||
this.value = v
|
||||
|
||||
if (options.send) this.sendValue()
|
||||
if (options.sync) this.widget.trigger({type:'sync', id:this.getProp('id'),widget:this.widget, linkId:this.getProp('linkId'), options:options})
|
||||
if (options.sync) this.widget.trigger({type:'change', id:this.getProp('id'),widget:this.widget, linkId:this.getProp('linkId'), options:options})
|
||||
|
||||
this.update({dragged:options.dragged, nohue:options.nohue || (v[0]==v[1]&&v[1]==v[2])})
|
||||
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ module.exports = class Xy extends _pads_base {
|
|||
this.wrapper.append(this.faders.x.widget)
|
||||
this.wrapper.append(this.faders.y.widget)
|
||||
|
||||
this.wrapper.on('sync',(e)=>{
|
||||
this.wrapper.on('change',(e)=>{
|
||||
e.stopPropagation()
|
||||
})
|
||||
|
||||
|
|
@ -177,7 +177,7 @@ module.exports = class Xy extends _pads_base {
|
|||
]
|
||||
|
||||
if (options.send) this.sendValue()
|
||||
if (options.sync) this.widget.trigger({type:'sync', id:this.getProp('id'),widget:this.widget, linkId:this.getProp('linkId'), options:options})
|
||||
if (options.sync) this.widget.trigger({type:'change', id:this.getProp('id'),widget:this.widget, linkId:this.getProp('linkId'), options:options})
|
||||
|
||||
this.draw()
|
||||
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ module.exports = class _sliders_base extends _canvas_base {
|
|||
|
||||
this.showValue()
|
||||
|
||||
if (options.sync) this.widget.trigger({type:'sync',id:this.getProp('id'),widget:this.widget, linkId:this.getProp('linkId'), options:options})
|
||||
if (options.sync) this.widget.trigger({type:'change',id:this.getProp('id'),widget:this.widget, linkId:this.getProp('linkId'), options:options})
|
||||
if (options.send) this.sendValue(v)
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ module.exports = class Encoder extends _widgets_base {
|
|||
|
||||
this.previousValue = this.ticks/2
|
||||
|
||||
this.wrapper.on('sync',(e)=>{
|
||||
this.wrapper.on('change',(e)=>{
|
||||
e.stopPropagation()
|
||||
|
||||
var value = this.knob.getValue()
|
||||
|
|
@ -199,7 +199,7 @@ module.exports = class Encoder extends _widgets_base {
|
|||
|
||||
}
|
||||
|
||||
if (options.sync && match) this.widget.trigger({type:'sync',id:this.getProp('id'),widget:this.widget, linkId:this.getProp('linkId'), options:options})
|
||||
if (options.sync && match) this.widget.trigger({type:'change',id:this.getProp('id'),widget:this.widget, linkId:this.getProp('linkId'), options:options})
|
||||
if (options.send && match && !(!this.getProp('snap') && options.draginit)) this.sendValue()
|
||||
|
||||
if (options.dragged || options.draginit) this.updateDisplay(options.draginit)
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ module.exports = class _switchers_base extends _widgets_base {
|
|||
}
|
||||
}
|
||||
|
||||
if (options.sync) this.widget.trigger({type:'sync',id:this.getProp('id'),widget:this.widget, linkId:this.getProp('linkId'), options:options})
|
||||
if (options.sync) this.widget.trigger({type:'change',id:this.getProp('id'),widget:this.widget, linkId:this.getProp('linkId'), options:options})
|
||||
if (options.send) this.sendValue()
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ module.exports = class Crossfader extends Switcher {
|
|||
|
||||
this.widget.append($('<div class="fader-container"></div>').append(this.fader.widget))
|
||||
|
||||
this.fader.widget.on('sync', (e)=>{
|
||||
this.fader.widget.on('change', (e)=>{
|
||||
|
||||
e.stopPropagation()
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ module.exports = class Switcher extends _switchers_base {
|
|||
|
||||
this.widget.append(this.switch.widget)
|
||||
|
||||
this.switch.widget.on('sync', (e)=>{
|
||||
this.switch.widget.on('change', (e)=>{
|
||||
|
||||
e.stopPropagation()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue