swiftui-sliders
swiftui-sliders copied to clipboard
LowerThumb moves UpperThumb
Hi, I'm using this library to create a RangeSlider but I have a problem. When I move the lower thumb and it reaches the position of upper thumb instead of stop the movement, the lower thumb pushes the upper thumb (see the attached video). I think this behavior is not natural on app development. Is there a way to fix it?
https://user-images.githubusercontent.com/13442110/143972064-c740edbd-b02e-45e9-a150-20633b3f7b85.mov
Hi, you have to disable .forceAdjacentValue
Here is an example
RangeSlider(range: $range2)
.rangeSliderStyle(
HorizontalRangeSliderStyle(
track:
HorizontalRangeTrack(
view: Capsule().foregroundColor(.purple)
)
.background(Capsule().foregroundColor(Color.purple.opacity(0.25)))
.frame(height: 8),
lowerThumb: Circle().foregroundColor(.purple),
upperThumb: Circle().foregroundColor(.purple),
lowerThumbSize: CGSize(width: 32, height: 32),
upperThumbSize: CGSize(width: 32, height: 32),
options: [] // instead of .forceAdjacentValue
)
)