@tobyt/expo-pdf-markup 1.1.3 → 1.2.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 +14 -0
- package/android/src/main/java/dev/terhoeven/expopdfmarkup/AnnotationSerializer.kt +7 -1
- 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 +12 -0
- 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 +369 -44
- 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/ios/AnnotationSerializer.swift +36 -7
- package/ios/ExpoPdfMarkupModule.swift +4 -0
- package/ios/ExpoPdfMarkupView+Book.swift +455 -0
- package/ios/ExpoPdfMarkupView+Ink.swift +10 -2
- package/ios/ExpoPdfMarkupView+Move.swift +3 -4
- package/ios/ExpoPdfMarkupView.swift +49 -6
- package/ios/Tests/AnnotationSerializerTests.swift +0 -22
- package/ios/Tests/BookModeTests.swift +534 -0
- package/ios/Tests/book-sample.pdf +207 -0
- package/ios/Tests/single-page.pdf +52 -0
- package/metro.js +32 -14
- package/package.json +4 -3
- package/src/ExpoPdfMarkup.types.ts +13 -0
- package/src/ExpoPdfMarkupView.web.tsx +443 -52
- 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
- package/docs/.nojekyll +0 -1
- package/docs/assets/hierarchy.js +0 -1
- package/docs/assets/highlight.css +0 -113
- package/docs/assets/icons.js +0 -18
- package/docs/assets/icons.svg +0 -1
- package/docs/assets/main.js +0 -60
- package/docs/assets/navigation.js +0 -1
- package/docs/assets/search.js +0 -1
- package/docs/assets/style.css +0 -1648
- package/docs/functions/ExpoPdfMarkupView.html +0 -42
- package/docs/functions/setPdfJsWorkerSrc.html +0 -42
- package/docs/hierarchy.html +0 -29
- package/docs/index.html +0 -148
- package/docs/modules.html +0 -40
- package/docs/types/Annotation.html +0 -33
- package/docs/types/AnnotationBounds.html +0 -73
- package/docs/types/AnnotationMode.html +0 -33
- package/docs/types/AnnotationPoint.html +0 -61
- package/docs/types/AnnotationsData.html +0 -61
- package/docs/types/ExpoPdfMarkupViewProps.html +0 -184
- package/docs/types/HighlightAnnotation.html +0 -91
- package/docs/types/InkAnnotation.html +0 -91
- package/docs/types/StampAnnotation.html +0 -95
- package/docs/types/StampDefinition.html +0 -72
- package/docs/types/TextAnnotation.html +0 -110
- package/docs/types/TextInputRequest.html +0 -73
- package/docs/types/UnderlineAnnotation.html +0 -85
- package/ios/InkPDFAnnotation.swift +0 -45
|
@@ -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.
|
|
@@ -97,10 +97,11 @@ enum AnnotationSerializer {
|
|
|
97
97
|
switch model.type {
|
|
98
98
|
case "ink":
|
|
99
99
|
model.lineWidth = annotation.border?.lineWidth ?? 2.0
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
100
|
+
// Always emit `paths`, even when PDFKit hands back nothing. The JS `Annotation`
|
|
101
|
+
// type declares it non-optional, and `JSONEncoder` drops nil keys entirely, so a
|
|
102
|
+
// nil here reaches consumers as a missing property rather than an empty stroke list.
|
|
103
|
+
model.paths = (annotation.paths ?? []).map { path in
|
|
104
|
+
pointsFromBezierPath(path).map { ["x": $0.x, "y": $0.y] }
|
|
104
105
|
}
|
|
105
106
|
case "highlight", "underline":
|
|
106
107
|
model.bounds = AnnotationBounds(annotation.bounds)
|
|
@@ -209,15 +210,23 @@ enum AnnotationSerializer {
|
|
|
209
210
|
annotationBounds = combinedRect.insetBy(dx: -padding, dy: -padding)
|
|
210
211
|
}
|
|
211
212
|
|
|
212
|
-
let annotation =
|
|
213
|
+
let annotation = PDFAnnotation(bounds: annotationBounds, forType: .ink, withProperties: nil)
|
|
213
214
|
annotation.color = color
|
|
214
215
|
|
|
215
216
|
let border = PDFBorder()
|
|
216
217
|
border.lineWidth = lineWidth
|
|
217
218
|
annotation.border = border
|
|
218
219
|
|
|
219
|
-
|
|
220
|
-
|
|
220
|
+
for path in paths {
|
|
221
|
+
let bezierPath = UIBezierPath()
|
|
222
|
+
for (index, point) in path.enumerated() {
|
|
223
|
+
if index == 0 {
|
|
224
|
+
bezierPath.move(to: CGPoint(x: point.x, y: point.y))
|
|
225
|
+
} else {
|
|
226
|
+
bezierPath.addLine(to: CGPoint(x: point.x, y: point.y))
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
annotation.add(bezierPath)
|
|
221
230
|
}
|
|
222
231
|
|
|
223
232
|
let createdAt = model.createdAt ?? Date().timeIntervalSince1970
|
|
@@ -286,4 +295,24 @@ enum AnnotationSerializer {
|
|
|
286
295
|
height: height
|
|
287
296
|
)
|
|
288
297
|
}
|
|
298
|
+
|
|
299
|
+
private static func pointsFromBezierPath(_ path: UIBezierPath) -> [CGPoint] {
|
|
300
|
+
var points: [CGPoint] = []
|
|
301
|
+
let cgPath = path.cgPath
|
|
302
|
+
cgPath.applyWithBlock { element in
|
|
303
|
+
switch element.pointee.type {
|
|
304
|
+
case .moveToPoint, .addLineToPoint:
|
|
305
|
+
points.append(element.pointee.points[0])
|
|
306
|
+
case .addQuadCurveToPoint:
|
|
307
|
+
points.append(element.pointee.points[1])
|
|
308
|
+
case .addCurveToPoint:
|
|
309
|
+
points.append(element.pointee.points[2])
|
|
310
|
+
case .closeSubpath:
|
|
311
|
+
break
|
|
312
|
+
@unknown default:
|
|
313
|
+
break
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
return points
|
|
317
|
+
}
|
|
289
318
|
}
|
|
@@ -28,6 +28,10 @@ public class ExpoPdfMarkupModule: Module {
|
|
|
28
28
|
view.loadAnnotations(from: json)
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
Prop("displayMode") { (view: ExpoPdfMarkupView, mode: String?) in
|
|
32
|
+
view.setDisplayMode(mode ?? "continuous")
|
|
33
|
+
}
|
|
34
|
+
|
|
31
35
|
Prop("annotationMode") { (view: ExpoPdfMarkupView, mode: String?) in
|
|
32
36
|
view.setAnnotationMode(mode ?? "none")
|
|
33
37
|
}
|