File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
WooCommerce/Classes/ViewRelated/Products/Scanner Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -301,21 +301,28 @@ private extension CodeScannerViewController {
301301// MARK: Orientation Handling
302302//
303303private extension CodeScannerViewController {
304+ enum VideoRotationAngle {
305+ static let portrait : CGFloat = 90
306+ static let landscapeRight : CGFloat = 0
307+ static let landscapeLeft : CGFloat = 180
308+ static let portraitUpsideDown : CGFloat = 270
309+ }
310+
304311 func updatePreviewLayerOrientation( ) {
305312 if let connection = previewLayer? . connection {
306313 let orientation = view. window? . windowScene? . interfaceOrientation
307314 let videoRotationAngle : CGFloat
308315 switch orientation {
309316 case . portrait:
310- videoRotationAngle = 90
317+ videoRotationAngle = VideoRotationAngle . portrait
311318 case . landscapeRight:
312- videoRotationAngle = 0
319+ videoRotationAngle = VideoRotationAngle . landscapeRight
313320 case . landscapeLeft:
314- videoRotationAngle = 180
321+ videoRotationAngle = VideoRotationAngle . landscapeLeft
315322 case . portraitUpsideDown:
316- videoRotationAngle = 270
323+ videoRotationAngle = VideoRotationAngle . portraitUpsideDown
317324 default :
318- videoRotationAngle = 90
325+ videoRotationAngle = VideoRotationAngle . portrait
319326 }
320327 updatePreviewLayerVideoRotationAngle ( connection: connection, angle: videoRotationAngle)
321328 }
You can’t perform that action at this time.
0 commit comments