rorodriguez116 / Camera-SwiftUI

A lightweight camera library for quick integration with SwiftUI - iOS/iPadOS only

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Focus Tap Indicator Not Centered on Tap Location

achi113s opened this issue · comments

CameraPreview.swift: The circle that appears when you tap to focus does not appear at the location of the tap. Instead it appears slightly off center due to the origin of the circle being at the top left corner. Proposed solution is to just offset the circle in x and y by its radius. Should just modify the focusView's CGRect to this:

let focusCircleDiam: CGFloat = 50
let shiftedLayerPoint = CGPoint(
                x: layerPoint.x - (focusCircleDiam / 2),
                y: layerPoint.y - (focusCircleDiam / 2))
            
self.focusView.layer.frame = CGRect(origin: shiftedLayerPoint, size: CGSize(width: focusCircleDiam, height: focusCircleDiam))

Thanks for pointing this out, I'll take a look.

Thanks, this fixes the issue will update main branch.