capacitor-plugin-scanbot-sdk
Version:
Scanbot Document and Barcode Scanner SDK for Capacitor
148 lines • 6.22 kB
JavaScript
import { PartiallyConstructible } from '../../utils';
import { AspectRatio } from '../common/Common';
/**
Configuration of the camera behavior.
*/
export class DocumentScannerCameraConfiguration extends PartiallyConstructible {
/** @param source {@displayType `DeepPartial<DocumentScannerCameraConfiguration>`} */
constructor(source = {}) {
super();
/**
Determines which camera module to use on start-up.
Default is BACK
*/
this.cameraModule = 'BACK';
/**
The default zoom factor on start-up.
Default is 1.0
*/
this.defaultZoomFactor = 1.0;
/**
Determines whether the flashlight is enabled or not on start-up.
Default is false
*/
this.flashEnabled = false;
/**
Determines whether locking the focus at the minimum possible distance is enabled or not (device-specific).
Default is false
*/
this.minFocusDistanceLock = false;
/**
Determines whether touch-to-focus is enabled or not. Android only.
Default is false
*/
this.touchToFocusEnabled = false;
/**
Determines whether pinch-to-zoom is enabled or not.
Default is true
*/
this.pinchToZoomEnabled = true;
/**
Determines which camera preview mode to use.
Default is FILL_IN
*/
this.cameraPreviewMode = 'FILL_IN';
/**
Determines the prioritization of still image quality and capturing speed.
Default is BALANCED
*/
this.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
*/
this.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
*/
this.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
*/
this.autoSnappingSensitivity = 0.66;
/**
After a page has been snapped, the delay in milliseconds before auto snapping resumes for the next page.
Default is 200
*/
this.autoSnappingDelay = 200;
/**
The minimum brightness value to accept a detected document.
Default is 50
*/
this.acceptedBrightnessThreshold = 50;
/**
Determines if auto snapping is enabled or not.
Default is true
*/
this.autoSnappingEnabled = true;
/**
The required aspect ratios for the document to be accepted.
*/
this.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
*/
this.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
*/
this.captureWithHardwareButtonsEnabled = true;
if (source.cameraModule !== undefined) {
this.cameraModule = source.cameraModule;
}
if (source.defaultZoomFactor !== undefined) {
this.defaultZoomFactor = source.defaultZoomFactor;
}
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 AspectRatio(it));
}
if (source.ignoreBadAspectRatio !== undefined) {
this.ignoreBadAspectRatio = source.ignoreBadAspectRatio;
}
if (source.captureWithHardwareButtonsEnabled !== undefined) {
this.captureWithHardwareButtonsEnabled =
source.captureWithHardwareButtonsEnabled;
}
}
}
//# sourceMappingURL=DocumentScannerCameraConfiguration.js.map