react-native-rectangle-doc-scanner 0.17.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.
@@ -146,7 +146,8 @@ const DocScanner = ({ onCapture, overlayColor = '#e7a649', autoCapture = true, m
146
146
  if (__DEV__) {
147
147
  console.log('[DocScanner] area ratio', area / (width * height));
148
148
  }
149
- if (area < width * height * 0.005) {
149
+ // Lower threshold to detect smaller documents
150
+ if (area < width * height * 0.0001) {
150
151
  continue;
151
152
  }
152
153
  step = `contour_${i}_arcLength`;
@@ -229,8 +230,21 @@ const DocScanner = ({ onCapture, overlayColor = '#e7a649', autoCapture = true, m
229
230
  y: pt.y / ratio,
230
231
  }));
231
232
  // Skip convexity check for boundingRect (always forms a valid rectangle)
232
- if (!usedBoundingRect && !isConvexQuadrilateral(points)) {
233
- continue;
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
+ }
234
248
  }
235
249
  if (area > maxArea) {
236
250
  best = points;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-rectangle-doc-scanner",
3
- "version": "0.17.0",
3
+ "version": "0.19.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": {
@@ -167,7 +167,8 @@ export const DocScanner: React.FC<Props> = ({
167
167
  console.log('[DocScanner] area ratio', area / (width * height));
168
168
  }
169
169
 
170
- if (area < width * height * 0.005) {
170
+ // Lower threshold to detect smaller documents
171
+ if (area < width * height * 0.0001) {
171
172
  continue;
172
173
  }
173
174
 
@@ -266,8 +267,20 @@ export const DocScanner: React.FC<Props> = ({
266
267
  }));
267
268
 
268
269
  // Skip convexity check for boundingRect (always forms a valid rectangle)
269
- if (!usedBoundingRect && !isConvexQuadrilateral(points)) {
270
- continue;
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
+ }
271
284
  }
272
285
 
273
286
  if (area > maxArea) {