@yoonit/nativescript-camera
Advanced tools
Comparing version 3.1.0 to 3.2.0
@@ -76,2 +76,3 @@ import "reflect-metadata"; | ||
Validator.PropMap.push({ | ||
type: 'method', | ||
name, | ||
@@ -87,2 +88,26 @@ value: arguments[parameterIndex], | ||
} | ||
static NativeAttribute(name) { | ||
return function (target, propertyName, descriptor) { | ||
let method = descriptor.value; | ||
descriptor.value = function () { | ||
let validateParameters = Reflect.getOwnMetadata(MetadataKey, target, propertyName); | ||
if (validateParameters) { | ||
for (let parameterIndex of validateParameters) { | ||
const invalid = parameterIndex >= arguments.length || | ||
arguments[parameterIndex] === undefined; | ||
if (invalid) { | ||
throw new Error("Missing argument."); | ||
} | ||
Validator.PropMap.push({ | ||
type: 'attribute', | ||
name, | ||
value: arguments[parameterIndex], | ||
length: 0 | ||
}); | ||
} | ||
} | ||
return method.apply(this, arguments); | ||
}; | ||
}; | ||
} | ||
static PercentageToNumber(target, propertyName, descriptor) { | ||
@@ -89,0 +114,0 @@ let method = descriptor.value; |
{ | ||
"name": "@yoonit/nativescript-camera", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"description": "Yoonit Camera have a custom view that shows a preview layer of the front/back camera and detects human faces in it and read qr code.", | ||
@@ -5,0 +5,0 @@ "main": "Yoonit.Camera", |
@@ -43,2 +43,3 @@ | ||
* [Head Movements](#head-movements) | ||
* [Image Quality](#image-quality) | ||
* [Messages](#messages) | ||
@@ -208,3 +209,7 @@ * [Contribute](#contribute-and-make-it-better) | ||
| detectionMinSize | `"NN%"` | `"0%"` | The face minimum size percentage to capture. | | ||
| detectionMaxSize | `"NN%"` | `"100%"` | The face maximum size percentage to capture. | | ||
| detectionMaxSize | `"NN%"` | `"100%"` | The face maximum size percentage to capture. | | ||
| detectionTopSize | `"NN%"` | `"100%"` | Represents the percentage. Positive value enlarges and negative value reduce the top side of the detection. Use the `detectionBox` to have a visual result. | ||
| detectionRightSize | `"NN%"` | `"100%"` | Represents the percentage. Positive value enlarges and negative value reduce the right side of the detection. Use the `detectionBox` to have a visual result. | ||
| detectionBottomSize | `"NN%"` | `"100%"` | Represents the percentage. Positive value enlarges and negative value reduce the bottom side of the detection. Use the `detectionBox` to have a visual result. | ||
| detectionLeftSize | `"NN%"` | `"100%"` | Represents the percentage. Positive value enlarges and negative value reduce the left side of the detection. Use the `detectionBox` to have a visual result. | ||
| roi | `boolean` | `false` | Enable/disable the region of interest capture. | | ||
@@ -245,3 +250,7 @@ | roiTopOffset | `"NN%"` | `"0%"` | Distance in percentage of the top face bounding box with the top of the camera preview. | | ||
| setDetectionMinSize | `percentage: string` | Value format must be in `NN%` | void | Set the face minimum size percentage to capture. | | ||
| setDetectionMaxSize | `percentage: string` | Value format must be in `NN%` | void | Set the face maximum size percentage to capture. | | ||
| setDetectionMaxSize | `percentage: string` | Value format must be in `NN%` | void | Set the face maximum size percentage to capture. | | ||
| setDetectionTopSize | `percentage: string` | Value format must be in `NN%` | void | Represents the percentage. Positive value enlarges and negative value reduce the top side of the detection. Use the `setDetectionBox` to have a visual result. | ||
| setDetectionRightSize | `percentage: string` | Value format must be in `NN%` | void | Represents the percentage. Positive value enlarges and negative value reduce the right side of the detection. Use the `setDetectionBox` to have a visual result. | ||
| setDetectionBottomSize | `percentage: string` | Value format must be in `NN%` | void | Represents the percentage. Positive value enlarges and negative value reduce the bottom side of the detection. Use the `setDetectionBox` to have a visual result. | ||
| setDetectionLeftSize | `percentage: string` | Value format must be in `NN%` | void | Represents the percentage. Positive value enlarges and negative value reduce the left side of the detection. Use the `setDetectionBox` to have a visual result. | ||
| setROI | `enable: boolean` | `true` or `false` | void | Enable/disable face region of interest capture. | | ||
@@ -300,2 +309,18 @@ | setROITopOffset | `percentage: string` | Value format must be in `NN%` | void | Distance in percentage of the top face bounding box with the top of the camera preview. | | ||
### Image Quality | ||
The image quality is the classification of the three attributes: darkness, lightness and sharpness. Result available in the `imageCapture` event. Let's see each parameter specifications: | ||
| Threshold | Classification | ||
| - | - | ||
| **Darkness** | | ||
| darkness > 0.7 | Too dark | ||
| darkness <= 0.7 | Acceptable | ||
| **Lightness** | | ||
| lightness > 0.65 | Too light | ||
| lightness <= 0.65 | Acceptable | ||
| **Sharpness** | | ||
| sharpness >= 0.1591 | Blurred | ||
| sharpness < 0.1591 | Acceptable | ||
#### Messages | ||
@@ -302,0 +327,0 @@ |
@@ -68,2 +68,6 @@ // +-+-+-+-+-+-+ | ||
setDetectionMaxSize, | ||
setDetectionTopSize, | ||
setDetectionRightSize, | ||
setDetectionBottomSize, | ||
setDetectionLeftSize, | ||
setROI, | ||
@@ -107,2 +111,6 @@ setROITopOffset, | ||
setDetectionMaxSize, | ||
setDetectionTopSize, | ||
setDetectionRightSize, | ||
setDetectionBottomSize, | ||
setDetectionLeftSize, | ||
setROI, | ||
@@ -109,0 +117,0 @@ setROITopOffset, |
@@ -17,8 +17,18 @@ import { CameraBase } from './Yoonit.Camera.common'; | ||
Validator.PropMap.forEach((prop) => { | ||
if (this.nativeView[prop.name]) { | ||
if (prop.length > 1) { | ||
return this.nativeView[prop.name](...prop.value); | ||
} | ||
this.nativeView[prop.name](prop.value); | ||
if (this.nativeView[prop.name] === null || this.nativeView[prop.name] === undefined) { | ||
return; | ||
} | ||
switch (prop.type) { | ||
case 'attribute': | ||
this.nativeView[prop.name] = prop.value; | ||
return; | ||
case 'method': | ||
if (prop.length > 1) { | ||
return this.nativeView[prop.name](...prop.value); | ||
} | ||
this.nativeView[prop.name](prop.value); | ||
return; | ||
default: | ||
return; | ||
} | ||
}); | ||
@@ -25,0 +35,0 @@ Validator.PropMap = []; |
import { ContentView } from '@nativescript/core'; | ||
import Validator from "./helpers/Validator"; | ||
const { ValidateProps, Required, NativeMethod, RegexNumber, RegexPX, PercentageToNumber, RegexPercentage, NumberToPixel, ParseToNsColor, RegexColor } = Validator; | ||
const { ValidateProps, Required, NativeMethod, NativeAttribute, RegexNumber, RegexPX, PercentageToNumber, RegexPercentage, NumberToPixel, ParseToNsColor, RegexColor } = Validator; | ||
export class CameraBase extends ContentView { | ||
@@ -41,2 +41,14 @@ set lens(value) { | ||
} | ||
set detectionTopSize(value) { | ||
this.setDetectionTopSize(value); | ||
} | ||
set detectionRightSize(value) { | ||
this.setDetectionRightSize(value); | ||
} | ||
set detectionBottomSize(value) { | ||
this.setDetectionBottomSize(value); | ||
} | ||
set detectionLeftSize(value) { | ||
this.setDetectionLeftSize(value); | ||
} | ||
set roi(value) { | ||
@@ -133,2 +145,14 @@ this.setROI(value); | ||
} | ||
setDetectionTopSize(percentage) { | ||
this.nativeView.detectionTopSize = percentage; | ||
} | ||
setDetectionRightSize(percentage) { | ||
this.nativeView.detectionRightSize = percentage; | ||
} | ||
setDetectionBottomSize(percentage) { | ||
this.nativeView.detectionBottomSize = percentage; | ||
} | ||
setDetectionLeftSize(percentage) { | ||
this.nativeView.detectionLeftSize = percentage; | ||
} | ||
setROI(enable) { | ||
@@ -266,2 +290,38 @@ this.nativeView.setROI(enable); | ||
__decorate([ | ||
ValidateProps('detectionTopSize', RegexPercentage), | ||
PercentageToNumber, | ||
NativeAttribute('detectionTopSize'), | ||
__param(0, Required), | ||
__metadata("design:type", Function), | ||
__metadata("design:paramtypes", [Object]), | ||
__metadata("design:returntype", void 0) | ||
], CameraBase.prototype, "setDetectionTopSize", null); | ||
__decorate([ | ||
ValidateProps('detectionRightSize', RegexPercentage), | ||
PercentageToNumber, | ||
NativeAttribute('detectionRightSize'), | ||
__param(0, Required), | ||
__metadata("design:type", Function), | ||
__metadata("design:paramtypes", [Object]), | ||
__metadata("design:returntype", void 0) | ||
], CameraBase.prototype, "setDetectionRightSize", null); | ||
__decorate([ | ||
ValidateProps('detectionBottomSize', RegexPercentage), | ||
PercentageToNumber, | ||
NativeAttribute('detectionBottomSize'), | ||
__param(0, Required), | ||
__metadata("design:type", Function), | ||
__metadata("design:paramtypes", [Object]), | ||
__metadata("design:returntype", void 0) | ||
], CameraBase.prototype, "setDetectionBottomSize", null); | ||
__decorate([ | ||
ValidateProps('detectionLeftSize', RegexPercentage), | ||
PercentageToNumber, | ||
NativeAttribute('detectionLeftSize'), | ||
__param(0, Required), | ||
__metadata("design:type", Function), | ||
__metadata("design:paramtypes", [Object]), | ||
__metadata("design:returntype", void 0) | ||
], CameraBase.prototype, "setDetectionLeftSize", null); | ||
__decorate([ | ||
ValidateProps('roi', [false, true]), | ||
@@ -268,0 +328,0 @@ NativeMethod({ name: 'setROI', length: 1 }), |
@@ -19,8 +19,18 @@ import { CameraBase } from './Yoonit.Camera.common'; | ||
Validator.PropMap.forEach((prop) => { | ||
if (this.nativeView[prop.name]) { | ||
if (prop.length > 1) { | ||
return this.nativeView[prop.name](...prop.value); | ||
} | ||
this.nativeView[prop.name](prop.value); | ||
if (this.nativeView[prop.name] === null || this.nativeView[prop.name] === undefined) { | ||
return; | ||
} | ||
switch (prop.type) { | ||
case 'attribute': | ||
this.nativeView[prop.name] = prop.value; | ||
return; | ||
case 'method': | ||
if (prop.length > 1) { | ||
return this.nativeView[prop.name](...prop.value); | ||
} | ||
this.nativeView[prop.name](prop.value); | ||
return; | ||
default: | ||
return; | ||
} | ||
}); | ||
@@ -27,0 +37,0 @@ Validator.PropMap = []; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
75931
1210
345