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(
|
|
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(
|
|
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) ||
|
package/dist/DocScanner.js
CHANGED
|
@@ -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
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
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
package/src/DocScanner.tsx
CHANGED
|
@@ -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
|
|
401
|
-
|
|
400
|
+
const hasAnyRectangle =
|
|
401
|
+
Platform.OS === 'android'
|
|
402
|
+
? Boolean(rectangleOnScreen || payload.rectangleCoordinates)
|
|
403
|
+
: payload.lastDetectionType === 0 && Boolean(rectangleOnScreen);
|
|
402
404
|
|
|
403
|
-
// 그리드를 표시할 조건:
|
|
404
|
-
if (
|
|
405
|
+
// 그리드를 표시할 조건: 사각형이 잡히면 품질과 무관하게 표시
|
|
406
|
+
if (hasAnyRectangle) {
|
|
405
407
|
// 기존 타임아웃 클리어
|
|
406
408
|
if (rectangleClearTimeoutRef.current) {
|
|
407
409
|
clearTimeout(rectangleClearTimeoutRef.current);
|