react-native-rectangle-doc-scanner 3.40.0 → 3.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -53,17 +53,22 @@
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
- (void) didDetectRectangle:(CIRectangleFeature *)rectangle withType:(IPDFRectangeType)type {
|
|
56
|
+
// Handle case where no rectangle is detected
|
|
57
|
+
if (!rectangle) {
|
|
58
|
+
NSLog(@"[DocumentScanner] Rectangle not found, resetting counter");
|
|
59
|
+
self.stableCounter = 0;
|
|
60
|
+
_lastDetectionType = type;
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
56
64
|
switch (type) {
|
|
57
65
|
case IPDFRectangeTypeGood:
|
|
58
66
|
self.stableCounter ++;
|
|
59
67
|
NSLog(@"[DocumentScanner] Good rectangle detected, stableCounter: %ld/%ld", (long)self.stableCounter, (long)self.detectionCountBeforeCapture);
|
|
60
68
|
break;
|
|
61
|
-
case
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
break;
|
|
65
|
-
default:
|
|
66
|
-
// For other types (bad rectangle), reduce counter slowly instead of resetting
|
|
69
|
+
case IPDFRectangeTypeBadAngle:
|
|
70
|
+
case IPDFRectangeTypeTooFar:
|
|
71
|
+
// For bad rectangles, reduce counter slowly instead of resetting
|
|
67
72
|
if (self.stableCounter > 0) {
|
|
68
73
|
self.stableCounter--;
|
|
69
74
|
}
|