Merge pull request #1380 from umap-project/range-step-rounding
Round range step to 1 digit
This commit is contained in:
commit
9eea9f942d
1 changed files with 1 additions and 1 deletions
|
@ -856,7 +856,7 @@ L.FormBuilder.Range = L.FormBuilder.FloatInput.extend({
|
||||||
this.input.setAttribute('list', datalist.id)
|
this.input.setAttribute('list', datalist.id)
|
||||||
let options = ''
|
let options = ''
|
||||||
const step = this.options.step || 1,
|
const step = this.options.step || 1,
|
||||||
digits = step < 1 ? 2 : 0
|
digits = step < 1 ? 1 : 0
|
||||||
for (let i = this.options.min; i <= this.options.max; i += this.options.step) {
|
for (let i = this.options.min; i <= this.options.max; i += this.options.step) {
|
||||||
options += `<option value="${i.toFixed(digits)}" label="${i.toFixed(digits)}"></option>`
|
options += `<option value="${i.toFixed(digits)}" label="${i.toFixed(digits)}"></option>`
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue