mirror of
https://github.com/joncardasis/ChromaColorPicker.git
synced 2024-11-29 11:15:55 +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.
|
the point does not exist within the bounds of the color wheel.
|
||||||
*/
|
*/
|
||||||
public func pixelColor(at point: CGPoint) -> UIColor? {
|
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 distanceFromCenter: CGFloat = hypot(center.x - point.x, center.y - point.y)
|
||||||
let pointExistsInRadius: Bool = distanceFromCenter <= radius
|
let pointExistsInRadius: Bool = distanceFromCenter <= radius
|
||||||
|
Loading…
Reference in New Issue
Block a user