@tobyt/expo-pdf-markup 1.1.4 → 2.0.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/CHANGELOG.md +22 -0
- package/README.md +18 -0
- package/android/build.gradle +3 -0
- package/android/src/main/java/dev/terhoeven/expopdfmarkup/BookPager.kt +66 -0
- package/android/src/main/java/dev/terhoeven/expopdfmarkup/BookTurnPolicy.kt +117 -0
- package/android/src/main/java/dev/terhoeven/expopdfmarkup/ContinuousPdfView.kt +370 -57
- package/android/src/main/java/dev/terhoeven/expopdfmarkup/ExpoPdfMarkupModule.kt +4 -0
- package/android/src/main/java/dev/terhoeven/expopdfmarkup/ExpoPdfMarkupView.kt +96 -5
- package/build/ExpoPdfMarkup.types.d.ts +19 -1
- package/build/ExpoPdfMarkup.types.d.ts.map +1 -1
- package/build/ExpoPdfMarkup.types.js.map +1 -1
- package/build/ExpoPdfMarkupView.web.d.ts.map +1 -1
- package/build/ExpoPdfMarkupView.web.js +396 -65
- package/build/ExpoPdfMarkupView.web.js.map +1 -1
- package/build/web/bookMode.d.ts +77 -0
- package/build/web/bookMode.d.ts.map +1 -0
- package/build/web/bookMode.js +169 -0
- package/build/web/bookMode.js.map +1 -0
- package/build/web/layout.d.ts +8 -0
- package/build/web/layout.d.ts.map +1 -0
- package/build/web/layout.js +22 -0
- package/build/web/layout.js.map +1 -0
- package/build/web/types.d.ts +2 -0
- package/build/web/types.d.ts.map +1 -1
- package/build/web/types.js.map +1 -1
- package/docs/agents/domain.md +51 -0
- package/docs/agents/issue-tracker.md +46 -0
- package/docs/agents/triage-labels.md +15 -0
- package/docs/annotation-coordinates.md +45 -0
- package/docs/annotation-validation.md +117 -0
- package/fixtures/annotations-v1.json +130 -0
- package/ios/AnnotationModels.swift +29 -30
- package/ios/AnnotationSerializer.swift +99 -12
- package/ios/ExpoPdfMarkupModule.swift +4 -0
- package/ios/ExpoPdfMarkupView+Book.swift +455 -0
- package/ios/ExpoPdfMarkupView+Ink.swift +13 -28
- package/ios/ExpoPdfMarkupView+Markup.swift +151 -0
- package/ios/ExpoPdfMarkupView+Move.swift +17 -6
- package/ios/ExpoPdfMarkupView.swift +76 -84
- package/ios/StampPDFAnnotation.swift +21 -3
- package/ios/Tests/AnnotationCoordinateTests.swift +337 -0
- package/ios/Tests/AnnotationSerializerTests.swift +43 -1
- package/ios/Tests/AreaMarkupTests.swift +279 -0
- package/ios/Tests/BookModeTests.swift +534 -0
- package/ios/Tests/ExpoPdfMarkupViewTests.swift +29 -0
- package/ios/Tests/RotatedAnnotationRenderingTests.swift +411 -0
- package/ios/Tests/book-sample.pdf +207 -0
- package/ios/Tests/single-page.pdf +52 -0
- package/package.json +3 -2
- package/src/ExpoPdfMarkup.types.ts +20 -1
- package/src/ExpoPdfMarkupView.web.tsx +471 -70
- package/src/web/bookMode.ts +186 -0
- package/src/web/layout.ts +30 -0
- package/src/web/types.ts +3 -0
- package/tsconfig.test.json +10 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Layout for every page. Continuous mode fits each page to the view's width. Book mode fits the
|
|
3
|
+
* whole page into the view, falling back to width when the height isn't known yet.
|
|
4
|
+
*/
|
|
5
|
+
export function computePageMetas(sizes, viewWidth, viewHeight, displayMode, dpr) {
|
|
6
|
+
if (viewWidth <= 0)
|
|
7
|
+
return [];
|
|
8
|
+
return sizes.map(({ pdfWidth, pdfHeight }) => {
|
|
9
|
+
const widthScale = viewWidth / pdfWidth;
|
|
10
|
+
const scale = displayMode === 'book' && viewHeight > 0
|
|
11
|
+
? Math.min(widthScale, viewHeight / pdfHeight)
|
|
12
|
+
: widthScale;
|
|
13
|
+
return {
|
|
14
|
+
pdfWidth,
|
|
15
|
+
pdfHeight,
|
|
16
|
+
scale,
|
|
17
|
+
canvasWidth: Math.round(pdfWidth * scale * dpr),
|
|
18
|
+
canvasHeight: Math.round(pdfHeight * scale * dpr),
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../../src/web/layout.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAC9B,KAAiB,EACjB,SAAiB,EACjB,UAAkB,EAClB,WAAwB,EACxB,GAAW;IAEX,IAAI,SAAS,IAAI,CAAC;QAAE,OAAO,EAAE,CAAC;IAC9B,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE;QAC3C,MAAM,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC;QACxC,MAAM,KAAK,GACT,WAAW,KAAK,MAAM,IAAI,UAAU,GAAG,CAAC;YACtC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,UAAU,GAAG,SAAS,CAAC;YAC9C,CAAC,CAAC,UAAU,CAAC;QACjB,OAAO;YACL,QAAQ;YACR,SAAS;YACT,KAAK;YACL,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,KAAK,GAAG,GAAG,CAAC;YAC/C,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,KAAK,GAAG,GAAG,CAAC;SAClD,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { DisplayMode } from '../ExpoPdfMarkup.types';\nimport type { PageSize, PdfPageMeta } from './types';\n\n/**\n * Layout for every page. Continuous mode fits each page to the view's width. Book mode fits the\n * whole page into the view, falling back to width when the height isn't known yet.\n */\nexport function computePageMetas(\n sizes: PageSize[],\n viewWidth: number,\n viewHeight: number,\n displayMode: DisplayMode,\n dpr: number\n): PdfPageMeta[] {\n if (viewWidth <= 0) return [];\n return sizes.map(({ pdfWidth, pdfHeight }) => {\n const widthScale = viewWidth / pdfWidth;\n const scale =\n displayMode === 'book' && viewHeight > 0\n ? Math.min(widthScale, viewHeight / pdfHeight)\n : widthScale;\n return {\n pdfWidth,\n pdfHeight,\n scale,\n canvasWidth: Math.round(pdfWidth * scale * dpr),\n canvasHeight: Math.round(pdfHeight * scale * dpr),\n };\n });\n}\n"]}
|
package/build/web/types.d.ts
CHANGED
|
@@ -10,4 +10,6 @@ export type PdfPageMeta = {
|
|
|
10
10
|
/** Canvas backing height in physical pixels (CSS height × devicePixelRatio) */
|
|
11
11
|
canvasHeight: number;
|
|
12
12
|
};
|
|
13
|
+
/** A page's size in PDF user-space points, as read from the document before any layout. */
|
|
14
|
+
export type PageSize = Pick<PdfPageMeta, 'pdfWidth' | 'pdfHeight'>;
|
|
13
15
|
//# sourceMappingURL=types.d.ts.map
|
package/build/web/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/web/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACxB,8CAA8C;IAC9C,QAAQ,EAAE,MAAM,CAAC;IACjB,+CAA+C;IAC/C,SAAS,EAAE,MAAM,CAAC;IAClB,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,WAAW,EAAE,MAAM,CAAC;IACpB,+EAA+E;IAC/E,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/web/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACxB,8CAA8C;IAC9C,QAAQ,EAAE,MAAM,CAAC;IACjB,+CAA+C;IAC/C,SAAS,EAAE,MAAM,CAAC;IAClB,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,WAAW,EAAE,MAAM,CAAC;IACpB,+EAA+E;IAC/E,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,2FAA2F;AAC3F,MAAM,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,UAAU,GAAG,WAAW,CAAC,CAAC"}
|
package/build/web/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/web/types.ts"],"names":[],"mappings":"","sourcesContent":["export type PdfPageMeta = {\n /** PDF page width in PDF user-space points */\n pdfWidth: number;\n /** PDF page height in PDF user-space points */\n pdfHeight: number;\n /** Pixels per PDF point (containerWidth / pdfWidth) */\n scale: number;\n /** Canvas backing width in physical pixels (CSS width × devicePixelRatio) */\n canvasWidth: number;\n /** Canvas backing height in physical pixels (CSS height × devicePixelRatio) */\n canvasHeight: number;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/web/types.ts"],"names":[],"mappings":"","sourcesContent":["export type PdfPageMeta = {\n /** PDF page width in PDF user-space points */\n pdfWidth: number;\n /** PDF page height in PDF user-space points */\n pdfHeight: number;\n /** Pixels per PDF point (containerWidth / pdfWidth) */\n scale: number;\n /** Canvas backing width in physical pixels (CSS width × devicePixelRatio) */\n canvasWidth: number;\n /** Canvas backing height in physical pixels (CSS height × devicePixelRatio) */\n canvasHeight: number;\n};\n\n/** A page's size in PDF user-space points, as read from the document before any layout. */\nexport type PageSize = Pick<PdfPageMeta, 'pdfWidth' | 'pdfHeight'>;\n"]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Domain Docs
|
|
2
|
+
|
|
3
|
+
How the engineering skills should consume this repo's domain documentation when exploring the codebase.
|
|
4
|
+
|
|
5
|
+
## Before exploring, read these
|
|
6
|
+
|
|
7
|
+
- **`GLOSSARY.md`** at the repo root, or
|
|
8
|
+
- **`GLOSSARY-MAP.md`** at the repo root if it exists: it points at one `GLOSSARY.md` per context. Read each one relevant to the topic.
|
|
9
|
+
- **`docs/adr/`**: read ADRs that touch the area you're about to work in. In multi-context repos, also check `src/<context>/docs/adr/` for context-scoped decisions.
|
|
10
|
+
|
|
11
|
+
If any of these files don't exist, **proceed silently**. Don't flag their absence; don't suggest creating them upfront. The `/domain-modeling` skill (reached via `/grill-with-docs` and `/improve-codebase-architecture`) creates them lazily when terms or decisions actually get resolved.
|
|
12
|
+
|
|
13
|
+
## File structure
|
|
14
|
+
|
|
15
|
+
Single-context repo (most repos):
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
/
|
|
19
|
+
├── GLOSSARY.md
|
|
20
|
+
├── docs/adr/
|
|
21
|
+
│ ├── 0001-event-sourced-orders.md
|
|
22
|
+
│ └── 0002-postgres-for-write-model.md
|
|
23
|
+
└── src/
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Multi-context repo (presence of `GLOSSARY-MAP.md` at the root):
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
/
|
|
30
|
+
├── GLOSSARY-MAP.md
|
|
31
|
+
├── docs/adr/ ← system-wide decisions
|
|
32
|
+
└── src/
|
|
33
|
+
├── ordering/
|
|
34
|
+
│ ├── GLOSSARY.md
|
|
35
|
+
│ └── docs/adr/ ← context-specific decisions
|
|
36
|
+
└── billing/
|
|
37
|
+
├── GLOSSARY.md
|
|
38
|
+
└── docs/adr/
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Use the glossary's vocabulary
|
|
42
|
+
|
|
43
|
+
When your output names a domain concept (in an issue title, a refactor proposal, a hypothesis, a test name), use the term as defined in `GLOSSARY.md`. Don't drift to synonyms the glossary explicitly avoids.
|
|
44
|
+
|
|
45
|
+
If the concept you need isn't in the glossary yet, that's a signal: either you're inventing language the project doesn't use (reconsider) or there's a real gap (note it for `/domain-modeling`).
|
|
46
|
+
|
|
47
|
+
## Flag ADR conflicts
|
|
48
|
+
|
|
49
|
+
If your output contradicts an existing ADR, surface it explicitly rather than silently overriding:
|
|
50
|
+
|
|
51
|
+
> _Contradicts ADR-0007 (event-sourced orders), but worth reopening because…_
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Issue tracker: GitHub
|
|
2
|
+
|
|
3
|
+
Issues and specs for this repo live as GitHub issues. Use the `gh` CLI for all operations.
|
|
4
|
+
|
|
5
|
+
## Conventions
|
|
6
|
+
|
|
7
|
+
- **Create an issue**: `gh issue create --title "..." --body "..."`. Use a heredoc for multi-line bodies.
|
|
8
|
+
- **Read an issue**: `gh issue view <number> --json number,title,body,labels,comments`.
|
|
9
|
+
- **List issues**: `gh issue list --state open --json number,title,body,labels,comments --jq '[.[] | {number, title, body, labels: [.labels[].name], comments: [.comments[].body]}]'` with appropriate `--label` and `--state` filters.
|
|
10
|
+
- **Make an issue a sub-issue of a parent**: `gh issue create --parent <parent> ...`, or `gh issue edit <parent> --add-sub-issue <child>` afterwards (`gh` 2.94+). Older `gh`: `gh api --method POST repos/<owner>/<repo>/issues/<parent>/sub_issues -F sub_issue_id=<child-db-id>` (database id, as in **Blocking** below). Without sub-issues, put `Part of #<parent>` at the top of the child body.
|
|
11
|
+
- **Comment on an issue**: `gh issue comment <number> --body "..."`
|
|
12
|
+
- **Apply / remove labels**: `gh issue edit <number> --add-label "..."` / `--remove-label "..."`
|
|
13
|
+
- **Close**: `gh issue close <number> --comment "..."`
|
|
14
|
+
|
|
15
|
+
Infer the repo from `git remote -v`; `gh` does this automatically when run inside a clone.
|
|
16
|
+
|
|
17
|
+
## Pull requests as a triage surface
|
|
18
|
+
|
|
19
|
+
**PRs as a request surface: no.** _(Set to `yes` if this repo treats external PRs as feature requests; `/triage` reads this flag.)_
|
|
20
|
+
|
|
21
|
+
When set to `yes`, PRs run through the same labels and states as issues, using the `gh pr` equivalents:
|
|
22
|
+
|
|
23
|
+
- **Read a PR**: `gh pr view <number> --comments` and `gh pr diff <number>` for the diff.
|
|
24
|
+
- **List external PRs for triage**: `gh api --paginate 'repos/{owner}/{repo}/pulls?state=open' --jq '.[] | select(.author_association | IN("OWNER","MEMBER","COLLABORATOR") | not) | {number, title, author: .user.login, author_association, labels: [.labels[].name]}'`.
|
|
25
|
+
- **Comment / label / close**: `gh pr comment`, `gh pr edit --add-label`/`--remove-label`, `gh pr close`.
|
|
26
|
+
|
|
27
|
+
GitHub shares one number space across issues and PRs, so a bare `#42` may be either: resolve with `gh pr view 42` and fall back to `gh issue view 42`.
|
|
28
|
+
|
|
29
|
+
## When a skill says "publish to the issue tracker"
|
|
30
|
+
|
|
31
|
+
Create a GitHub issue.
|
|
32
|
+
|
|
33
|
+
## When a skill says "fetch the relevant ticket"
|
|
34
|
+
|
|
35
|
+
Read it as in **Read an issue** above.
|
|
36
|
+
|
|
37
|
+
## Wayfinding operations
|
|
38
|
+
|
|
39
|
+
Used by `/wayfinder`. The **map** is a single issue with **child** issues as tickets.
|
|
40
|
+
|
|
41
|
+
- **Map**: a single issue labelled `wayfinder:map`, holding the Notes / Decisions-so-far / Fog body. `gh issue create --label wayfinder:map`.
|
|
42
|
+
- **Child ticket**: an issue linked to the map as a GitHub sub-issue (see **Make an issue a sub-issue of a parent**). Where sub-issues aren't enabled, add the child to a task list in the map body and put `Part of #<map>` at the top of the child body. Labels: `wayfinder:<type>` (`research`/`prototype`/`grilling`/`task`). Once claimed, the ticket is assigned to the driving dev.
|
|
43
|
+
- **Blocking**: GitHub's **native issue dependencies**, the canonical, UI-visible representation. Add an edge with `gh api --method POST repos/<owner>/<repo>/issues/<child>/dependencies/blocked_by -F issue_id=<blocker-db-id>`, where `<blocker-db-id>` is the blocker's numeric **database id** (`gh api repos/<owner>/<repo>/issues/<n> --jq .id`, _not_ the `#number` or `node_id`). GitHub reports `issue_dependencies_summary.blocked_by` (open blockers only, the live gate). Where dependencies aren't available, fall back to a `Blocked by: #<n>, #<n>` line at the top of the child body. A ticket is unblocked when every blocker is closed.
|
|
44
|
+
- **Frontier query**: list the map's open children (`gh issue list --state open`, scoped to the map's sub-issues / task list), drop any with an open blocker (`issue_dependencies_summary.blocked_by > 0`, or an open issue in the `Blocked by` line) or an assignee; first in map order wins.
|
|
45
|
+
- **Claim**: `gh issue edit <n> --add-assignee @me`, the session's first write.
|
|
46
|
+
- **Resolve**: `gh issue comment <n> --body "<answer>"`, then `gh issue close <n>`, then append a context pointer (gist + link) to the map's Decisions-so-far.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Triage Labels
|
|
2
|
+
|
|
3
|
+
The skills speak in terms of five canonical triage roles. This file maps those roles to the actual label strings used in this repo's issue tracker.
|
|
4
|
+
|
|
5
|
+
| Label in mattpocock/skills | Label in our tracker | Meaning |
|
|
6
|
+
| -------------------------- | -------------------- | ---------------------------------------- |
|
|
7
|
+
| `needs-triage` | `needs-triage` | Maintainer needs to evaluate this issue |
|
|
8
|
+
| `needs-info` | `needs-info` | Waiting on reporter for more information |
|
|
9
|
+
| `ready-for-agent` | `ready-for-agent` | Fully specified, ready for an AFK agent |
|
|
10
|
+
| `ready-for-human` | `ready-for-human` | Requires human implementation |
|
|
11
|
+
| `wontfix` | `wontfix` | Will not be actioned |
|
|
12
|
+
|
|
13
|
+
When a skill mentions a role (e.g. "apply the AFK-ready triage label"), use the corresponding label string from this table.
|
|
14
|
+
|
|
15
|
+
Edit the "Label in our tracker" column to match whatever vocabulary you actually use.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Annotation coordinates
|
|
2
|
+
|
|
3
|
+
All platforms exchange `AnnotationsData` version 1 using the same visible-page coordinate system:
|
|
4
|
+
|
|
5
|
+
- Units are PDF points, independent of screen density, zoom and scrolling.
|
|
6
|
+
- The origin `(0, 0)` is the bottom-left of the visible page after its PDF rotation.
|
|
7
|
+
- `x` increases rightward; `y` increases upward.
|
|
8
|
+
- Ink `paths` contain visible-page points. Rectangular `bounds` use the same space: `x` and `y` locate the bottom-left, with positive `width` and `height`.
|
|
9
|
+
- The contract applies to ink, highlight, underline, text/freeText, stamps, and text-input-request points. `page` remains a zero-based page index.
|
|
10
|
+
|
|
11
|
+
For example, a PDF with MediaBox `[0,0,800,1000]` and CropBox `[100,80,700,920]` has a visible size of 600 by 840 points at rotation 0. A model point `(80,120)` covers native PDF page point `(180,200)`. With clockwise rotation 90, visible size is 840 by 600 and the same model point covers native page point `(580,160)`.
|
|
12
|
+
|
|
13
|
+
## iOS boundaries
|
|
14
|
+
|
|
15
|
+
PDFKit touch conversion and native annotation rectangles use unrotated PDF page coordinates, including the crop origin. `AnnotationCoordinates` converts these coordinates to/from the interchange model. Loading and serialization apply this adapter in opposite directions, including page rotation.
|
|
16
|
+
|
|
17
|
+
PDFKit ink paths are local to their annotation rectangle. The module converts native page points to local path points when constructing an annotation, and adds the rectangle origin before serializing, outlining or hit-testing it. Live ink uses the same construction path as loaded ink. Custom stamps and area underlines draw in visible-page coordinates. A shared drawing adapter accounts for the different clips PDFKit supplies when recording a live appearance and rendering a whole page or thumbnail. Transparent native appearance padding stays separate from serialized content bounds and editing/hit geometry, including for full-page annotations and scaled thumbnails. Underlines retain their public `underline` model type while using a custom native appearance so PDFKit renders the selected lower edge in the live view too.
|
|
18
|
+
|
|
19
|
+
Live text creation and editing also measure and place text in visible-page coordinates, using the same integral dimensions as the loader. Editing preserves the annotation ID, timestamp, color, font and model type; reopening does not remeasure text along a different axis.
|
|
20
|
+
|
|
21
|
+
Moving annotations operates in visible-page coordinates and clamps to the visible page dimensions. Outlines and eraser/move hit targets use the rendered native geometry. Neither zooming nor scrolling alters saved coordinates.
|
|
22
|
+
|
|
23
|
+
## Existing v1 data
|
|
24
|
+
|
|
25
|
+
Valid web/Android v1 coordinates keep their existing placement; no schema change or automatic migration is applied. IDs, page indices, content, color and styling survive load/save cycles. `text` and `freeText` both render as native free text while retaining their interchange type.
|
|
26
|
+
|
|
27
|
+
Historical native v1 records do not reliably identify their originating platform or coordinate convention. A record containing native page coordinates can be indistinguishable from an intentional visible-page placement. The module does not guess the original intent, subtract an offset from every stored record, or rewrite a host application's store. Back up existing records and review affected documents when upgrading. Recovery of ambiguous historical data requires application-specific information about how that data was created.
|
|
28
|
+
|
|
29
|
+
Consumers must rebuild their native iOS application to adopt the Swift correction. Updating JavaScript or delivering an OTA update alone does not replace compiled native code. Package publication is a separate maintainer action.
|
|
30
|
+
|
|
31
|
+
## Regression coverage
|
|
32
|
+
|
|
33
|
+
`ios/Tests/AnnotationCoordinateTests.swift` generates project-owned raster-only PDF fixtures with asymmetric anchors, with optional selectable text. Coverage includes nonzero x/y crop origins, zero-origin media-box and right/top-only crop controls, rotations 0/90/180/270, live ink commitment, rendered thumbnails, zoom/scroll movement, editing outlines, hit targets and live stamp snapshots before/after reloading.
|
|
34
|
+
|
|
35
|
+
`fixtures/annotations-v1.json` supplies the same marks to iOS, web and Android model tests, including ink, highlight/underline, text/freeText and music/star/emoji stamps. Repeated round trips assert placement and metadata preservation.
|
|
36
|
+
|
|
37
|
+
Native interaction tests drive the existing overlay callbacks and gesture-handler seam. They exercise the real PDFKit view and rendering, but do not synthesize physical finger/Pencil events. Simulator results and outstanding physical-device checks are recorded separately in the implementation's validation report.
|
|
38
|
+
|
|
39
|
+
## Area markup on iOS
|
|
40
|
+
|
|
41
|
+
The highlight and underline tools capture a one-finger rectangular drag on both scanned and text-bearing PDFs. No text selection or OCR is required, and rectangles do not snap to text lines. A highlight fills the chosen area; an underline marks its displayed lower edge. The same visible-page bounds are emitted through `onAnnotationsChanged` and retained after reloading.
|
|
42
|
+
|
|
43
|
+
Touch scrolling, pinch zoom and book-mode touch turns are suspended while the tool is active. Select `annotationMode="none"` for touch navigation and zoom, then reselect the desired markup tool. The `page` prop and book-mode hardware keys remain available during markup. Page/source/display changes, cancelled gestures and tool switches discard an unfinished drag; a drag cannot transfer its mark to another page. Leaving the tool restores the previous scrolling and gesture state.
|
|
44
|
+
|
|
45
|
+
`ios/Tests/AreaMarkupTests.swift` covers the input-to-render-to-serialization path with raster-only and selectable-text controls, crop controls, all rotations, zoom/scroll, fresh-view reopen, movement/hit geometry, cancellation, tool switching and explicit navigation. Tests use each simulator's screen dimensions. As with the coordinate suite, callback-driven tests do not replace physical finger/Pencil validation.
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Annotation validation for spec #126
|
|
2
|
+
|
|
3
|
+
## Manual regression PDFs in the example app
|
|
4
|
+
|
|
5
|
+
The example's horizontal document picker includes **Scan regression (6 pages)** and
|
|
6
|
+
**Text regression (4 pages)**. Scroll the document row to find them. Both files are
|
|
7
|
+
bundled in `example/assets/`; no external document or download is required.
|
|
8
|
+
|
|
9
|
+
| Sample | Pages | Purpose |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
| Scan regression | 1–4 | Image-only MediaBox `[0,0,800,1000]`, CropBox `[100,80,700,920]`, rotations 0/90/180/270 |
|
|
12
|
+
| Scan regression | 5 | Image-only uncropped, zero-origin control |
|
|
13
|
+
| Scan regression | 6 | Image-only zero-origin CropBox `[0,0,600,840]` with different right/top edges |
|
|
14
|
+
| Text regression | 1–4 | The same nonzero crop and rotations, with an actual selectable-text sentence |
|
|
15
|
+
|
|
16
|
+
The scan's labels, lines and asymmetric blue/green anchors are raster pixels; the PDF
|
|
17
|
+
contains no selectable text. On the text controls, the sentence beginning “Selectable
|
|
18
|
+
text” is real PDF text, while the surrounding visual guides remain rasterized.
|
|
19
|
+
|
|
20
|
+
1. Select **Scan regression**, then **Ink**. Trace an anchor or staff line; the stroke
|
|
21
|
+
must stay in place when you lift your finger.
|
|
22
|
+
2. Select **Highlight** or **Underline** and drag a rectangle over a guide. The page
|
|
23
|
+
must stay still; highlighting fills the area and underlining follows its lower edge.
|
|
24
|
+
3. Try **Text**, then **Stamp** with **Note**, **Star** and **Emoji**, including near the
|
|
25
|
+
visible edges. Check placement and clipping on all four rotated pages.
|
|
26
|
+
4. Select **Move** or **Eraser**. Blue outlines and touch targets must agree with the
|
|
27
|
+
marks. Switch to **View** to navigate/pinch, then repeat after zooming and scrolling.
|
|
28
|
+
5. Repeat with **Text regression**, and compare the scan's zero-origin controls. Book
|
|
29
|
+
mode makes it easy to review each rotation separately.
|
|
30
|
+
6. Open **Annotations → Show raw JSON** to inspect the saved paths and bounds. The
|
|
31
|
+
example keeps annotations in memory and clears them when changing documents or
|
|
32
|
+
restarting; this UI does not itself test persistent save/reopen or thumbnails.
|
|
33
|
+
|
|
34
|
+
Regenerate both checked-in PDFs with `python3 scripts/generate_annotation_pdfs.py`
|
|
35
|
+
(requires Pillow >= 10.1 and PyMuPDF; installation is documented in the script).
|
|
36
|
+
All fixture content is generated for this project and is redistributable.
|
|
37
|
+
|
|
38
|
+
## Coordinate slice (#127), 2026-11-15
|
|
39
|
+
|
|
40
|
+
All repository changes and native builds ran in a task-specific linked worktree.
|
|
41
|
+
|
|
42
|
+
| Check | Result |
|
|
43
|
+
| --- | --- |
|
|
44
|
+
| `npm run qa:ts` | Passed; 25 suites, 282 tests passed, 72 tests skipped by the existing platform configuration |
|
|
45
|
+
| `npm run qa:ios` | Passed; formatting, SwiftLint (no serious violations), 95 XCTest cases |
|
|
46
|
+
| iPhone 13 mini, iOS 26.4 simulator (locally named `cramped`) | 95 XCTest cases passed |
|
|
47
|
+
| iPad Pro 13-inch (M5), iOS 26.4 simulator | 95 XCTest cases passed |
|
|
48
|
+
| `npm run format:swift:check` and `git diff --check` | Passed |
|
|
49
|
+
| Android shared-fixture QA | Run independently with the shared-fixture implementation; see PR validation for the result |
|
|
50
|
+
|
|
51
|
+
The iPhone result bundle is `build/test-results/ios-1794753626.xcresult`; the iPad result bundle is `build/test-results/ios-1794753664.xcresult` in the integration worktree. Live PDFView stamp screenshots are retained as XCTest attachments. Result bundles are build artifacts, not checked-in fixtures.
|
|
52
|
+
|
|
53
|
+
### Failure evidence before correction
|
|
54
|
+
|
|
55
|
+
- Live ink committed on CropBox `[100,80,700,920]` serialized native points `(180,200)` and `(280,200)` instead of visible points `(80,120)` and `(180,120)`. The regression passed after routing live creation through the coordinate adapter and shared serializer.
|
|
56
|
+
- Native thumbnail rendering placed zero pixels of each music-note, star and emoji stamp within the expected visible rectangle. The same pixel regression passed after correcting the custom annotation drawing-context origin.
|
|
57
|
+
- Highlight, underline, text and stamp import used `(80,120)` as native bounds instead of `(180,200)` on that cropped page. The load-boundary regression passed after applying the shared coordinate adapter.
|
|
58
|
+
- Rotated free-text loading expanded the rectangle along the wrong axis, changing visible bounds `(80,120,240,40)` to `(80,29,240,131)`. Normalizing text dimensions before transforming into native space made repeated round trips stable.
|
|
59
|
+
|
|
60
|
+
The final suite covers crop controls, rotations, live ink, rendered pixels, shared v1 fixture preservation, zoom/scroll movement, outline geometry, hit targets and live glyph rendering before/after annotation reload. Synthetic raster PDF fixtures are generated in the tests; their text-bearing variant adds project-owned text.
|
|
61
|
+
|
|
62
|
+
### Remaining manual validation
|
|
63
|
+
|
|
64
|
+
Automated input tests drive overlay callbacks and native gesture handlers. They do not synthesize physical finger or Apple Pencil events. Real-device checks with finger/Pencil on iPhone and iPad remain outstanding. This is distinct from the completed simulator view/rendering checks. Package publication remains a maintainer action.
|
|
65
|
+
|
|
66
|
+
### Reproduction
|
|
67
|
+
|
|
68
|
+
Prepare the example project's XCTest target with `ruby scripts/add_test_target.rb`, run CocoaPods installation, then use:
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
npm run qa:ios
|
|
72
|
+
IOS_TEST_DESTINATION='platform=iOS Simulator,name=iPad Pro 13-inch (M5)' npm run test:swift
|
|
73
|
+
npm run qa:ts
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Use an installed simulator name or ID when the devices above are unavailable. `scripts/test-swift.sh` writes a fresh `.xcresult` bundle for each invocation.
|
|
77
|
+
|
|
78
|
+
## Area-markup slice (#128), 2026-11-15
|
|
79
|
+
|
|
80
|
+
| Check | Result |
|
|
81
|
+
| --- | --- |
|
|
82
|
+
| `npm run qa:ts` | Passed; 25 suites, 282 tests passed, 72 existing platform skips |
|
|
83
|
+
| `npm run qa:ios` | Passed; formatting, SwiftLint, 101 XCTest cases on iPhone 13 mini / iOS 26.4 |
|
|
84
|
+
| iPad Pro 13-inch (M5), iOS 26.4 | 101 XCTest cases passed, with area tests using the tablet screen dimensions |
|
|
85
|
+
| Android | The unchanged shared-fixture implementation passed its 97 JVM tests and ktlint; no Android source changes were required in this slice |
|
|
86
|
+
|
|
87
|
+
The final iPhone result bundle is `build/test-results/ios-1794769031.xcresult`; the iPad result bundle is `build/test-results/ios-1794769069.xcresult`. The integration worktree retains these bundles alongside the coordinate-slice artifacts.
|
|
88
|
+
|
|
89
|
+
### Failure evidence and corrected behavior
|
|
90
|
+
|
|
91
|
+
- Before the area overlay, the image-only highlight regression left scrolling enabled and had no input overlay capable of producing markup. The same drag now produces a visible rectangle and serialized visible bounds `(80,120,100,40)` without moving the scroll offset.
|
|
92
|
+
- Native PDFKit underline rendering selected the wrong edge at 90/180/270 degrees. Ordered quadrilaterals corrected the edge but still left the 180-degree baseline outside the selected rectangle. At a crop-edge rectangle `(80,1,100,40)`, no underline pixels remained visible. A small native underline renderer now draws the visible lower edge directly; rendering, reopened marks and their hit targets agree at every rotation, including that crop edge.
|
|
93
|
+
- The final area suite exercises both tools on raster-only and selectable-text PDFs across nonzero-origin, zero-origin and right/top crop controls. It checks serialized geometry, zoom/scroll input, movement, rendered output and fresh-view reopen. Cancellation, all tool switches, prior scrolling/gesture-state restoration, source changes, the `page` prop and book-mode hardware keys discard stale drags and leave navigation usable.
|
|
94
|
+
|
|
95
|
+
These are simulator PDFKit/view tests driven through the existing overlay callbacks and native gesture handlers. Physical finger/Pencil input on real iPhone/iPad devices remains a separate outstanding manual check. No package was published.
|
|
96
|
+
|
|
97
|
+
## Final review corrections, 2026-11-15
|
|
98
|
+
|
|
99
|
+
| Check | Result |
|
|
100
|
+
| --- | --- |
|
|
101
|
+
| `npm run qa:ts` | Passed; 25 suites, 282 tests passed, 72 existing platform skips |
|
|
102
|
+
| `npm run qa:ios` | Passed; formatting, SwiftLint with no serious violations, and all 105 XCTest cases on iPhone 13 mini / iOS 26.4 |
|
|
103
|
+
| iPad Pro 13-inch (M5), iOS 26.4 | All 105 XCTest cases passed |
|
|
104
|
+
| `npm run format:swift:check` and `git diff --check` | Passed |
|
|
105
|
+
| Android | Source unchanged by the final review fixes; the earlier 97 passing JVM tests and ktlint result still apply |
|
|
106
|
+
|
|
107
|
+
The final retained iPhone bundle is `build/test-results/ios-1794771326.xcresult`; the final iPad bundle is `build/test-results/ios-1794771374.xcresult` in the integration worktree. Live rotated-text and stamp snapshots are retained as XCTest attachments.
|
|
108
|
+
|
|
109
|
+
The review corrections close the remaining live-input and custom-rendering boundaries:
|
|
110
|
+
|
|
111
|
+
- Live text creation and editing now measure integral dimensions in shared visible-page space and reuse the serializer for native construction. The first live regression reproduced bounds changing from approximately `141.28 × 26.4` to `142 × 27` on reload even at rotation 0; the native/shared axis mismatch also affected rotated pages. Final tests drive text taps, creation, editing to a longer string and fresh-document reload at all four rotations, asserting stable bounds, IDs, timestamps, color, font, content and actual horizontal text pixels in thumbnails and the live view.
|
|
112
|
+
- Before the drawing correction, all three music/star/emoji stamps painted zero changed thumbnail pixels in their intended rectangles at rotations 90/180/270, before and after annotation reload. Live appearance recording and whole-page rendering use different PDFKit clips. The shared adapter now draws the same visible content in both contexts; transparent native appearance padding remains separate from model bounds, outlines and hit targets. Full-size and scaled thumbnails, live snapshots, and a full-page rotated `L` orientation control pass.
|
|
113
|
+
- A live underline regression found the wrong edge at rotations 90/180/270 even though the existing thumbnail checks passed. PDFKit bypassed the custom draw override for its built-in live underline presentation. Underlines now use a custom native appearance while retaining the public `underline` model type. Final tests check the visible lower edge in live views and thumbnails, then reload and move the mark while preserving its metadata and matching hit geometry.
|
|
114
|
+
|
|
115
|
+
Early hosted-suite attempts stalled in UIKit window presentation after PDFKit/Vision analysis occupied the dispatch worker pool. Stack sampling identified `UIWindow.makeKeyAndVisible` waiting for corner-bitmap work, rather than a rendering assertion failure. The new rendering harness now attaches temporary views to the existing app window, explicitly clears documents/removes its views between rotations, and preserves the app's window/root state. The final complete suite passes on both simulator configurations; no private PDFKit flags or swizzling are used.
|
|
116
|
+
|
|
117
|
+
Physical finger/Pencil validation remains outstanding, separately from these completed simulator rendering and callback-driven interaction checks. No package was published.
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"annotations": [
|
|
4
|
+
{
|
|
5
|
+
"id": "shared-ink",
|
|
6
|
+
"type": "ink",
|
|
7
|
+
"color": "#CC2244",
|
|
8
|
+
"lineWidth": 3,
|
|
9
|
+
"paths": [
|
|
10
|
+
[
|
|
11
|
+
{
|
|
12
|
+
"x": 40,
|
|
13
|
+
"y": 100
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"x": 120,
|
|
17
|
+
"y": 160
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"x": 180,
|
|
21
|
+
"y": 130
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
],
|
|
25
|
+
"page": 0,
|
|
26
|
+
"createdAt": 1741340000
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"id": "shared-highlight",
|
|
30
|
+
"type": "highlight",
|
|
31
|
+
"color": "#FFCC00",
|
|
32
|
+
"alpha": 0.5,
|
|
33
|
+
"bounds": {
|
|
34
|
+
"x": 60,
|
|
35
|
+
"y": 300,
|
|
36
|
+
"width": 180,
|
|
37
|
+
"height": 24
|
|
38
|
+
},
|
|
39
|
+
"page": 0,
|
|
40
|
+
"createdAt": 1741340001
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"id": "shared-underline",
|
|
44
|
+
"type": "underline",
|
|
45
|
+
"color": "#2244CC",
|
|
46
|
+
"bounds": {
|
|
47
|
+
"x": 80,
|
|
48
|
+
"y": 380,
|
|
49
|
+
"width": 160,
|
|
50
|
+
"height": 20
|
|
51
|
+
},
|
|
52
|
+
"page": 0,
|
|
53
|
+
"createdAt": 1741340002
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"id": "shared-text",
|
|
57
|
+
"type": "text",
|
|
58
|
+
"color": "#114422",
|
|
59
|
+
"bounds": {
|
|
60
|
+
"x": 100,
|
|
61
|
+
"y": 450,
|
|
62
|
+
"width": 240,
|
|
63
|
+
"height": 40
|
|
64
|
+
},
|
|
65
|
+
"contents": "Shared note",
|
|
66
|
+
"fontSize": 16,
|
|
67
|
+
"fontFamily": "Helvetica",
|
|
68
|
+
"page": 0,
|
|
69
|
+
"createdAt": 1741340003
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"id": "shared-free-text",
|
|
73
|
+
"type": "freeText",
|
|
74
|
+
"color": "#442211",
|
|
75
|
+
"bounds": {
|
|
76
|
+
"x": 100,
|
|
77
|
+
"y": 520,
|
|
78
|
+
"width": 240,
|
|
79
|
+
"height": 40
|
|
80
|
+
},
|
|
81
|
+
"contents": "Visible page",
|
|
82
|
+
"fontSize": 18,
|
|
83
|
+
"fontFamily": "Helvetica",
|
|
84
|
+
"page": 0,
|
|
85
|
+
"createdAt": 1741340004
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"id": "shared-music",
|
|
89
|
+
"type": "stamp",
|
|
90
|
+
"color": "#332299",
|
|
91
|
+
"bounds": {
|
|
92
|
+
"x": 20,
|
|
93
|
+
"y": 700,
|
|
94
|
+
"width": 48,
|
|
95
|
+
"height": 48
|
|
96
|
+
},
|
|
97
|
+
"text": "♫",
|
|
98
|
+
"page": 0,
|
|
99
|
+
"createdAt": 1741340005
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"id": "shared-star",
|
|
103
|
+
"type": "stamp",
|
|
104
|
+
"color": "#BB5500",
|
|
105
|
+
"bounds": {
|
|
106
|
+
"x": 270,
|
|
107
|
+
"y": 700,
|
|
108
|
+
"width": 48,
|
|
109
|
+
"height": 48
|
|
110
|
+
},
|
|
111
|
+
"text": "★",
|
|
112
|
+
"page": 0,
|
|
113
|
+
"createdAt": 1741340006
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"id": "shared-emoji",
|
|
117
|
+
"type": "stamp",
|
|
118
|
+
"color": "#222222",
|
|
119
|
+
"bounds": {
|
|
120
|
+
"x": 530,
|
|
121
|
+
"y": 700,
|
|
122
|
+
"width": 48,
|
|
123
|
+
"height": 48
|
|
124
|
+
},
|
|
125
|
+
"text": "🎵",
|
|
126
|
+
"page": 0,
|
|
127
|
+
"createdAt": 1741340007
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
}
|
|
@@ -156,12 +156,13 @@ extension ExpoPdfMarkupView {
|
|
|
156
156
|
annotation: PDFAnnotation?
|
|
157
157
|
) -> [String: Any] {
|
|
158
158
|
let pageIndex = pdfView.document?.index(for: page) ?? 0
|
|
159
|
+
let visiblePoint = point.applying(AnnotationCoordinates(page: page).nativeToVisible)
|
|
159
160
|
var payload: [String: Any] = [
|
|
160
161
|
"mode": annotation == nil ? "create" : "edit",
|
|
161
162
|
"page": pageIndex,
|
|
162
163
|
"point": [
|
|
163
|
-
"x":
|
|
164
|
-
"y":
|
|
164
|
+
"x": visiblePoint.x,
|
|
165
|
+
"y": visiblePoint.y,
|
|
165
166
|
],
|
|
166
167
|
]
|
|
167
168
|
if let contents = annotation?.contents {
|
|
@@ -177,7 +178,7 @@ extension ExpoPdfMarkupView {
|
|
|
177
178
|
replacing annotation: PDFAnnotation?
|
|
178
179
|
) {
|
|
179
180
|
if let annotation {
|
|
180
|
-
updateFreeTextAnnotation(annotation, text: text)
|
|
181
|
+
updateFreeTextAnnotation(annotation, text: text, on: page)
|
|
181
182
|
} else {
|
|
182
183
|
addFreeTextAnnotation(text: text, at: point, on: page)
|
|
183
184
|
}
|
|
@@ -186,36 +187,33 @@ extension ExpoPdfMarkupView {
|
|
|
186
187
|
private func addFreeTextAnnotation(text: String, at point: CGPoint, on page: PDFPage) {
|
|
187
188
|
let fontSize: CGFloat = 16.0
|
|
188
189
|
let font = UIFont(name: annotationFontFamily ?? "", size: fontSize) ?? UIFont.systemFont(ofSize: fontSize)
|
|
189
|
-
let
|
|
190
|
-
let
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
let
|
|
199
|
-
|
|
190
|
+
let coordinates = AnnotationCoordinates(page: page)
|
|
191
|
+
let visiblePoint = point.applying(coordinates.nativeToVisible)
|
|
192
|
+
let model = AnnotationModel(
|
|
193
|
+
id: UUID().uuidString, type: "freeText", page: pdfView.document?.index(for: page) ?? 0,
|
|
194
|
+
color: annotationColor,
|
|
195
|
+
bounds: AnnotationBounds(measuredTextBounds(text: text, font: font, at: visiblePoint)),
|
|
196
|
+
contents: text, fontSize: fontSize, fontFamily: font.fontName,
|
|
197
|
+
createdAt: Date().timeIntervalSince1970
|
|
198
|
+
)
|
|
199
|
+
guard let annotation = AnnotationSerializer.toPDFAnnotation(
|
|
200
|
+
model, pageBounds: page.bounds(for: .cropBox), pageRotation: page.rotation
|
|
201
|
+
) else { return }
|
|
200
202
|
page.addAnnotation(annotation)
|
|
201
203
|
emitAnnotationsChanged()
|
|
202
204
|
}
|
|
203
205
|
|
|
204
|
-
private func updateFreeTextAnnotation(_ annotation: PDFAnnotation, text: String) {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
annotation
|
|
214
|
-
|
|
215
|
-
if annotation.fontColor == nil {
|
|
216
|
-
annotation.fontColor = AnnotationSerializer.colorFromHex(annotationColor) ?? .red
|
|
217
|
-
}
|
|
218
|
-
|
|
206
|
+
private func updateFreeTextAnnotation(_ annotation: PDFAnnotation, text: String, on page: PDFPage) {
|
|
207
|
+
guard var model = AnnotationSerializer.toModel(from: annotation, page: pdfView.document?.index(for: page) ?? 0),
|
|
208
|
+
let bounds = model.bounds else { return }
|
|
209
|
+
let font = annotation.font ?? UIFont.systemFont(ofSize: model.fontSize ?? 16)
|
|
210
|
+
model.contents = text
|
|
211
|
+
model.bounds = AnnotationBounds(measuredTextBounds(text: text, font: font, replacing: bounds.cgRect))
|
|
212
|
+
guard let replacement = AnnotationSerializer.toPDFAnnotation(
|
|
213
|
+
model, pageBounds: page.bounds(for: .cropBox), pageRotation: page.rotation
|
|
214
|
+
) else { return }
|
|
215
|
+
page.removeAnnotation(annotation)
|
|
216
|
+
page.addAnnotation(replacement)
|
|
219
217
|
emitAnnotationsChanged()
|
|
220
218
|
}
|
|
221
219
|
|
|
@@ -243,7 +241,8 @@ extension ExpoPdfMarkupView {
|
|
|
243
241
|
}
|
|
244
242
|
|
|
245
243
|
private func measuredTextSize(text: String, font: UIFont) -> CGSize {
|
|
246
|
-
(text as NSString).size(withAttributes: [.font: font])
|
|
244
|
+
let size = (text as NSString).size(withAttributes: [.font: font])
|
|
245
|
+
return CGSize(width: ceil(size.width), height: ceil(size.height))
|
|
247
246
|
}
|
|
248
247
|
|
|
249
248
|
private func findViewController() -> UIViewController? {
|