Merge pull request #125 from hppeng-wynn/round-fix

Fix rounding for scaling IDs
This commit is contained in:
hppeng-wynn 2022-07-13 12:44:14 -07:00 committed by GitHub
commit 64d55a71da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -728,7 +728,7 @@ const atree_stats = new (class extends ComputeNode {
if (effect.slider) {
if ('output' in effect) { // sometimes nodes will modify slider without having effect.
const slider_val = interactive_map.get(effect.slider_name).slider.value;
let total = parseInt(slider_val) * effect.scaling[0];
let total = Math.floor(round_near(parseInt(slider_val) * effect.scaling[0]));
if ('max' in effect && total > effect.max) { total = effect.max; }
if (Array.isArray(effect.output)) {
for (const output of effect.output) {