@papyrus-sdk/engine-native 0.2.22-beta.7 → 0.2.22-beta.9.epub.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.
@@ -18,6 +18,7 @@ static NSCache<NSString *, UIImage *> *PapyrusComicImageCache(void) {
18
18
  @property (nonatomic, strong) UIScrollView *pageScrollView;
19
19
  @property (nonatomic, strong) UIImageView *imageView;
20
20
  @property (nonatomic, copy) NSString *representedKey;
21
+ @property (nonatomic, assign) BOOL fitWidthInSingleMode;
21
22
  @end
22
23
 
23
24
  @implementation PapyrusComicPageCell
@@ -36,6 +37,23 @@ static NSCache<NSString *, UIImage *> *PapyrusComicImageCache(void) {
36
37
  }
37
38
  return self;
38
39
  }
40
+ - (void)layoutSubviews {
41
+ [super layoutSubviews];
42
+ self.pageScrollView.frame = self.contentView.bounds;
43
+ CGAffineTransform transform = self.imageView.transform;
44
+ self.imageView.transform = CGAffineTransformIdentity;
45
+ CGSize size = self.pageScrollView.bounds.size;
46
+ UIImage *image = self.imageView.image;
47
+ if (self.fitWidthInSingleMode && image.size.width > 0 && image.size.height > 0) {
48
+ size.height = MAX(1, size.width * image.size.height / image.size.width);
49
+ }
50
+ self.imageView.frame = (CGRect){CGPointZero, size};
51
+ self.pageScrollView.contentSize = size;
52
+ BOOL canScroll = self.fitWidthInSingleMode && size.height > self.pageScrollView.bounds.size.height;
53
+ self.pageScrollView.scrollEnabled = canScroll;
54
+ self.pageScrollView.alwaysBounceVertical = canScroll;
55
+ self.imageView.transform = transform;
56
+ }
39
57
  - (void)prepareForReuse {
40
58
  [super prepareForReuse];
41
59
  self.pageScrollView.contentOffset = CGPointZero;
@@ -44,6 +62,7 @@ static NSCache<NSString *, UIImage *> *PapyrusComicImageCache(void) {
44
62
  self.pageScrollView.alwaysBounceVertical = NO;
45
63
  self.imageView.image = nil;
46
64
  self.imageView.transform = CGAffineTransformIdentity;
65
+ self.fitWidthInSingleMode = NO;
47
66
  }
48
67
  @end
49
68
 
@@ -295,22 +314,10 @@ static NSCache<NSString *, UIImage *> *PapyrusComicImageCache(void) {
295
314
  }
296
315
 
297
316
  - (void)configureCell:(PapyrusComicPageCell *)cell withImage:(UIImage *)image {
298
- CGRect bounds = cell.contentView.bounds;
299
- cell.pageScrollView.frame = bounds;
300
- BOOL fitWidthInSingleMode = [self.layoutMode isEqualToString:@"single"] &&
317
+ cell.fitWidthInSingleMode = [self.layoutMode isEqualToString:@"single"] &&
301
318
  [self.fitMode isEqualToString:@"width"] && image.size.width > 0 && image.size.height > 0;
302
- if (fitWidthInSingleMode) {
303
- CGFloat height = bounds.size.width * image.size.height / image.size.width;
304
- cell.imageView.frame = CGRectMake(0, 0, bounds.size.width, MAX(1, height));
305
- cell.pageScrollView.contentSize = cell.imageView.frame.size;
306
- cell.pageScrollView.scrollEnabled = height > bounds.size.height;
307
- cell.pageScrollView.alwaysBounceVertical = height > bounds.size.height;
308
- } else {
309
- cell.imageView.frame = cell.pageScrollView.bounds;
310
- cell.pageScrollView.contentSize = cell.pageScrollView.bounds.size;
311
- cell.pageScrollView.scrollEnabled = NO;
312
- cell.pageScrollView.alwaysBounceVertical = NO;
313
- }
319
+ [cell setNeedsLayout];
320
+ [cell layoutIfNeeded];
314
321
  }
315
322
 
316
323
  - (void)emitErrorForKey:(NSString *)key message:(NSString *)message {
@@ -24,6 +24,8 @@ NS_ASSUME_NONNULL_BEGIN
24
24
  @property (nonatomic, copy, nullable) NSString *selectedAnnotationId;
25
25
  @property (nonatomic, assign) BOOL selectionActive;
26
26
  @property (nonatomic, copy) NSString *defineLabel;
27
+ // This is a localized label getter, not an Objective-C copy-family method.
28
+ - (NSString *)copyLabel __attribute__((objc_method_family(none)));
27
29
  @property (nonatomic, copy) NSString *copyLabel;
28
30
  @property (nonatomic, copy) NSString *selectAllLabel;
29
31
  @property (nonatomic, copy) NSString *defineSelectionMode;
@@ -2308,6 +2308,7 @@ static NSString *PapyrusHexColorFromUIColor(UIColor *color, CGFloat *opacity) {
2308
2308
  PDFSelection *selection = [page selectionForWordAtPoint:
2309
2309
  [self.pdfView convertPoint:viewPoint toPage:page]];
2310
2310
  if (!selection.string.length) return;
2311
+ [self.pdfView becomeFirstResponder];
2311
2312
  selection.color = [UIColor.systemBlueColor colorWithAlphaComponent:0.30];
2312
2313
  [self.pdfView setCurrentSelection:selection animate:NO];
2313
2314
  [self emitCurrentSelectionIfNeeded];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@papyrus-sdk/engine-native",
3
- "version": "0.2.22-beta.7",
3
+ "version": "0.2.22-beta.9.epub.1",
4
4
  "license": "MIT",
5
5
  "keywords": [
6
6
  "papyrus",
@@ -49,8 +49,8 @@
49
49
  "url": "https://github.com/solrachix/Papyrus/issues"
50
50
  },
51
51
  "peerDependencies": {
52
- "@papyrus-sdk/core": "0.2.23-beta.3",
53
- "@papyrus-sdk/types": "0.2.16-beta.3",
52
+ "@papyrus-sdk/core": "0.2.23-beta.3.epub.1",
53
+ "@papyrus-sdk/types": "0.2.16-beta.3.epub.1",
54
54
  "react-native": ">=0.81.0"
55
55
  },
56
56
  "devDependencies": {