1
0
Fork 0

fix (core) fix rounding in count sampling. add tests

This commit is contained in:
Enoch Riese 2023-04-19 11:30:32 -04:00
parent 8ccab0df21
commit c6d4fc3aea
4 changed files with 132 additions and 185 deletions

View file

@ -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