Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
mobile_scanner
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
casvanluijtelaar
2022-06-07 13:14:55 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
2272755b4a4f92e143b0dedf4310612c7ab737bb
2272755b
1 parent
95be5663
added conversion
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
ios/Classes/SwiftMobileScannerPlugin.swift
ios/Classes/SwiftMobileScannerPlugin.swift
View file @
2272755
...
...
@@ -241,23 +241,24 @@ public class SwiftMobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHan
captureSession
.
commitConfiguration
()
captureSession
.
startRunning
()
let
demensions
=
CMVideoFormatDescriptionGetDimensions
(
device
.
activeFormat
.
formatDescription
)
/// limit captureSession area of interest to the scanWindow if provided
let
scanWindowData
:
Array
?
=
argReader
.
intArray
(
key
:
"scanWindow"
)
if
(
scanWindowData
!=
nil
)
{
let
captureMetadataOutput
=
AVCaptureMetadataOutput
()
captureMetadataOutput
.
rectOfInterest
=
CGRect
(
x
:
scanWindowData
!
[
0
],
y
:
scanWindowData
!
[
1
],
width
:
scanWindowData
!
[
2
]
-
scanWindowData
!
[
0
],
height
:
scanWindowData
!
[
3
]
-
scanWindowData
!
[
1
])
let
x
=
CGFloat
(
scanWindowData
!
[
0
]
/
Int
(
demensions
.
width
))
let
y
=
CGFloat
(
scanWindowData
!
[
1
]
/
Int
(
demensions
.
height
))
let
w
=
CGFloat
((
scanWindowData
!
[
2
]
-
scanWindowData
!
[
0
])
/
Int
(
demensions
.
width
))
let
h
=
CGFloat
((
scanWindowData
!
[
3
]
-
scanWindowData
!
[
1
])
/
Int
(
demensions
.
height
))
captureMetadataOutput
.
rectOfInterest
=
CGRect
(
x
:
x
,
y
:
y
,
width
:
w
,
height
:
h
)
captureSession
.
addOutput
(
captureMetadataOutput
)
}
let
demensions
=
CMVideoFormatDescriptionGetDimensions
(
device
.
activeFormat
.
formatDescription
)
let
width
=
Double
(
demensions
.
height
)
let
height
=
Double
(
demensions
.
width
)
let
size
=
[
"width"
:
width
,
"height"
:
height
]
...
...
Please
register
or
login
to post a comment