Skip to content

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

Description

@Moes81

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

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions