scanner-overlay icon indicating copy to clipboard operation
scanner-overlay copied to clipboard

Adding a CAShapeLayer goes out of bounds

Open hechukwu opened this issue 3 years ago • 0 comments

let path = CGMutablePath()
            qrCodeView.clipsToBounds = true
            view.clipsToBounds = true
            path.addRect(videoPreviewLayer!.bounds)
            path.addRect(qrCodeFrameView.frame)

            let maskLayer = CAShapeLayer()
            maskLayer.path = path
            maskLayer.fillColor = UIColor.black.withAlphaComponent(0.6).cgColor
            maskLayer.fillRule = .evenOdd

            videoPreviewLayer?.addSublayer(maskLayer)

I have the above code but my path extends beyond the bounds of my qrCodeFrameView, what could be the problem.

IMG_3128

hechukwu avatar Mar 02 '21 14:03 hechukwu