fix (core) fix rounding in count sampling. add tests
This commit is contained in:
parent
8ccab0df21
commit
c6d4fc3aea
4 changed files with 132 additions and 185 deletions
|
@ -193,6 +193,7 @@ PatternSampler.prototype.__optionSets = function (optionName) {
|
|||
}
|
||||
step = (option.max / factor - val) / stepFactor
|
||||
const base = this.__setBase()
|
||||
const roundVal = typeof option.count !== 'undefined' || typeof option.mm !== 'undefined'
|
||||
for (let run = 1; run <= numberRuns; run++) {
|
||||
const settings = {
|
||||
...base,
|
||||
|
@ -202,11 +203,9 @@ PatternSampler.prototype.__optionSets = function (optionName) {
|
|||
idPrefix: `sample-${run}`,
|
||||
partClasses: `sample-${run}`,
|
||||
}
|
||||
settings.options[optionName] = val
|
||||
settings.options[optionName] = roundVal ? Math.ceil(val) : val
|
||||
sets.push(settings)
|
||||
val += step
|
||||
if (typeof option.count !== 'undefined' || typeof option.mm !== 'undefined')
|
||||
val = Math.round(val)
|
||||
}
|
||||
|
||||
return sets
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue