scanic 1.0.8 → 1.1.1
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/README.md +28 -0
- package/dist/scanic.js +720 -22
- package/dist/scanic.umd.cjs +1 -1
- package/package.json +6 -2
- package/src/scanic.d.ts +56 -0
package/README.md
CHANGED
|
@@ -95,6 +95,34 @@ if (extracted.success) {
|
|
|
95
95
|
}
|
|
96
96
|
```
|
|
97
97
|
|
|
98
|
+
### Manual Corner Adjustment UI (New)
|
|
99
|
+
|
|
100
|
+
Use the built-in corner editor to let users drag corners on mobile and desktop,
|
|
101
|
+
then pass the confirmed corners into extraction.
|
|
102
|
+
|
|
103
|
+
```js
|
|
104
|
+
import { createCornerEditor, extractDocument } from 'scanic';
|
|
105
|
+
|
|
106
|
+
const editor = createCornerEditor({
|
|
107
|
+
container: document.getElementById('editorHost'),
|
|
108
|
+
image: imageElement,
|
|
109
|
+
corners: detectedCorners, // optional: defaults to an inset quad
|
|
110
|
+
magnifier: {
|
|
111
|
+
zoom: 2,
|
|
112
|
+
size: 110
|
|
113
|
+
},
|
|
114
|
+
nudges: {
|
|
115
|
+
enabled: true,
|
|
116
|
+
steps: [1, 5]
|
|
117
|
+
},
|
|
118
|
+
onConfirm: async (corners) => {
|
|
119
|
+
const extracted = await extractDocument(imageElement, corners, { output: 'canvas' });
|
|
120
|
+
document.getElementById('output').appendChild(extracted.output);
|
|
121
|
+
editor.destroy();
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
```
|
|
125
|
+
|
|
98
126
|
### Optimized Usage (Recommended for Batch/Real-time)
|
|
99
127
|
The `Scanner` class maintains a persistent WebAssembly instance, avoiding the overhead of re-initializing WASM for every scan.
|
|
100
128
|
|