react-native-rectangle-doc-scanner 3.93.0 → 3.94.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/FullDocScanner.d.ts +2 -0
- package/dist/FullDocScanner.js +7 -36
- package/package.json +1 -1
- package/src/FullDocScanner.tsx +9 -35
package/dist/FullDocScanner.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export interface FullDocScannerResult {
|
|
|
8
8
|
base64?: string;
|
|
9
9
|
/** Original captured document info */
|
|
10
10
|
original?: CapturedDocument;
|
|
11
|
+
/** Rotation degrees (0, 90, 180, 270) */
|
|
12
|
+
rotation?: number;
|
|
11
13
|
}
|
|
12
14
|
export interface FullDocScannerStrings {
|
|
13
15
|
captureHint?: string;
|
package/dist/FullDocScanner.js
CHANGED
|
@@ -332,49 +332,20 @@ const FullDocScanner = ({ onResult, onClose, detectionConfig, overlayColor = '#3
|
|
|
332
332
|
const handleRotateImage = (0, react_1.useCallback)((degrees) => {
|
|
333
333
|
if (!croppedImageData)
|
|
334
334
|
return;
|
|
335
|
+
// UI에서만 회전 (실제 파일은 confirm 시에 처리)
|
|
335
336
|
setRotationDegrees(prev => {
|
|
336
337
|
const newRotation = (prev + degrees + 360) % 360;
|
|
337
338
|
return newRotation;
|
|
338
339
|
});
|
|
339
340
|
}, [croppedImageData]);
|
|
340
|
-
const handleConfirm = (0, react_1.useCallback)(
|
|
341
|
+
const handleConfirm = (0, react_1.useCallback)(() => {
|
|
341
342
|
if (!croppedImageData)
|
|
342
343
|
return;
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
mediaType: 'photo',
|
|
349
|
-
cropping: true,
|
|
350
|
-
freeStyleCropEnabled: true,
|
|
351
|
-
includeBase64: true,
|
|
352
|
-
compressImageQuality: 0.9,
|
|
353
|
-
cropperToolbarTitle: ' ',
|
|
354
|
-
cropperChooseText: '완료',
|
|
355
|
-
cropperCancelText: '취소',
|
|
356
|
-
cropperRotateButtonsHidden: false,
|
|
357
|
-
});
|
|
358
|
-
onResult({
|
|
359
|
-
path: rotatedImage.path,
|
|
360
|
-
base64: rotatedImage.data ?? undefined,
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
catch (error) {
|
|
364
|
-
console.error('[FullDocScanner] Image rotation error:', error);
|
|
365
|
-
// 에러 발생 시 원본 이미지 전송
|
|
366
|
-
onResult({
|
|
367
|
-
path: croppedImageData.path,
|
|
368
|
-
base64: croppedImageData.base64,
|
|
369
|
-
});
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
else {
|
|
373
|
-
onResult({
|
|
374
|
-
path: croppedImageData.path,
|
|
375
|
-
base64: croppedImageData.base64,
|
|
376
|
-
});
|
|
377
|
-
}
|
|
344
|
+
onResult({
|
|
345
|
+
path: croppedImageData.path,
|
|
346
|
+
base64: croppedImageData.base64,
|
|
347
|
+
rotation: rotationDegrees !== 0 ? rotationDegrees : undefined,
|
|
348
|
+
});
|
|
378
349
|
}, [croppedImageData, rotationDegrees, onResult]);
|
|
379
350
|
const handleRetake = (0, react_1.useCallback)(() => {
|
|
380
351
|
console.log('[FullDocScanner] Retake - clearing cropped image and resetting scanner');
|
package/package.json
CHANGED
package/src/FullDocScanner.tsx
CHANGED
|
@@ -102,6 +102,8 @@ export interface FullDocScannerResult {
|
|
|
102
102
|
base64?: string;
|
|
103
103
|
/** Original captured document info */
|
|
104
104
|
original?: CapturedDocument;
|
|
105
|
+
/** Rotation degrees (0, 90, 180, 270) */
|
|
106
|
+
rotation?: number;
|
|
105
107
|
}
|
|
106
108
|
|
|
107
109
|
export interface FullDocScannerStrings {
|
|
@@ -443,49 +445,21 @@ export const FullDocScanner: React.FC<FullDocScannerProps> = ({
|
|
|
443
445
|
const handleRotateImage = useCallback((degrees: -90 | 90) => {
|
|
444
446
|
if (!croppedImageData) return;
|
|
445
447
|
|
|
448
|
+
// UI에서만 회전 (실제 파일은 confirm 시에 처리)
|
|
446
449
|
setRotationDegrees(prev => {
|
|
447
450
|
const newRotation = (prev + degrees + 360) % 360;
|
|
448
451
|
return newRotation;
|
|
449
452
|
});
|
|
450
453
|
}, [croppedImageData]);
|
|
451
454
|
|
|
452
|
-
const handleConfirm = useCallback(
|
|
455
|
+
const handleConfirm = useCallback(() => {
|
|
453
456
|
if (!croppedImageData) return;
|
|
454
457
|
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
mediaType: 'photo',
|
|
461
|
-
cropping: true,
|
|
462
|
-
freeStyleCropEnabled: true,
|
|
463
|
-
includeBase64: true,
|
|
464
|
-
compressImageQuality: 0.9,
|
|
465
|
-
cropperToolbarTitle: ' ',
|
|
466
|
-
cropperChooseText: '완료',
|
|
467
|
-
cropperCancelText: '취소',
|
|
468
|
-
cropperRotateButtonsHidden: false,
|
|
469
|
-
});
|
|
470
|
-
|
|
471
|
-
onResult({
|
|
472
|
-
path: rotatedImage.path,
|
|
473
|
-
base64: rotatedImage.data ?? undefined,
|
|
474
|
-
});
|
|
475
|
-
} catch (error) {
|
|
476
|
-
console.error('[FullDocScanner] Image rotation error:', error);
|
|
477
|
-
// 에러 발생 시 원본 이미지 전송
|
|
478
|
-
onResult({
|
|
479
|
-
path: croppedImageData.path,
|
|
480
|
-
base64: croppedImageData.base64,
|
|
481
|
-
});
|
|
482
|
-
}
|
|
483
|
-
} else {
|
|
484
|
-
onResult({
|
|
485
|
-
path: croppedImageData.path,
|
|
486
|
-
base64: croppedImageData.base64,
|
|
487
|
-
});
|
|
488
|
-
}
|
|
458
|
+
onResult({
|
|
459
|
+
path: croppedImageData.path,
|
|
460
|
+
base64: croppedImageData.base64,
|
|
461
|
+
rotation: rotationDegrees !== 0 ? rotationDegrees : undefined,
|
|
462
|
+
});
|
|
489
463
|
}, [croppedImageData, rotationDegrees, onResult]);
|
|
490
464
|
|
|
491
465
|
const handleRetake = useCallback(() => {
|