Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update label positions bug when disableRange is true. #94

Open
2 tasks done
vladpre92 opened this issue Jun 22, 2020 · 1 comment
Open
2 tasks done

Update label positions bug when disableRange is true. #94

vladpre92 opened this issue Jun 22, 2020 · 1 comment

Comments

@vladpre92
Copy link

vladpre92 commented Jun 22, 2020

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

IMG_0529

@jigneshradadiya
Copy link

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants