Skip to content

Commit

Permalink
Make handles never exceeds sliderLine edges
Browse files Browse the repository at this point in the history
  • Loading branch information
sereivoanyong committed Jul 2, 2021
1 parent 0a37f3f commit a3f8a3e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/RangeSeekSlider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -468,12 +468,12 @@ import UIKit
let percentage: CGFloat = percentageAlongLine(for: value)

// get the difference between the maximum and minimum coordinate position x values (e.g if max was x = 310, and min was x=10, difference is 300)
let maxMinDif: CGFloat = sliderLine.frame.maxX - sliderLine.frame.minX
let maxMinDif = sliderLine.frame.width - handleDiameter

// now multiply the percentage by the minMaxDif to see how far along the line the point should be, and add it onto the minimum x position.
let offset: CGFloat = percentage * maxMinDif

return sliderLine.frame.minX + offset
return sliderLine.frame.minX + handleDiameter / 2 + offset
}

private func updateLineHeight() {
Expand Down

0 comments on commit a3f8a3e

Please sign in to comment.