Spaces:
Running on Zero
Running on Zero
Tune tall-page auto zoom to ~88% and add pen/zoom note
Browse files
app.py
CHANGED
|
@@ -343,7 +343,8 @@ math[display="block"] { display: block; overflow-x: auto; max-width: 100%; }
|
|
| 343 |
window.__ocrWorkspaceZoomInit = true;
|
| 344 |
|
| 345 |
const stateByRoot = new WeakMap();
|
| 346 |
-
const targetZoomPct =
|
|
|
|
| 347 |
const tinyFitThresholdPct = 45;
|
| 348 |
|
| 349 |
const getState = (root) => {
|
|
@@ -395,7 +396,11 @@ math[display="block"] { display: block; overflow-x: auto; max-width: 100%; }
|
|
| 395 |
|
| 396 |
const step = () => {
|
| 397 |
const current = parseZoomPct(root);
|
| 398 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
|
|
| 399 |
state.busy = false;
|
| 400 |
state.applied = true;
|
| 401 |
return;
|
|
@@ -1677,11 +1682,12 @@ with gr.Blocks(**blocks_kwargs) as demo:
|
|
| 1677 |
2. Choose **Input Scope**:
|
| 1678 |
- `Entire Page` for the full page.
|
| 1679 |
- `Selected Region` for a specific area.
|
| 1680 |
-
2a. Workspace keeps native image resolution for clarity. For very tall pages, it auto-boosts from tiny fit view toward width-friendly zoom.
|
| 1681 |
3. For `Selected Region`, use the **Image Workspace**:
|
| 1682 |
- Recommended: freehand selection (draw/highlight target); app uses an automatic bounding box around your marks.
|
| 1683 |
- Optional rectangle selection: use the **Crop** tool.
|
| 1684 |
- Freehand/highlight ink is semi-transparent so underlying content stays visible.
|
|
|
|
| 1685 |
- Optional multi-select: click **Add Region** after each selection.
|
| 1686 |
- **Add Region** snapshots only newly drawn pixels so zoom/pan stays in place while you continue selecting.
|
| 1687 |
Then click **Extract**.
|
|
|
|
| 343 |
window.__ocrWorkspaceZoomInit = true;
|
| 344 |
|
| 345 |
const stateByRoot = new WeakMap();
|
| 346 |
+
const targetZoomPct = 88;
|
| 347 |
+
const nearTargetTolerancePct = 3;
|
| 348 |
const tinyFitThresholdPct = 45;
|
| 349 |
|
| 350 |
const getState = (root) => {
|
|
|
|
| 396 |
|
| 397 |
const step = () => {
|
| 398 |
const current = parseZoomPct(root);
|
| 399 |
+
if (
|
| 400 |
+
current == null ||
|
| 401 |
+
current >= (targetZoomPct - nearTargetTolerancePct) ||
|
| 402 |
+
steps >= 20
|
| 403 |
+
) {
|
| 404 |
state.busy = false;
|
| 405 |
state.applied = true;
|
| 406 |
return;
|
|
|
|
| 1682 |
2. Choose **Input Scope**:
|
| 1683 |
- `Entire Page` for the full page.
|
| 1684 |
- `Selected Region` for a specific area.
|
| 1685 |
+
2a. Workspace keeps native image resolution for clarity. For very tall pages, it auto-boosts from tiny fit view toward ~88% width-friendly zoom.
|
| 1686 |
3. For `Selected Region`, use the **Image Workspace**:
|
| 1687 |
- Recommended: freehand selection (draw/highlight target); app uses an automatic bounding box around your marks.
|
| 1688 |
- Optional rectangle selection: use the **Crop** tool.
|
| 1689 |
- Freehand/highlight ink is semi-transparent so underlying content stays visible.
|
| 1690 |
+
- Current known behavior: after zooming in/out, freehand stroke display may appear fully on mouse release (selection is still captured correctly).
|
| 1691 |
- Optional multi-select: click **Add Region** after each selection.
|
| 1692 |
- **Add Region** snapshots only newly drawn pixels so zoom/pan stays in place while you continue selecting.
|
| 1693 |
Then click **Extract**.
|