ColorSlider icon indicating copy to clipboard operation
ColorSlider copied to clipboard

fixed issue with preview view corner radius

Open gumenuk39 opened this issue 5 years ago • 4 comments

gumenuk39 avatar Aug 30 '19 10:08 gumenuk39

Hi @gumenuk39, can you file an issue first with screenshots and some context on what the problem here was?

gizmosachin avatar Aug 31 '19 18:08 gizmosachin

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 IMAGE 2019-09-03 13:19:33

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

gumenuk39 avatar Sep 03 '19 10:09 gumenuk39

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 }

gumenuk39 avatar Sep 05 '19 10:09 gumenuk39

@gizmosachin what about my PR? all your issues have been fixed

gumenuk39 avatar Oct 10 '19 10:10 gumenuk39