Closed huuthanhla closed 5 years ago
Hi @thanhlazio, thanks for your contribution, I'm not sure that it will be a good idea, to make all this properties public, can you give an example/ usecase of this need ?
Hi @HamzaGhazouani I need to track slider in min and max range, like this:
override func newValue(from oldValue: CGFloat, touch touchPosition: CGPoint, start startPosition: CGPoint) -> CGFloat {
let angle = CircularSliderHelper.angle(betweenFirstPoint: startPosition, secondPoint: touchPosition, inCircleWithCenter: bounds.center)
let interval = Interval(min: minimumValue, max: maximumValue, rounds: numberOfRounds)
let deltaValue = CircularSliderHelper.delta(in: interval, for: angle, oldValue: oldValue)
var newValue = oldValue + deltaValue
// let range = maximumValue - minimumValue
//
// if newValue > maximumValue {
// newValue -= range
// }
// else if newValue < minimumValue {
// newValue += range
// }
/// Only tracking between min and max
if newValue > maximumValue {
newValue = maximumValue - 0.1
} else if newValue < minimumValue {
newValue = minimumValue
}
return newValue
}
Otherwise, can you add the tracking variable to apply that logic, thank you!
Allow override this method:
(#line 302 in CircularSlider.swift)