@@ -220,37 +220,39 @@ export class MLKitView extends MLKitViewBase {
220
220
}
221
221
222
222
#setupDetectors( ) {
223
- if ( TEXT_RECOGNITION_SUPPORTED ( ) && ! this . #textRecognizer && ( this . detectionType === DetectionType . Text || this . detectionType === DetectionType . All ) ) {
224
- this . #textRecognizer = MLKTextRecognizer . textRecognizer ( ) ;
225
- this . #mlkitHelper. textRecognizer = this . #textRecognizer;
223
+ if ( ! this . #textRecognizer && ( this . detectionType === DetectionType . Text || this . detectionType === DetectionType . All ) ) {
224
+ if ( TEXT_RECOGNITION_SUPPORTED ( ) ) {
225
+ this . #textRecognizer = MLKTextRecognizer . textRecognizer ( ) ;
226
+ this . #mlkitHelper. textRecognizer = this . #textRecognizer;
227
+ }
226
228
}
227
229
228
- if ( BARCODE_SCANNER_SUPPORTED ( ) && ! this . #barcodeScanner && ( this . detectionType === DetectionType . Barcode || this . detectionType === DetectionType . All ) ) {
230
+ if ( ! this . #barcodeScanner && ( this . detectionType === DetectionType . Barcode || this . detectionType === DetectionType . All ) ) {
229
231
this . #setupBarcodeScanner( this . barcodeFormats ) ;
230
232
}
231
233
232
234
// TODO
233
- if ( DIGITALINK_RECOGNITION_SUPPORTED ( ) && ! this . #digitalInkRecognizer && ( this . detectionType === DetectionType . DigitalInk || this . detectionType === DetectionType . All ) ) {
235
+ if ( ! this . #digitalInkRecognizer && ( this . detectionType === DetectionType . DigitalInk || this . detectionType === DetectionType . All ) ) {
234
236
// MLKDigitalInkRecognizer.digitalInkRecognizerWithOptions()
235
237
}
236
238
237
- if ( FACE_DETECTION_SUPPORTED ( ) && ! this . #faceDetector && ( this . detectionType === DetectionType . Face || this . detectionType === DetectionType . All ) ) {
239
+ if ( ! this . #faceDetector && ( this . detectionType === DetectionType . Face || this . detectionType === DetectionType . All ) ) {
238
240
this . #setupFaceDetector( ) ;
239
241
}
240
242
241
- if ( IMAGE_LABELING_SUPPORTED ( ) && ! this . #imageLabeler && ( this . detectionType === DetectionType . Image || this . detectionType === DetectionType . All ) ) {
243
+ if ( ! this . #imageLabeler && ( this . detectionType === DetectionType . Image || this . detectionType === DetectionType . All ) ) {
242
244
this . #setImageLabeler( ) ;
243
245
}
244
246
245
- if ( OBJECT_DETECTION_SUPPORTED ( ) && ! this . #objectDetector && ( this . detectionType === DetectionType . Object || this . detectionType === DetectionType . All ) ) {
247
+ if ( ! this . #objectDetector && ( this . detectionType === DetectionType . Object || this . detectionType === DetectionType . All ) ) {
246
248
this . #setupObjectDetection( ) ;
247
249
}
248
250
249
- if ( POSE_DETECTION_SUPPORTED ( ) && ! this . #poseDetector && ( this . detectionType === DetectionType . Pose || this . detectionType === DetectionType . All ) ) {
251
+ if ( ! this . #poseDetector && ( this . detectionType === DetectionType . Pose || this . detectionType === DetectionType . All ) ) {
250
252
this . #setPoseDetection( ) ;
251
253
}
252
254
253
- if ( SELFIE_SEGMENTATION_SUPPORTED ( ) && ! this . #selfieSegmentor && ( this . detectionType === DetectionType . Selfie || this . detectionType === DetectionType . All ) ) {
255
+ if ( ! this . #selfieSegmentor && ( this . detectionType === DetectionType . Selfie || this . detectionType === DetectionType . All ) ) {
254
256
this . #setSelfieSegmentation( ) ;
255
257
}
256
258
}
@@ -394,7 +396,7 @@ export class MLKitView extends MLKitViewBase {
394
396
}
395
397
396
398
#setupObjectDetection( ) {
397
- if ( ! OBJECT_DETECTION_SUPPORTED ) {
399
+ if ( ! OBJECT_DETECTION_SUPPORTED ( ) ) {
398
400
return ;
399
401
}
400
402
if ( ! this . #objectDetectionOptions) {
@@ -411,7 +413,7 @@ export class MLKitView extends MLKitViewBase {
411
413
}
412
414
413
415
#setPoseDetection( ) {
414
- if ( ! POSE_DETECTION_SUPPORTED ) {
416
+ if ( ! POSE_DETECTION_SUPPORTED ( ) ) {
415
417
return ;
416
418
}
417
419
if ( ! this . #poseDetectionOptions) {
0 commit comments