Color wheel now adjusts bounds with proper sizing function for point determination

This commit is contained in:
Jonathan Cardasis 2019-04-19 21:06:41 -04:00
parent 46e2743d87
commit b2b504081a

View File

@ -91,7 +91,7 @@ public class ColorWheelView: UIView {
Returns whether or not the point is in the circular area of the color wheel.
*/
public func pointIsInColorWheel(_ point: CGPoint) -> Bool {
guard bounds.offsetBy(dx: 1, dy: 1).contains(point) else { return false }
guard bounds.insetBy(dx: -1, dy: -1).contains(point) else { return false }
let distanceFromCenter: CGFloat = hypot(center.x - point.x, center.y - point.y)
let pointExistsInRadius: Bool = distanceFromCenter <= (radius - layer.borderWidth)