mirror of
https://github.com/joncardasis/ChromaColorPicker.git
synced 2024-11-25 22:12:01 +03:00
Expand bounds for 'contains' to account for points on the rightmost and bottommost bounds.
This commit is contained in:
parent
65eab137b3
commit
927a4d8834
@ -56,7 +56,7 @@ public class ColorWheelView: UIView {
|
||||
the point does not exist within the bounds of the color wheel.
|
||||
*/
|
||||
public func pixelColor(at point: CGPoint) -> UIColor? {
|
||||
guard bounds.contains(point) else { return nil }
|
||||
guard bounds.offsetBy(dx: 1, dy: 1).contains(point) else { return nil }
|
||||
|
||||
let distanceFromCenter: CGFloat = hypot(center.x - point.x, center.y - point.y)
|
||||
let pointExistsInRadius: Bool = distanceFromCenter <= radius
|
||||
|
Loading…
Reference in New Issue
Block a user