From 69a28210e967ba951386d2ceeb271dddd3004326 Mon Sep 17 00:00:00 2001 From: Gnome Ann <> Date: Sat, 28 May 2022 18:33:57 -0400 Subject: [PATCH] Don't cap setting values when manually entered by user --- static/application.js | 12 +++++++++--- templates/index.html | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/static/application.js b/static/application.js index 63f804a3..c1e37b4e 100644 --- a/static/application.js +++ b/static/application.js @@ -175,18 +175,24 @@ function addSetting(ob) { // Add event function to input var send = function () { sliders_throttle(ob.id, function () { - socket.send({'cmd': $(refin).attr('id'), 'data': $(refin).val()}); + socket.send({'cmd': $(refin).attr('id'), 'data': $(reflb).val()}); }); - reflb.val($(refin).val()); } - refin.on("input", send); + refin.on("input", function (event) { + reflb.val(refin.val()); + send(); + }); reflb.on("change", function (event) { var value = (ob.unit === "float" ? parseFloat : parseInt)(event.target.value); if(Number.isNaN(value) || value > ob.max || value < ob.min) { event.target.value = refin.val(); return; } + if (ob.unit === "float") { + value = parseFloat(value.toFixed(3)); // Round to 3 decimal places to help avoid the number being too long to fit in the box + } refin.val(value); + reflb.val(value); send(); }); } else if(ob.uitype == "toggle"){ diff --git a/templates/index.html b/templates/index.html index 92b70753..16b47c6d 100644 --- a/templates/index.html +++ b/templates/index.html @@ -17,7 +17,7 @@ - +