Update label positions bug when disableRange is true.
Opened this issue · 1 comments
New Issue Checklist
- Updated
RangeSeekSlider
to the latest version - Checked Gitter
Issue Description
Hi guys!
When disableRange = true
, this library uses the rightHandle
to choose a value. I found a problem with maxLabel
boundaries when labels are not fixed. When rightHandle
is set to minimum value, the label exceeds slider frame and position it's not adjusted.
I think this scenario it's not covered inside updateLabelPositions
method.
You can see this case in the attached screenshot.
Any fix for this?
Thank you!
Environment
- Library version: 1.8.0
- iOS version: 13.0
- Swift version: 5
I got the solution for this issue. Just update below code in RangeSeekSlider.swift file
/* Old code
let newMinLabelCenter: CGPoint = CGPoint(x: leftHandle.frame.midX,
y: leftHandle.frame.maxY + (minLabelTextSize.height/2) + labelPadding)
let newMaxLabelCenter: CGPoint = CGPoint(x: rightHandle.frame.midX,
y: rightHandle.frame.maxY + (maxLabelTextSize.height/2) + labelPadding)*/
//Try this
// Updated code to set labels above the handle
let YPossitionMin=leftHandle.frame.midY - (minLabelTextSize.height + labelPadding)
let YPossitionMax=rightHandle.frame.midY - (maxLabelTextSize.height + labelPadding)
let newMinLabelCenter: CGPoint = CGPoint(x: leftHandle.frame.midX, y: YPossitionMin)
let newMaxLabelCenter: CGPoint = CGPoint(x: rightHandle.frame.midX, y:YPossitionMax)