@june24/expo-pdf-reader 0.1.1 → 0.1.2
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/ios/ExpoPdfReaderView.swift +14 -14
- package/package.json +1 -1
|
@@ -76,12 +76,15 @@ class ExpoPdfReaderView: ExpoView {
|
|
|
76
76
|
|
|
77
77
|
private func notifyScroll() {
|
|
78
78
|
let bounds = pdfView.bounds
|
|
79
|
-
let contentSize = pdfView.document?.bounds(for: .mediaBox).size ?? .zero
|
|
80
79
|
|
|
81
|
-
// Get scroll
|
|
82
|
-
let
|
|
83
|
-
|
|
84
|
-
|
|
80
|
+
// Get scroll info from the underlying UIScrollView instead of PDFView helpers
|
|
81
|
+
guard let scrollView = pdfView.subviews.first(where: { $0 is UIScrollView }) as? UIScrollView else {
|
|
82
|
+
return
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
let contentSize = scrollView.contentSize
|
|
86
|
+
let scrollX = scrollView.contentOffset.x
|
|
87
|
+
let scrollY = scrollView.contentOffset.y
|
|
85
88
|
|
|
86
89
|
onScroll([
|
|
87
90
|
"x": scrollX,
|
|
@@ -387,17 +390,14 @@ class ExpoPdfReaderView: ExpoView {
|
|
|
387
390
|
// Simplified extraction logic
|
|
388
391
|
|
|
389
392
|
var colorHex = "#000000"
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
}
|
|
393
|
+
let strokeColor = annotation.color
|
|
394
|
+
colorHex = strokeColor.toHex() ?? "#000000"
|
|
393
395
|
|
|
394
396
|
var type = "pen"
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
type = "highlighter"
|
|
400
|
-
}
|
|
397
|
+
var a: CGFloat = 0
|
|
398
|
+
strokeColor.getWhite(nil, alpha: &a)
|
|
399
|
+
if a < 0.5 {
|
|
400
|
+
type = "highlighter"
|
|
401
401
|
}
|
|
402
402
|
|
|
403
403
|
annotationsData.append([
|
package/package.json
CHANGED