ColorSlider
ColorSlider copied to clipboard
fixed issue with preview view corner radius
Hi @gumenuk39, can you file an issue first with screenshots and some context on what the problem here was?
If I use the custom size of the Color Slider. Preview view isn't round because of hardcode the 25 for width or height.
File Color Slider
rows 185 - 188
case .horizontal where autoresizesSubviews: preview.bounds.size = CGSize(width: 25, height: bounds.height + 10) case .vertical where autoresizesSubviews: preview.bounds.size = CGSize(width: bounds.width + 10, height: 25)
For example in demo I changed the width of color slider
from
colorSlider.widthAnchor.constraint(equalToConstant: 40)
to
colorSlider.widthAnchor.constraint(equalToConstant: 26)
and the result you can see on screenshot
I fixed that lines to
case .horizontal where autoresizesSubviews: preview.bounds.size = CGSize(width: bounds.height + 10, height: bounds.height + 10) case .vertical where autoresizesSubviews: preview.bounds.size = CGSize(width: bounds.width + 10, height: bounds.width + 10)
and preview View is always round
also I found another issue:
touch isn't handling when you tap on preview view and it's position is top/bottom or left/right depends on Color slider orientation. for fixing this issue, I changed padding in hit test
was:
let padding = -20
fix:
let padding: CGFloat switch orientation { case .vertical: padding = -bounds.width case .horizontal: padding = -bounds.height }
@gizmosachin what about my PR? all your issues have been fixed