| 
									
										
										
										
											2021-02-19 16:28:05 +01:00
										 |  |  | // | 
					
						
							| 
									
										
										
										
											2023-09-01 12:58:32 +02:00
										 |  |  | //  CameraView+Focus.swift | 
					
						
							| 
									
										
										
										
											2023-10-13 18:33:20 +02:00
										 |  |  | //  VisionCamera | 
					
						
							| 
									
										
										
										
											2021-02-19 16:28:05 +01:00
										 |  |  | // | 
					
						
							| 
									
										
										
										
											2023-10-13 18:33:20 +02:00
										 |  |  | //  Created by Marc Rousavy on 12.10.23. | 
					
						
							|  |  |  | //  Copyright © 2023 mrousavy. All rights reserved. | 
					
						
							| 
									
										
										
										
											2021-02-19 16:28:05 +01:00
										 |  |  | // | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-10-13 18:33:20 +02:00
										 |  |  | import AVFoundation | 
					
						
							| 
									
										
										
										
											2021-02-19 16:28:05 +01:00
										 |  |  | import Foundation | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | extension CameraView { | 
					
						
							|  |  |  |   func focus(point: CGPoint, promise: Promise) { | 
					
						
							|  |  |  |     withPromise(promise) { | 
					
						
							| 
									
										
										
										
											2023-11-27 14:43:56 +01:00
										 |  |  |       let normalized = previewView.captureDevicePointConverted(fromLayerPoint: point) | 
					
						
							|  |  |  |       try cameraSession.focus(point: normalized) | 
					
						
							| 
									
										
										
										
											2023-10-13 18:33:20 +02:00
										 |  |  |       return nil | 
					
						
							| 
									
										
										
										
											2023-10-06 14:30:12 +02:00
										 |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2021-02-19 16:28:05 +01:00
										 |  |  | } |