Skip to content

Commit

Permalink
v2.11.338 interop (#140)
Browse files Browse the repository at this point in the history
* pull static files

* pdfjs #13172 - add cleanup option

* pdfjs 13973 - Change {PDFPageView, PDFThumbnailView}.update to take a parameter object

* backwards compatable update method
  • Loading branch information
ryanelliott-wk authored Jul 18, 2022
1 parent 5fb5476 commit 7eb6c54
Show file tree
Hide file tree
Showing 10 changed files with 6,729 additions and 5,693 deletions.
4 changes: 2 additions & 2 deletions lib/src/pdf_document_proxy.dart
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ class PDFDocumentProxy {

int get numPages => _jsInternal['numPages'] as int;

void cleanup() {
_jsInternal.callMethod('cleanup', []);
void cleanup({bool keepLoadedFonts = false}) {
_jsInternal.callMethod('cleanup', [keepLoadedFonts]);
}

void destroy() {
Expand Down
22 changes: 22 additions & 0 deletions lib/src/pdf_page_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,28 @@ class PDFPageView {
}

void update(num scale, [num rotation = 0]) {
_updateV2(scale: scale, rotation: rotation);

if (!_isUpdated(scale: scale, rotation: rotation)) {
_updateV1(scale, rotation: rotation);
}
}

/// v2.11.338+
void _updateV2({num scale = 0, num rotation = 0}) {
_jsInternal.callMethod('update', [JsObject.jsify({
'scale': scale,
'rotation': rotation,
})]);
}

bool _isUpdated({num scale = 0, num rotation = 0}) {
dynamic jsScale = _jsInternal['scale'];
num jsRotation = _jsInternal['rotation'] as num;
return jsScale is num && jsScale == scale && jsRotation == rotation;
}

void _updateV1(num scale, {num rotation = 0}) {
_jsInternal.callMethod('update', [scale, rotation]);
}
}
Binary file modified lib/static/images/shadow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion lib/static/pdf.js.map

Large diffs are not rendered by default.

23 changes: 22 additions & 1 deletion lib/static/pdf.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/static/pdf.worker.js.map

Large diffs are not rendered by default.

23 changes: 22 additions & 1 deletion lib/static/pdf.worker.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 7eb6c54

Please sign in to comment.