UNPKG

react-native-scanbot-sdk

Version:

Scanbot Document and Barcode Scanner SDK React Native Plugin for Android and iOS

174 lines (170 loc) 6.31 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DocumentScannerCameraConfiguration = void 0; var _Common = require("../common/Common"); var _utils = require("../../utils"); /** Determines the prioritization of still image quality and capturing speed. - `SPEED`: Captures a still image at the highest possible speed. The quality of the image may be degraded. - `BALANCED`: Balances capturing speed and image quality equally. This is the default value. - `QUALITY`: Captures a still image with the best possible quality in terms of noise, frozen motion and detail in low light. The speed of the capturing might be reduced. */ /** Configuration of the camera behavior. */ class DocumentScannerCameraConfiguration extends _utils.PartiallyConstructible { /** Determines which camera module to use on start-up. Default is BACK */ cameraModule = 'BACK'; /** The default zoom factor on start-up. Default is 1.0 */ defaultZoomFactor = 1.0; /** Determines whether the document should be cropped automatically after a manual snap or not. Default is true */ autoCropOnManualSnap = true; /** Determines whether the flashlight is enabled or not on start-up. Default is false */ flashEnabled = false; /** Determines whether locking the focus at the minimum possible distance is enabled or not (device-specific). Default is false */ minFocusDistanceLock = false; /** Determines whether touch-to-focus is enabled or not. Android only. Default is false */ touchToFocusEnabled = false; /** Determines whether pinch-to-zoom is enabled or not. Default is true */ pinchToZoomEnabled = true; /** Determines which camera preview mode to use. Default is FILL_IN */ cameraPreviewMode = 'FILL_IN'; /** Determines the prioritization of still image quality and capturing speed. Default is BALANCED */ captureQualityPrioritization = 'BALANCED'; /** The minimum pitch/skew angle of the document to be accepted. The value must be between 0.0 and 1.0. Default is 0.75 */ acceptedAngleScore = 0.75; /** The minimum size of the document in relation to the screen preview to be accepted. The value must be between 0.0 and 1.0. Default is 0.75 */ acceptedSizeScore = 0.75; /** Controls the auto snapping speed. The sensitivity must be between 0.0 and 1.0. A value of 1.0 triggers auto snapping immediately, while a value of 0.0 delays the auto snapping by 3 seconds. The default value is 0.66 (1 second). Default is 0.66 */ autoSnappingSensitivity = 0.66; /** After a page has been snapped, the delay in milliseconds before auto snapping resumes for the next page. Default is 200 */ autoSnappingDelay = 200; /** The minimum brightness value to accept a detected document. Default is 50 */ acceptedBrightnessThreshold = 50; /** Determines if auto snapping is enabled or not. Default is true */ autoSnappingEnabled = true; /** The required aspect ratios for the document to be accepted. */ requiredAspectRatios = []; /** Determines whether a landscape document will be detected when the camera is in portrait mode (and vice versa) or not. This parameter will be ignored if required aspect ratios have been explicitly defined. Default is true */ ignoreBadAspectRatio = true; /** When enabled the hardware volume up/down buttons can be used to capture an image if manual snapping is enabled. For iOS version 17.2 or later is required. On iPhones with camera control (iPhone 16 series) this also enables zooming and capturing with the camera control. Default is true */ captureWithHardwareButtonsEnabled = true; /** @param source {@displayType `DeepPartial<DocumentScannerCameraConfiguration>`} */ constructor(source = {}) { super(); if (source.cameraModule !== undefined) { this.cameraModule = source.cameraModule; } if (source.defaultZoomFactor !== undefined) { this.defaultZoomFactor = source.defaultZoomFactor; } if (source.autoCropOnManualSnap !== undefined) { this.autoCropOnManualSnap = source.autoCropOnManualSnap; } if (source.flashEnabled !== undefined) { this.flashEnabled = source.flashEnabled; } if (source.minFocusDistanceLock !== undefined) { this.minFocusDistanceLock = source.minFocusDistanceLock; } if (source.touchToFocusEnabled !== undefined) { this.touchToFocusEnabled = source.touchToFocusEnabled; } if (source.pinchToZoomEnabled !== undefined) { this.pinchToZoomEnabled = source.pinchToZoomEnabled; } if (source.cameraPreviewMode !== undefined) { this.cameraPreviewMode = source.cameraPreviewMode; } if (source.captureQualityPrioritization !== undefined) { this.captureQualityPrioritization = source.captureQualityPrioritization; } if (source.acceptedAngleScore !== undefined) { this.acceptedAngleScore = source.acceptedAngleScore; } if (source.acceptedSizeScore !== undefined) { this.acceptedSizeScore = source.acceptedSizeScore; } if (source.autoSnappingSensitivity !== undefined) { this.autoSnappingSensitivity = source.autoSnappingSensitivity; } if (source.autoSnappingDelay !== undefined) { this.autoSnappingDelay = source.autoSnappingDelay; } if (source.acceptedBrightnessThreshold !== undefined) { this.acceptedBrightnessThreshold = source.acceptedBrightnessThreshold; } if (source.autoSnappingEnabled !== undefined) { this.autoSnappingEnabled = source.autoSnappingEnabled; } if (source.requiredAspectRatios !== undefined) { this.requiredAspectRatios = source.requiredAspectRatios.map(it => new _Common.AspectRatio(it)); } if (source.ignoreBadAspectRatio !== undefined) { this.ignoreBadAspectRatio = source.ignoreBadAspectRatio; } if (source.captureWithHardwareButtonsEnabled !== undefined) { this.captureWithHardwareButtonsEnabled = source.captureWithHardwareButtonsEnabled; } } } exports.DocumentScannerCameraConfiguration = DocumentScannerCameraConfiguration; //# sourceMappingURL=DocumentScannerCameraConfiguration.js.map