events: rename remaining 'sync' to 'change'

This commit is contained in:
jean-emmanuel 2017-07-04 20:36:34 +02:00
parent d7dc96391a
commit 2d4c4588a7
10 changed files with 24 additions and 15 deletions

View file

@ -43,6 +43,9 @@ module.exports.widgets = {
switcher: require('./widgets/switchers/switcher'),
crossfader: require('./widgets/switchers/crossfader'),
// inputs
input: require('./widgets/inputs/input'),
// maths
formula: require('./widgets/maths/formula')
}
@ -55,5 +58,6 @@ module.exports.categories = {
'Plots':['plot','eq','visualizer','led', 'rgbled','meter','text'],
'Containers':['panel','strip','modal'],
'Switchers':['switcher','crossfader'],
'Inputs':['input'],
'Maths':['formula']
}

View file

@ -69,6 +69,9 @@ module.exports = class _canvas_base extends _widgets_base {
this.fontSize = parseFloat(style.getPropertyValue("font-size"))
this.fontFamily = style.getPropertyValue("font-family")
this.textAlign = style.getPropertyValue("text-align")
this.ctx.textBaseline = "middle"
this.ctx.font = this.fontSize + 'px ' + this.fontFamily
this.ctx.textAlign = this.textAlign
}
requestAnimationFrame(this.draw.bind(this))

View file

@ -77,7 +77,7 @@ module.exports = class Formula extends _widgets_base {
this.conditionState = true
$('body').on(`sync.${this.hash}`,this.syncHandle.bind(this))
$('body').on(`change.${this.hash}`,this.syncHandle.bind(this))
this.input.val('...')
@ -85,7 +85,7 @@ module.exports = class Formula extends _widgets_base {
onRemove() {
$('body').off(`sync.${this.hash}`)
$('body').off(`change.${this.hash}`)
super.onRemove()
}

View file

@ -31,7 +31,7 @@ module.exports = class _plots_base extends _canvas_base {
$('body').on(`sync.${this.hash}`,this.syncHandleProxy.bind(this))
$('body').on(`change.${this.hash}`,this.syncHandleProxy.bind(this))
}
@ -43,7 +43,7 @@ module.exports = class _plots_base extends _canvas_base {
onRemove() {
$('body').off(`sync.${this.hash}`)
$('body').off(`change.${this.hash}`)
super.onRemove()
}

View file

@ -46,7 +46,7 @@ module.exports = class Led extends _widgets_base {
super({...options, html: html})
if (this.getProp('widgetId').length) $('body').on(`sync.${this.hash}`,this.syncHandle.bind(this))
if (this.getProp('widgetId').length) $('body').on(`change.${this.hash}`,this.syncHandle.bind(this))
this.setValue(this.getProp('range').min)
@ -54,7 +54,7 @@ module.exports = class Led extends _widgets_base {
onRemove() {
$('body').off(`sync.${this.hash}`)
$('body').off(`change.${this.hash}`)
super.onRemove()
}

View file

@ -55,14 +55,14 @@ module.exports = class Meter extends Fader {
this.canvas.off('draginit drag')
if (this.getProp('widgetId').length) $('body').on(`sync.${this.hash}`,this.syncHandle.bind(this))
if (this.getProp('widgetId').length) $('body').on(`change.${this.hash}`,this.syncHandle.bind(this))
}
onRemove() {
$('body').off(`sync.${this.hash}`)
$('body').off(`change.${this.hash}`)
super.onRemove()
}

View file

@ -43,7 +43,7 @@ module.exports = class Led extends _widgets_base {
super({...options, html: html})
if (this.getProp('widgetId').length) $('body').on(`sync.${this.hash}`,this.syncHandle.bind(this))
if (this.getProp('widgetId').length) $('body').on(`change.${this.hash}`,this.syncHandle.bind(this))
this.setValue([0,0,0,0])
@ -51,7 +51,7 @@ module.exports = class Led extends _widgets_base {
onRemove() {
$('body').off(`sync.${this.hash}`)
$('body').off(`change.${this.hash}`)
super.onRemove()
}

View file

@ -48,7 +48,7 @@ module.exports = class Text extends _widgets_base {
this.value = this.defaultValue
if (this.getProp('widgetId').length) $('body').on(`sync.${this.hash}`,this.syncHandle.bind(this))
if (this.getProp('widgetId').length) $('body').on(`change.${this.hash}`,this.syncHandle.bind(this))
this.setValue(this.value)
@ -56,7 +56,7 @@ module.exports = class Text extends _widgets_base {
onRemove() {
$('body').off(`sync.${this.hash}`)
$('body').off(`change.${this.hash}`)
super.onRemove()
}

View file

@ -20,7 +20,7 @@ module.exports = class _switchers_base extends _widgets_base {
}
$('body').on(`sync.${this.hash}`,this.syncHandler.bind(this))
$('body').on(`change.${this.hash}`,this.syncHandler.bind(this))
}
@ -40,7 +40,7 @@ module.exports = class _switchers_base extends _widgets_base {
onRemove() {
$('body').off(`sync.${this.hash}`)
$('body').off(`change.${this.hash}`)
super.onRemove()
}

View file

@ -48,7 +48,7 @@
color:var(--color-accent);
}
}
.input {
.Xinput {
width:100%;
height:24rem;
border:0;
@ -113,4 +113,6 @@
@import 'widgets/panel';
@import 'widgets/inputs';
@import 'widgets/maths';