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

Wrong calculation of handler positions and restoration of value from handler position #10

Open
Moes81 opened this issue Apr 19, 2013 · 2 comments
Assignees

Comments

@Moes81
Copy link

Moes81 commented Apr 19, 2013

Thanks for this control! I'm using it in two Enterprise apps extensively! Also loved the vertical possibility! :-)

But, I recognized a calculation issue, when the minValue of the scale is not set to 0. The handler positions are not relative to the represented sector but absolut to the span.

Try: minValue = 10, maxValue = 30 and move Slider to positions 15 and 28. You should instantly see, what I mean.

However, I'm not just complaining, but I have also the solution :-)

In moveSliderToPosition calculate the handler center like so:
CGPointMake(sliderBarWidth * ([leftSlider floatValue] - minValue) / (maxValue - minValue), sliderBarHeight * 0.5);

And in the updateValues do the following:
self.minSelectedValue = _minValue + (self.minHandle.center.x * (_maxValue - _minValue) / sliderBarWidth);

Regards,
Moes

@ghost ghost assigned doukasd Apr 23, 2013
@doukasd
Copy link
Owner

doukasd commented Apr 23, 2013

Thanks for the appreciation - great to hear people find this useful - and for the solution! Not sure when I'll be able to add these changes back into the project so you can show your appreciation further with a pull request ;)

Kindest regards,
Dimitris

@akainth
Copy link

akainth commented May 27, 2015

@Moes81 facing same problem with right slider ,Please help me to resolve ....Thanks

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

3 participants