You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Descrepencies when trying to set current Values of the slider.
I have set following values: maxRotationAngle: 270, minimumValue: 50.0, maximumValue: 90.0, currentValue = 62, programmatically.
When I query the currentValue it returns me 21.8.... and when I query the angle it gives 147.
My calculations are: when starting from Minimum, when reaching 70(middle of max and min) currentValue the angle should be 270/2= 135. So, for 62 angle should be less than 135.
Could you please correct me if I am missing something or provide a fix if this is not working fine?
This is urgent request.
The slider works great, for changing the slider value on UI.
The text was updated successfully, but these errors were encountered:
I haven't had the time to maintain this framework, unfortunately. I did have a look for you nonetheless, and it does seem to be a bug.
Basically, the currentValue and angle setters use two internal conversion functions valueFrom(angle) and angleFrom(value). I seem to have not accounted for the minimumValue being non-zero.
Since you urgently need this fixed, change the functions (at the bottom of the MSCircularSlider.swift file) to the following and it should work as expected:
/** Calculates the angle from north given a value */
internalfunc angleFrom(value:Double)->CGFloat{
// added "- minimumValue" to the numerator
return(CGFloat(value - minimumValue)* maximumAngle)/ CGFloat(maximumValue - minimumValue)}
/** Calculates the value given an angle from north */
internalfunc valueFrom(angle:CGFloat)->Double{
// added "+ minimumValue"
return(maximumValue - minimumValue)* Double(angle)/ Double(maximumAngle)+ minimumValue
}
I will try to update the pod and the repo accordingly within the week, just need to make sure this actually works for other edge-cases.
If you have the time to apply this and test it properly, please fork the repo and submit a PR, you'll be added as a contributor.
I am unable to create a new PR as code is same.
The changes are fine for all the conditions.
I tried with different maximum angles - 90,180,270,360 and different minimum and maximum values.
Changing the values in UI and programmatically to the slider looks fine.
Descrepencies when trying to set current Values of the slider.
I have set following values: maxRotationAngle: 270, minimumValue: 50.0, maximumValue: 90.0, currentValue = 62, programmatically.
When I query the currentValue it returns me 21.8.... and when I query the angle it gives 147.
My calculations are: when starting from Minimum, when reaching 70(middle of max and min) currentValue the angle should be 270/2= 135. So, for 62 angle should be less than 135.
Could you please correct me if I am missing something or provide a fix if this is not working fine?
This is urgent request.
The slider works great, for changing the slider value on UI.
The text was updated successfully, but these errors were encountered: