Open Robyt3 opened 3 years ago
My use case is this:
folder.add(settings, 'numColors').min(1).max(101).step(2).name('Number of colors');
where I want the number of colors to be an odd number.
Once I change the slider in the GUI thou, the number will be changed to an even number.
This appears to be the relevant code segment:
https://github.com/dataarts/dat.gui/blob/51d1a37b00326c232f34d9b80dc6dea2bec8595b/src/dat/controllers/NumberController.js#L71-L73
The _v % this.__step !== 0 checks the parity of the value, which should take into account if the minimum/maximum value has a different parity.
_v % this.__step !== 0
My use case is this:
folder.add(settings, 'numColors').min(1).max(101).step(2).name('Number of colors');
where I want the number of colors to be an odd number.
Once I change the slider in the GUI thou, the number will be changed to an even number.
This appears to be the relevant code segment:
https://github.com/dataarts/dat.gui/blob/51d1a37b00326c232f34d9b80dc6dea2bec8595b/src/dat/controllers/NumberController.js#L71-L73
The
_v % this.__step !== 0
checks the parity of the value, which should take into account if the minimum/maximum value has a different parity.