Skip to content

Commit

Permalink
Updated Slider Issue
Browse files Browse the repository at this point in the history
  • Loading branch information
kieranb662 committed Apr 11, 2020
1 parent 8af79e6 commit 18992e4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Sources/Sliders/PSlider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ public struct PSlider<S: Shape>: View {
}
var angle: Angle {
let num = Int(getPercent(self.position + self.dragState.translation.toPoint(), lookupTable: self.lookUpTable)*CGFloat(lookUpTable.count))
if self.lookUpTable.count < 3 {
return .zero
}
if num > lookUpTable.count-2 {
return calculateDirection(lookUpTable[num-2], lookUpTable[num-1])
} else {
Expand Down

0 comments on commit 18992e4

Please sign in to comment.