mirror of
https://github.com/status-im/react-native-camera.git
synced 2025-02-24 17:58:20 +00:00
Merge pull request #213 from dhrrgn/fix-zoom
Fix zoomFactor getting reset to 1.0 when it goes above the max.
This commit is contained in:
commit
71f6ec4653
@ -821,7 +821,11 @@ didFinishRecordingToOutputFileAtURL:(NSURL *)outputFileURL
|
|||||||
AVCaptureDevice *device = [[self videoCaptureDeviceInput] device];
|
AVCaptureDevice *device = [[self videoCaptureDeviceInput] device];
|
||||||
if ([device lockForConfiguration:&error]) {
|
if ([device lockForConfiguration:&error]) {
|
||||||
CGFloat zoomFactor = device.videoZoomFactor + atan(velocity / pinchVelocityDividerFactor);
|
CGFloat zoomFactor = device.videoZoomFactor + atan(velocity / pinchVelocityDividerFactor);
|
||||||
zoomFactor = zoomFactor >= 1 && zoomFactor <= device.activeFormat.videoMaxZoomFactor ? zoomFactor : 1.0f;
|
if (zoomFactor > device.activeFormat.videoMaxZoomFactor) {
|
||||||
|
zoomFactor = device.activeFormat.videoMaxZoomFactor;
|
||||||
|
} else if (zoomFactor < 1) {
|
||||||
|
zoomFactor = 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
NSDictionary *event = @{
|
NSDictionary *event = @{
|
||||||
@"target": reactTag,
|
@"target": reactTag,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user