Don't cap setting values when manually entered by user

This commit is contained in:
Gnome Ann 2022-05-28 18:33:57 -04:00
parent 6e0510e1f5
commit 69a28210e9
2 changed files with 10 additions and 4 deletions

View File

@ -175,18 +175,24 @@ function addSetting(ob) {
// Add event function to input // Add event function to input
var send = function () { var send = function () {
sliders_throttle(ob.id, 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) { reflb.on("change", function (event) {
var value = (ob.unit === "float" ? parseFloat : parseInt)(event.target.value); var value = (ob.unit === "float" ? parseFloat : parseInt)(event.target.value);
if(Number.isNaN(value) || value > ob.max || value < ob.min) { if(Number.isNaN(value) || value > ob.max || value < ob.min) {
event.target.value = refin.val(); event.target.value = refin.val();
return; 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); refin.val(value);
reflb.val(value);
send(); send();
}); });
} else if(ob.uitype == "toggle"){ } else if(ob.uitype == "toggle"){

View File

@ -17,7 +17,7 @@
<script src="static/bootstrap.min.js"></script> <script src="static/bootstrap.min.js"></script>
<script src="static/bootstrap-toggle.min.js"></script> <script src="static/bootstrap-toggle.min.js"></script>
<script src="static/rangy-core.min.js"></script> <script src="static/rangy-core.min.js"></script>
<script src="static/application.js?ver=1.17e"></script> <script src="static/application.js?ver=1.17f"></script>
</head> </head>
<body> <body>
<input type="file" id="remote-save-select" accept="application/json" style="display:none"> <input type="file" id="remote-save-select" accept="application/json" style="display:none">