react-native-scanbot-sdk
Version:
Scanbot Document and Barcode Scanner SDK React Native Plugin for Android and iOS
266 lines (247 loc) • 7.48 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ViewFinderConfiguration = exports.PermanentViewFinderConfiguration = exports.FinderStyle = exports.FinderStrokedStyle = exports.FinderCorneredStyle = exports.BaseViewFinderConfiguration = void 0;
var _Common = require("../../ui_v2/common/Common");
var _Geometry = require("../../utils/geometry/Geometry");
var _utils = require("../../utils/utils");
/// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten.
/// Generated from rtu-ui-v2/schemas/common/ViewFinderConfiguration.yaml
/**
Base configuration of the scanning interface’s viewfinder, serving as guidance to the user.
*/
/** @internal */
let BaseViewFinderConfiguration = exports.BaseViewFinderConfiguration = void 0;
(function (_BaseViewFinderConfiguration) {
function From(source) {
const _type = source._type;
switch (_type) {
case 'ViewFinderConfiguration':
return new ViewFinderConfiguration(source);
case 'PermanentViewFinderConfiguration':
return new PermanentViewFinderConfiguration(source);
default:
throw `Unknown child class name: ${_type}`;
}
}
_BaseViewFinderConfiguration.From = From;
})(BaseViewFinderConfiguration || (exports.BaseViewFinderConfiguration = BaseViewFinderConfiguration = {}));
/**
Configuration of the scanning interface’s viewfinder, allowing it to be shown or hidden as guidance to the user.
*/
class ViewFinderConfiguration extends _utils.PartiallyConstructible {
_type = 'ViewFinderConfiguration';
/**
The visual appearance of the viewfinder.
*/
style = new FinderCorneredStyle({
strokeColor: '?sbColorSurface',
strokeWidth: 2.0,
cornerRadius: 10.0
});
/**
The color of the viewfinder overlay.
Default is "?sbColorSurfaceLow"
*/
overlayColor = '?sbColorSurfaceLow';
/**
The viewfinder's aspect ratio.
*/
aspectRatio = new _Geometry.AspectRatio({
width: 1.0,
height: 1.0
});
/**
The minimum insets of the viewfinder.
*/
minimumInsets = new _Common.EdgeInsets({
top: 16.0,
left: 16.0,
bottom: 16.0,
right: 16.0
});
/**
The preferred height of the viewfinder.
Default is -1.0
*/
preferredHeight = -1.0;
/**
Whether the viewfinder is visible.
Default is true
*/
visible = true;
/** @param source {@displayType `DeepPartial<ViewFinderConfiguration>`} */
constructor(source = {}) {
super();
if (source.style !== undefined) {
this.style = FinderStyle.From(source.style);
}
if (source.overlayColor !== undefined) {
this.overlayColor = source.overlayColor;
}
if (source.aspectRatio !== undefined) {
this.aspectRatio = new _Geometry.AspectRatio(source.aspectRatio);
}
if (source.minimumInsets !== undefined) {
this.minimumInsets = new _Common.EdgeInsets(source.minimumInsets);
}
if (source.preferredHeight !== undefined) {
this.preferredHeight = source.preferredHeight;
}
if (source.visible !== undefined) {
this.visible = source.visible;
}
}
}
/**
Configuration of the scanning interface’s viewfinder, which is always visible to guide the user.
*/
exports.ViewFinderConfiguration = ViewFinderConfiguration;
class PermanentViewFinderConfiguration extends _utils.PartiallyConstructible {
_type = 'PermanentViewFinderConfiguration';
/**
The visual appearance of the viewfinder.
*/
style = new FinderCorneredStyle({
strokeColor: '?sbColorSurface',
strokeWidth: 2.0,
cornerRadius: 10.0
});
/**
The color of the viewfinder overlay.
Default is "?sbColorSurfaceLow"
*/
overlayColor = '?sbColorSurfaceLow';
/**
The viewfinder's aspect ratio.
*/
aspectRatio = new _Geometry.AspectRatio({
width: 1.0,
height: 1.0
});
/**
The minimum insets of the viewfinder.
*/
minimumInsets = new _Common.EdgeInsets({
top: 16.0,
left: 16.0,
bottom: 16.0,
right: 16.0
});
/**
The preferred height of the viewfinder.
Default is -1.0
*/
preferredHeight = -1.0;
/** @param source {@displayType `DeepPartial<PermanentViewFinderConfiguration>`} */
constructor(source = {}) {
super();
if (source.style !== undefined) {
this.style = FinderStyle.From(source.style);
}
if (source.overlayColor !== undefined) {
this.overlayColor = source.overlayColor;
}
if (source.aspectRatio !== undefined) {
this.aspectRatio = new _Geometry.AspectRatio(source.aspectRatio);
}
if (source.minimumInsets !== undefined) {
this.minimumInsets = new _Common.EdgeInsets(source.minimumInsets);
}
if (source.preferredHeight !== undefined) {
this.preferredHeight = source.preferredHeight;
}
}
}
/**
The visual appearance of the viewfinder.
*/
exports.PermanentViewFinderConfiguration = PermanentViewFinderConfiguration;
/** @internal */
let FinderStyle = exports.FinderStyle = void 0;
(function (_FinderStyle) {
function From(source) {
const _type = source._type;
switch (_type) {
case 'FinderCorneredStyle':
return new FinderCorneredStyle(source);
case 'FinderStrokedStyle':
return new FinderStrokedStyle(source);
default:
throw `Unknown child class name: ${_type}`;
}
}
_FinderStyle.From = From;
})(FinderStyle || (exports.FinderStyle = FinderStyle = {}));
/**
A variant of the viewfinder displaying only the four corners of the scanning area.
*/
class FinderCorneredStyle extends _utils.PartiallyConstructible {
_type = 'FinderCorneredStyle';
/**
The color of the viewfinder corner's outlines.
Default is "#FFFFFFFF"
*/
strokeColor = '#FFFFFFFF';
/**
The width of the viewfinder corner's outlines.
Default is 3.0
*/
strokeWidth = 3.0;
/**
The radius of the viewfinder's corners.
Default is 10.0
*/
cornerRadius = 10.0;
/** @param source {@displayType `DeepPartial<FinderCorneredStyle>`} */
constructor(source = {}) {
super();
if (source.strokeColor !== undefined) {
this.strokeColor = source.strokeColor;
}
if (source.strokeWidth !== undefined) {
this.strokeWidth = source.strokeWidth;
}
if (source.cornerRadius !== undefined) {
this.cornerRadius = source.cornerRadius;
}
}
}
/**
A variant of the viewfinder displaying a full outline of the scanning area.
*/
exports.FinderCorneredStyle = FinderCorneredStyle;
class FinderStrokedStyle extends _utils.PartiallyConstructible {
_type = 'FinderStrokedStyle';
/**
The color of the viewfinder corner's outlines.
Default is "#FFFFFFFF"
*/
strokeColor = '#FFFFFFFF';
/**
The width of the viewfinder corner's outlines.
Default is 3.0
*/
strokeWidth = 3.0;
/**
The radius of the viewfinder's corners.
Default is 10.0
*/
cornerRadius = 10.0;
/** @param source {@displayType `DeepPartial<FinderStrokedStyle>`} */
constructor(source = {}) {
super();
if (source.strokeColor !== undefined) {
this.strokeColor = source.strokeColor;
}
if (source.strokeWidth !== undefined) {
this.strokeWidth = source.strokeWidth;
}
if (source.cornerRadius !== undefined) {
this.cornerRadius = source.cornerRadius;
}
}
}
exports.FinderStrokedStyle = FinderStrokedStyle;
//# sourceMappingURL=ViewFinderConfiguration.js.map