maths: rename math to formula

This commit is contained in:
jean-emmanuel 2017-01-24 09:20:51 +01:00
parent 27a0f31ff4
commit dcc61236ac
4 changed files with 14 additions and 8 deletions

View file

@ -4,13 +4,13 @@ Maths do the maths !
----
## Math
## Formula
Math evaluates mathematical expressions over other widgets' values each one of these widgets changes.
Formula evaluates mathematical expressions over other widgets' values each one of these widgets changes.
```js
{
type:'math',
type:'formula',
// etc
}
```

View file

@ -37,7 +37,7 @@ var widgets = {
crossfader: require('./widgets/switchers/crossfader'),
// maths
math: require('./widgets/maths/math')
formula: require('./widgets/maths/formula')
}
module.exports.categories = {
@ -48,7 +48,7 @@ module.exports.categories = {
'Plots':['plot','eq','visualizer','led','meter','text'],
'Containers':['panel','strip','modal'],
'Switchers':['switcher','crossfader'],
'Maths':['math']
'Maths':['formula']
}
module.exports.widgetOptions = function(){

View file

@ -2,7 +2,7 @@ var _widgets_base = require('../common/_widgets_base'),
{widgetManager} = require('../../managers')
module.exports = class Math extends _widgets_base {
module.exports = class Formula extends _widgets_base {
static options() {
@ -81,8 +81,7 @@ module.exports = class Math extends _widgets_base {
this.value = eval(formula)
this.input.val(typeof this.value != 'object' ? this.value.toFixed(this.widgetData.precision) : this.value.map((a)=>{return a.toFixed(this.widgetData.precision)}))
this.showValue()
if (e.options.sync) this.widget.trigger({type: 'sync',id: this.widgetData.id,widget: this.widget, linkId: this.widgetData.linkId, options: e.options})
if (e.options.send) this.sendValue(this.value)
@ -94,4 +93,11 @@ module.exports = class Math extends _widgets_base {
}
showValue() {
this.input.val(typeof this.value != 'object' ? this.value.toFixed(this.widgetData.precision) : this.value.map((a)=>{return a.toFixed(this.widgetData.precision)}))
}
}