react-native-rectangle-doc-scanner 0.18.0 → 0.19.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/dist/DocScanner.js +15 -2
- package/package.json +1 -1
- package/src/DocScanner.tsx +14 -2
package/dist/DocScanner.js
CHANGED
|
@@ -230,8 +230,21 @@ const DocScanner = ({ onCapture, overlayColor = '#e7a649', autoCapture = true, m
|
|
|
230
230
|
y: pt.y / ratio,
|
|
231
231
|
}));
|
|
232
232
|
// Skip convexity check for boundingRect (always forms a valid rectangle)
|
|
233
|
-
if (!usedBoundingRect
|
|
234
|
-
|
|
233
|
+
if (!usedBoundingRect) {
|
|
234
|
+
try {
|
|
235
|
+
if (!isConvexQuadrilateral(points)) {
|
|
236
|
+
if (__DEV__) {
|
|
237
|
+
console.log('[DocScanner] not convex, skipping:', points);
|
|
238
|
+
}
|
|
239
|
+
continue;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
catch (err) {
|
|
243
|
+
if (__DEV__) {
|
|
244
|
+
console.warn('[DocScanner] convex check error:', err, 'points:', points);
|
|
245
|
+
}
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
235
248
|
}
|
|
236
249
|
if (area > maxArea) {
|
|
237
250
|
best = points;
|
package/package.json
CHANGED
package/src/DocScanner.tsx
CHANGED
|
@@ -267,8 +267,20 @@ export const DocScanner: React.FC<Props> = ({
|
|
|
267
267
|
}));
|
|
268
268
|
|
|
269
269
|
// Skip convexity check for boundingRect (always forms a valid rectangle)
|
|
270
|
-
if (!usedBoundingRect
|
|
271
|
-
|
|
270
|
+
if (!usedBoundingRect) {
|
|
271
|
+
try {
|
|
272
|
+
if (!isConvexQuadrilateral(points)) {
|
|
273
|
+
if (__DEV__) {
|
|
274
|
+
console.log('[DocScanner] not convex, skipping:', points);
|
|
275
|
+
}
|
|
276
|
+
continue;
|
|
277
|
+
}
|
|
278
|
+
} catch (err) {
|
|
279
|
+
if (__DEV__) {
|
|
280
|
+
console.warn('[DocScanner] convex check error:', err, 'points:', points);
|
|
281
|
+
}
|
|
282
|
+
continue;
|
|
283
|
+
}
|
|
272
284
|
}
|
|
273
285
|
|
|
274
286
|
if (area > maxArea) {
|