added cropper logic in ocr

This commit is contained in:
dhanabalan
2025-10-24 16:52:50 +05:30
parent 095929805f
commit 2062af55a1

View File

@@ -289,6 +289,10 @@ document.addEventListener('DOMContentLoaded', () => {
</div>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/cropperjs/1.5.13/cropper.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/cropperjs/1.5.13/cropper.min.js"></script>
<script>
function cameraCapture() {
return {
@@ -359,6 +363,12 @@ function cameraCapture() {
this.photoTaken = true;
// Create cropper on image
this.cropper = new Cropper(snapshot, {
aspectRatio: NaN, // User free crop area
viewMode: 1
});
if (this.stream) this.stream.getTracks().forEach(track => track.stop());
},
@@ -427,7 +437,6 @@ function cameraCapture() {
}
},
async retakePhoto() {
this.photoTaken = false;
this.$refs.snapshot.classList.add('hidden');
@@ -436,6 +445,7 @@ function cameraCapture() {
}
}
}
</script>