react-native-rectangle-doc-scanner 3.95.0 → 3.96.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.js
CHANGED
|
@@ -330,18 +330,17 @@ const FullDocScanner = ({ onResult, onClose, detectionConfig, overlayColor = '#3
|
|
|
330
330
|
const handleFlashToggle = (0, react_1.useCallback)(() => {
|
|
331
331
|
setFlashEnabled(prev => !prev);
|
|
332
332
|
}, []);
|
|
333
|
-
const handleRotateImage = (0, react_1.useCallback)(
|
|
333
|
+
const handleRotateImage = (0, react_1.useCallback)((degrees) => {
|
|
334
334
|
if (!croppedImageData)
|
|
335
335
|
return;
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
const rotatedImagePath = await react_native_image_rotate_1.default.rotateImage(croppedImageData.path, degrees);
|
|
336
|
+
// UI 회전 상태 먼저 업데이트 (즉각 반응)
|
|
337
|
+
setRotationDegrees(prev => {
|
|
338
|
+
const newRotation = (prev + degrees + 360) % 360;
|
|
339
|
+
return newRotation;
|
|
340
|
+
});
|
|
341
|
+
console.log('[FullDocScanner] Starting image rotation...');
|
|
342
|
+
// ImageRotate를 사용해서 실제로 이미지 회전 (callback 기반)
|
|
343
|
+
react_native_image_rotate_1.default.rotateImage(croppedImageData.path, degrees, (rotatedImagePath) => {
|
|
345
344
|
console.log('[FullDocScanner] Image rotated successfully:', rotatedImagePath);
|
|
346
345
|
// 회전된 이미지로 교체
|
|
347
346
|
setCroppedImageData({
|
|
@@ -350,15 +349,14 @@ const FullDocScanner = ({ onResult, onClose, detectionConfig, overlayColor = '#3
|
|
|
350
349
|
});
|
|
351
350
|
// rotation degrees는 0으로 리셋 (이미 실제 파일에 적용되었으므로)
|
|
352
351
|
setRotationDegrees(0);
|
|
353
|
-
}
|
|
354
|
-
catch (error) {
|
|
352
|
+
}, (error) => {
|
|
355
353
|
console.error('[FullDocScanner] Image rotation error:', error);
|
|
356
354
|
// 에러 발생 시 UI rotation 원복
|
|
357
355
|
setRotationDegrees(prev => {
|
|
358
356
|
const revertRotation = (prev - degrees + 360) % 360;
|
|
359
357
|
return revertRotation;
|
|
360
358
|
});
|
|
361
|
-
}
|
|
359
|
+
});
|
|
362
360
|
}, [croppedImageData]);
|
|
363
361
|
const handleConfirm = (0, react_1.useCallback)(() => {
|
|
364
362
|
if (!croppedImageData)
|
package/package.json
CHANGED
package/src/FullDocScanner.tsx
CHANGED
|
@@ -441,42 +441,42 @@ export const FullDocScanner: React.FC<FullDocScannerProps> = ({
|
|
|
441
441
|
setFlashEnabled(prev => !prev);
|
|
442
442
|
}, []);
|
|
443
443
|
|
|
444
|
-
const handleRotateImage = useCallback(
|
|
444
|
+
const handleRotateImage = useCallback((degrees: -90 | 90) => {
|
|
445
445
|
if (!croppedImageData) return;
|
|
446
446
|
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
});
|
|
447
|
+
// UI 회전 상태 먼저 업데이트 (즉각 반응)
|
|
448
|
+
setRotationDegrees(prev => {
|
|
449
|
+
const newRotation = (prev + degrees + 360) % 360;
|
|
450
|
+
return newRotation;
|
|
451
|
+
});
|
|
453
452
|
|
|
454
|
-
|
|
453
|
+
console.log('[FullDocScanner] Starting image rotation...');
|
|
455
454
|
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
)
|
|
455
|
+
// ImageRotate를 사용해서 실제로 이미지 회전 (callback 기반)
|
|
456
|
+
ImageRotate.rotateImage(
|
|
457
|
+
croppedImageData.path,
|
|
458
|
+
degrees,
|
|
459
|
+
(rotatedImagePath: string) => {
|
|
460
|
+
console.log('[FullDocScanner] Image rotated successfully:', rotatedImagePath);
|
|
461
461
|
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
base64: undefined, // base64는 다시 읽어야 함
|
|
468
|
-
});
|
|
462
|
+
// 회전된 이미지로 교체
|
|
463
|
+
setCroppedImageData({
|
|
464
|
+
path: rotatedImagePath,
|
|
465
|
+
base64: undefined, // base64는 다시 읽어야 함
|
|
466
|
+
});
|
|
469
467
|
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
468
|
+
// rotation degrees는 0으로 리셋 (이미 실제 파일에 적용되었으므로)
|
|
469
|
+
setRotationDegrees(0);
|
|
470
|
+
},
|
|
471
|
+
(error: Error) => {
|
|
472
|
+
console.error('[FullDocScanner] Image rotation error:', error);
|
|
473
|
+
// 에러 발생 시 UI rotation 원복
|
|
474
|
+
setRotationDegrees(prev => {
|
|
475
|
+
const revertRotation = (prev - degrees + 360) % 360;
|
|
476
|
+
return revertRotation;
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
);
|
|
480
480
|
}, [croppedImageData]);
|
|
481
481
|
|
|
482
482
|
const handleConfirm = useCallback(() => {
|