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

Negative floating point range initialises incorrectly #52

Open
GoogleCodeExporter opened this issue Nov 4, 2015 · 0 comments
Open

Negative floating point range initialises incorrectly #52

GoogleCodeExporter opened this issue Nov 4, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

Steps to reproduce:

1. Add a new control with a range -1 to 1
2. Set the property value it binds to as a negative number (i.e. -0.55)

What's happening:
The range will be in increments of 1 between -1 and 1 but should be a floating 
point increment between that range. It will also show the current value as -1.

How to fix:
Sorry, just thought it was easier to provide the fix as it's a one liner and 
easier for the owners to add rather than me cloning the repo :)
Basically in the NumberController there is a line to init the impliedStep that 
looks like this:

this.__impliedStep = Math.pow(10, 
Math.floor(Math.log(this.initialValue)/Math.LN10))/10;


but should be this (to correctly account for the log of a negative number:

this.__impliedStep = Math.abs(Math.pow(10, 
Math.floor(Math.log(Math.abs(this.initialValue)) / Math.LN10)) / 10);


This change is working well for me and hope it helps in some small way :)

Thanks for the library too!




Original issue reported on code.google.com by [email protected] on 14 Aug 2014 at 11:25

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

No branches or pull requests

1 participant