react-native-rectangle-doc-scanner 3.237.0 → 3.238.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.
@@ -242,7 +242,7 @@ class DocumentDetector {
242
242
  }
243
243
 
244
244
  val minDim = kotlin.math.min(viewWidth.toDouble(), viewHeight.toDouble())
245
- val angleThreshold = max(40.0, minDim * 0.06)
245
+ val angleThreshold = max(60.0, minDim * 0.08)
246
246
 
247
247
  val topYDiff = abs(rectangle.topRight.y - rectangle.topLeft.y)
248
248
  val bottomYDiff = abs(rectangle.bottomLeft.y - rectangle.bottomRight.y)
@@ -253,7 +253,7 @@ class DocumentDetector {
253
253
  return RectangleQuality.BAD_ANGLE
254
254
  }
255
255
 
256
- val margin = max(80.0, minDim * 0.08)
256
+ val margin = max(120.0, minDim * 0.12)
257
257
  if (rectangle.topLeft.y > margin ||
258
258
  rectangle.topRight.y > margin ||
259
259
  rectangle.bottomLeft.y < (viewHeight - margin) ||
@@ -291,10 +291,11 @@ exports.DocScanner = (0, react_1.forwardRef)(({ onCapture, overlayColor = DEFAUL
291
291
  if (payload.rectangleCoordinates || payload.rectangleOnScreen) {
292
292
  lastRectangleRef.current = payload.rectangleCoordinates ?? payload.rectangleOnScreen ?? null;
293
293
  }
294
- const isGoodRectangle = payload.lastDetectionType === 0;
295
- const hasValidRectangle = isGoodRectangle && rectangleOnScreen;
296
- // 그리드를 표시할 조건: 좋은 품질의 사각형이 화면에 있을 때만
297
- if (hasValidRectangle) {
294
+ const hasAnyRectangle = react_native_1.Platform.OS === 'android'
295
+ ? Boolean(rectangleOnScreen || payload.rectangleCoordinates)
296
+ : payload.lastDetectionType === 0 && Boolean(rectangleOnScreen);
297
+ // 그리드를 표시할 조건: 사각형이 잡히면 품질과 무관하게 표시
298
+ if (hasAnyRectangle) {
298
299
  // 기존 타임아웃 클리어
299
300
  if (rectangleClearTimeoutRef.current) {
300
301
  clearTimeout(rectangleClearTimeoutRef.current);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-rectangle-doc-scanner",
3
- "version": "3.237.0",
3
+ "version": "3.238.0",
4
4
  "description": "Native-backed document scanner for React Native with customizable overlays.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -397,11 +397,13 @@ export const DocScanner = forwardRef<DocScannerHandle, Props>(
397
397
  lastRectangleRef.current = payload.rectangleCoordinates ?? payload.rectangleOnScreen ?? null;
398
398
  }
399
399
 
400
- const isGoodRectangle = payload.lastDetectionType === 0;
401
- const hasValidRectangle = isGoodRectangle && rectangleOnScreen;
400
+ const hasAnyRectangle =
401
+ Platform.OS === 'android'
402
+ ? Boolean(rectangleOnScreen || payload.rectangleCoordinates)
403
+ : payload.lastDetectionType === 0 && Boolean(rectangleOnScreen);
402
404
 
403
- // 그리드를 표시할 조건: 좋은 품질의 사각형이 화면에 있을 때만
404
- if (hasValidRectangle) {
405
+ // 그리드를 표시할 조건: 사각형이 잡히면 품질과 무관하게 표시
406
+ if (hasAnyRectangle) {
405
407
  // 기존 타임아웃 클리어
406
408
  if (rectangleClearTimeoutRef.current) {
407
409
  clearTimeout(rectangleClearTimeoutRef.current);