Skip to content

Commit

Permalink
Merge pull request #1432 from iNavFlight/MrD-automatically-set-min-an…
Browse files Browse the repository at this point in the history
…d-max-for-numbers

Adds min and max limits to all numerical fields
  • Loading branch information
DzikuVx authored Jan 25, 2022
2 parents cc0d987 + 394aa18 commit 2d4eca6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ var Settings = (function () {
var multiplier = parseFloat(input.data('setting-multiplier') || 1);
input.attr('type', 'number');
input.val((s.value / multiplier).toFixed(Math.log10(multiplier)));

if (s.setting.min) {
input.attr('min', (s.setting.min / multiplier).toFixed(Math.log10(multiplier)));
}

if (s.setting.max) {
input.attr('max', (s.setting.max / multiplier).toFixed(Math.log10(multiplier)));
}
}

// If data is defined, We want to convert this value into
Expand Down

0 comments on commit 2d4eca6

Please sign in to comment.