From 557cf4620a7d9397176461cb75ad11ff34c419ee Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Thu, 3 Nov 2016 23:48:39 +0100 Subject: [PATCH] osc: apply widget's precision at send time --- app/main/osc.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/main/osc.js b/app/main/osc.js index 2fbe10a2..70c96a46 100644 --- a/app/main/osc.js +++ b/app/main/osc.js @@ -32,7 +32,7 @@ var parseArg = function(arg,precision){ if (arg==null) return null switch (typeof arg) { case 'number': - return {type: precision == 0 ? 'i' : 'f', value: arg} + return {type: precision == 0 ? 'i' : 'f', value: parseFloat(arg.toFixed(Math.min(precision,20)))} case 'boolean': return {type: arg ? 'T' : 'F', value: arg} case 'object': @@ -104,7 +104,7 @@ var oscOutFilter = function(data){ var oscInHandler = function(msg, timetag, info){ var data = oscInFilter({address: msg.address, args: msg.args, host: info.address, port: info.port}) for (i in data.args) { - data.args[i] = data.args[i].value + data.args[i] = data.args[i].value } receiveOsc(data) }