widgets: properly store/clamp precision when = 0

This commit is contained in:
jean-emmanuel 2017-06-21 14:33:33 +02:00
parent c837cb931f
commit 7eab08b340
2 changed files with 7 additions and 7 deletions

View file

@ -48,7 +48,7 @@ var WidgetManager = function(){
ipc.send('addWidget', {
hash:hash,
data:{
precision: this.widgets[hash].getProp('precision'),
precision: this.widgets[hash].precision,
preArgs: this.widgets[hash].getProp('preArgs'),
split: this.widgets[hash].split,
target: this.widgets[hash].getProp('target'),
@ -106,7 +106,7 @@ WidgetManager.prototype.addWidget = function(widget) {
ipc.send('addWidget', {
hash:hash,
data:{
precision: widget.getProp('precision'),
precision: widget.precision,
preArgs: widget.getProp('preArgs'),
split: widget.split,
target: widget.getProp('target'),

View file

@ -36,11 +36,6 @@ module.exports = class _widgets_base {
this.props.target = [this.props.target]
}
// limit precision
if (this.props.precision) {
this.precision = Math.min(20,Math.max(this.resolveProp('precision', undefined, false),0))
}
// strip parent ? no position
if (this.parent && this.parent.props.type == 'strip') {
delete this.props.top
@ -73,6 +68,11 @@ module.exports = class _widgets_base {
$('body').trigger('widget-created', this.getProp('id'))
// cache precision
if (this.props.precision != undefined) {
this.precision = Math.min(20,Math.max(this.getProp('precision', undefined, false),0))
}
}
sendValue(overrides) {