mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-15 20:35:19 +03:00
Couple of improvements
- better handling of negative numbers - improved regex pattern - limits to min and max values
This commit is contained in:
parent
43b69d434a
commit
30317ede79
2 changed files with 24 additions and 7 deletions
14
main.js
14
main.js
|
@ -651,8 +651,18 @@ String.prototype.format = function () {
|
|||
|
||||
function padZeros(val, length) {
|
||||
let str = val.toString();
|
||||
return str.length < length ? padZeros("0" + str, length) : str;
|
||||
};
|
||||
|
||||
if (str.length < length) {
|
||||
if (str.charAt(0) === '-') {
|
||||
str = "-0" + str.substring(1);
|
||||
str = padZeros(str, length);
|
||||
} else {
|
||||
str = padZeros("0" + str, length);
|
||||
}
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
function updateActivatedTab() {
|
||||
var activeTab = $('#tabs > ul li.active');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue