Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Step should be based on the minimum and or maximum values #291

Open
Robyt3 opened this issue Apr 4, 2021 · 0 comments
Open

Step should be based on the minimum and or maximum values #291

Robyt3 opened this issue Apr 4, 2021 · 0 comments

Comments

@Robyt3
Copy link

Robyt3 commented Apr 4, 2021

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:

if (this.__step !== undefined && _v % this.__step !== 0) {
_v = Math.round(_v / this.__step) * this.__step;
}

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant