pdfjs-dist 2.0.943 → 2.4.456
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.
Potentially problematic release.
This version of pdfjs-dist might be problematic. Click here for more details.
- package/CODE_OF_CONDUCT.md +15 -0
- package/README.md +4 -0
- package/bower.json +1 -1
- package/build/pdf.js +8286 -14230
- package/build/pdf.js.map +1 -1
- package/build/pdf.min.js +22 -1
- package/build/pdf.worker.entry.js +5 -3
- package/build/pdf.worker.js +25500 -26628
- package/build/pdf.worker.js.map +1 -1
- package/build/pdf.worker.min.js +22 -1
- package/es5/build/pdf.js +25473 -0
- package/es5/build/pdf.js.map +1 -0
- package/{lib/shared/global_scope.js → es5/build/pdf.worker.entry.js} +5 -10
- package/es5/build/pdf.worker.js +57878 -0
- package/es5/build/pdf.worker.js.map +1 -0
- package/es5/web/images/annotation-check.svg +11 -0
- package/es5/web/images/annotation-comment.svg +16 -0
- package/es5/web/images/annotation-help.svg +26 -0
- package/es5/web/images/annotation-insert.svg +10 -0
- package/es5/web/images/annotation-key.svg +11 -0
- package/es5/web/images/annotation-newparagraph.svg +11 -0
- package/es5/web/images/annotation-noicon.svg +7 -0
- package/es5/web/images/annotation-note.svg +42 -0
- package/es5/web/images/annotation-paragraph.svg +16 -0
- package/es5/web/images/loading-icon.gif +0 -0
- package/es5/web/images/shadow.png +0 -0
- package/es5/web/images/texture.png +0 -0
- package/es5/web/pdf_viewer.css +407 -0
- package/es5/web/pdf_viewer.js +7757 -0
- package/es5/web/pdf_viewer.js.map +1 -0
- package/image_decoders/pdf.image_decoders.js +2887 -4094
- package/image_decoders/pdf.image_decoders.js.map +1 -1
- package/image_decoders/pdf.image_decoders.min.js +22 -1
- package/lib/README.md +7 -0
- package/lib/core/annotation.js +855 -778
- package/lib/core/arithmetic_decoder.js +325 -311
- package/lib/core/bidi.js +117 -50
- package/lib/core/ccitt.js +251 -89
- package/lib/core/ccitt_stream.js +26 -16
- package/lib/core/cff_parser.js +525 -197
- package/lib/core/charsets.js +6 -5
- package/lib/core/chunked_stream.js +541 -406
- package/lib/core/cmap.js +368 -253
- package/lib/core/colorspace.js +781 -800
- package/lib/core/core_utils.js +152 -0
- package/lib/core/crypto.js +609 -422
- package/lib/core/document.js +649 -481
- package/lib/core/encodings.js +33 -24
- package/lib/core/evaluator.js +1471 -736
- package/lib/core/font_renderer.js +289 -149
- package/lib/core/fonts.js +1067 -413
- package/lib/core/function.js +517 -287
- package/lib/core/glyphlist.js +4529 -4527
- package/lib/core/image.js +232 -114
- package/lib/core/image_utils.js +94 -0
- package/lib/core/jbig2.js +711 -342
- package/lib/core/jbig2_stream.js +31 -19
- package/lib/core/jpeg_stream.js +151 -26
- package/lib/core/jpg.js +433 -181
- package/lib/core/jpx.js +551 -143
- package/lib/core/jpx_stream.js +40 -28
- package/lib/core/metrics.js +2931 -2931
- package/lib/core/murmurhash3.js +104 -97
- package/lib/core/obj.js +1561 -1053
- package/lib/core/operator_list.js +192 -64
- package/lib/core/parser.js +1162 -864
- package/lib/core/pattern.js +224 -75
- package/lib/core/pdf_manager.js +154 -285
- package/lib/core/primitives.js +145 -69
- package/lib/core/ps_parser.js +212 -162
- package/lib/core/standard_fonts.js +245 -244
- package/lib/core/stream.js +353 -81
- package/lib/core/type1_parser.js +218 -68
- package/lib/core/unicode.js +1682 -1655
- package/lib/core/worker.js +233 -302
- package/lib/core/worker_stream.js +168 -0
- package/lib/display/annotation_layer.js +808 -862
- package/lib/display/api.js +1778 -1462
- package/lib/display/api_compatibility.js +14 -9
- package/lib/display/canvas.js +463 -140
- package/lib/display/content_disposition.js +86 -58
- package/lib/display/display_utils.js +524 -0
- package/lib/display/fetch_stream.js +202 -274
- package/lib/display/font_loader.js +311 -333
- package/lib/display/metadata.js +98 -88
- package/lib/display/network.js +343 -347
- package/lib/display/network_utils.js +46 -26
- package/lib/display/node_stream.js +326 -404
- package/lib/display/pattern_helper.js +168 -69
- package/lib/display/svg.js +1296 -885
- package/lib/display/text_layer.js +229 -103
- package/lib/display/transport_stream.js +290 -250
- package/lib/display/webgl.js +116 -83
- package/lib/display/worker_options.js +6 -5
- package/lib/display/xml_parser.js +358 -337
- package/lib/examples/node/domstubs.js +95 -39
- package/lib/pdf.js +49 -31
- package/lib/pdf.worker.js +7 -5
- package/lib/shared/compatibility.js +3 -145
- package/lib/shared/is_node.js +8 -7
- package/lib/shared/message_handler.js +367 -314
- package/lib/shared/util.js +421 -415
- package/lib/test/unit/annotation_spec.js +1570 -690
- package/lib/test/unit/api_spec.js +855 -493
- package/lib/test/unit/bidi_spec.js +12 -12
- package/lib/test/unit/cff_parser_spec.js +88 -61
- package/lib/test/unit/clitests_helper.js +9 -12
- package/lib/test/unit/cmap_spec.js +140 -88
- package/lib/test/unit/colorspace_spec.js +204 -152
- package/lib/test/unit/core_utils_spec.js +211 -0
- package/lib/test/unit/crypto_spec.js +194 -182
- package/lib/test/unit/custom_spec.js +50 -64
- package/lib/test/unit/display_svg_spec.js +53 -38
- package/lib/test/unit/display_utils_spec.js +263 -0
- package/lib/test/unit/document_spec.js +17 -22
- package/lib/test/unit/encodings_spec.js +15 -57
- package/lib/test/unit/evaluator_spec.js +90 -83
- package/lib/test/unit/fetch_stream_spec.js +111 -0
- package/lib/test/unit/function_spec.js +219 -205
- package/lib/test/unit/jasmine-boot.js +68 -39
- package/lib/test/unit/message_handler_spec.js +187 -160
- package/lib/test/unit/metadata_spec.js +87 -34
- package/lib/test/unit/murmurhash3_spec.js +13 -13
- package/lib/test/unit/network_spec.js +26 -59
- package/lib/test/unit/network_utils_spec.js +187 -121
- package/lib/test/unit/node_stream_spec.js +98 -90
- package/lib/test/unit/parser_spec.js +173 -131
- package/lib/test/unit/pdf_find_controller_spec.js +148 -67
- package/lib/test/unit/pdf_find_utils_spec.js +35 -34
- package/lib/test/unit/pdf_history_spec.js +45 -33
- package/lib/test/unit/primitives_spec.js +161 -126
- package/lib/test/unit/stream_spec.js +22 -15
- package/lib/test/unit/test_utils.js +149 -98
- package/lib/test/unit/testreporter.js +36 -18
- package/lib/test/unit/type1_parser_spec.js +46 -44
- package/lib/test/unit/ui_utils_spec.js +388 -372
- package/lib/test/unit/unicode_spec.js +49 -46
- package/lib/test/unit/util_spec.js +144 -248
- package/lib/web/annotation_layer_builder.js +75 -95
- package/lib/web/app.js +1538 -1147
- package/lib/web/app_options.js +116 -104
- package/lib/web/base_viewer.js +950 -775
- package/lib/web/chromecom.js +217 -225
- package/lib/web/debugger.js +236 -148
- package/lib/web/download_manager.js +50 -50
- package/lib/web/firefox_print_service.js +51 -33
- package/lib/web/firefoxcom.js +225 -352
- package/lib/web/genericcom.js +30 -93
- package/lib/web/genericl10n.js +26 -143
- package/lib/web/grab_to_pan.js +57 -33
- package/lib/web/interfaces.js +105 -232
- package/lib/web/overlay_manager.js +73 -227
- package/lib/web/password_prompt.js +44 -62
- package/lib/web/pdf_attachment_viewer.js +118 -123
- package/lib/web/pdf_cursor_tools.js +89 -93
- package/lib/web/pdf_document_properties.js +242 -281
- package/lib/web/pdf_find_bar.js +157 -163
- package/lib/web/pdf_find_controller.js +598 -454
- package/lib/web/pdf_find_utils.js +32 -16
- package/lib/web/pdf_history.js +481 -355
- package/lib/web/pdf_link_service.js +355 -323
- package/lib/web/pdf_outline_viewer.js +167 -152
- package/lib/web/pdf_page_view.js +511 -457
- package/lib/web/pdf_presentation_mode.js +347 -335
- package/lib/web/pdf_print_service.js +133 -103
- package/lib/web/pdf_rendering_queue.js +98 -100
- package/lib/web/pdf_sidebar.js +323 -299
- package/lib/web/pdf_sidebar_resizer.js +107 -108
- package/lib/web/pdf_single_page_viewer.js +94 -146
- package/lib/web/pdf_thumbnail_view.js +319 -269
- package/lib/web/pdf_thumbnail_viewer.js +219 -199
- package/lib/web/pdf_viewer.component.js +111 -32
- package/lib/web/pdf_viewer.js +61 -101
- package/lib/web/preferences.js +87 -272
- package/lib/web/secondary_toolbar.js +207 -220
- package/lib/web/text_layer_builder.js +322 -322
- package/lib/web/toolbar.js +227 -180
- package/lib/web/ui_utils.js +476 -421
- package/lib/web/view_history.js +59 -208
- package/lib/web/viewer_compatibility.js +9 -6
- package/package.json +2 -9
- package/web/pdf_viewer.css +36 -22
- package/web/pdf_viewer.js +4407 -4516
- package/web/pdf_viewer.js.map +1 -1
- package/webpack.js +14 -5
- package/external/streams/streams-lib.js +0 -3962
- package/external/url/url-lib.js +0 -627
- package/lib/display/dom_utils.js +0 -441
- package/lib/shared/streams_polyfill.js +0 -39
- package/lib/shared/url_polyfill.js +0 -50
- package/lib/test/unit/dom_utils_spec.js +0 -89
- package/lib/web/dom_events.js +0 -140
@@ -2,7 +2,7 @@
|
|
2
2
|
* @licstart The following is the entire license notice for the
|
3
3
|
* Javascript code in this page
|
4
4
|
*
|
5
|
-
* Copyright
|
5
|
+
* Copyright 2020 Mozilla Foundation
|
6
6
|
*
|
7
7
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
8
8
|
* you may not use this file except in compliance with the License.
|
@@ -19,31 +19,21 @@
|
|
19
19
|
* @licend The above is the entire license notice for the
|
20
20
|
* Javascript code in this page
|
21
21
|
*/
|
22
|
-
|
22
|
+
"use strict";
|
23
23
|
|
24
24
|
Object.defineProperty(exports, "__esModule", {
|
25
25
|
value: true
|
26
26
|
});
|
27
|
-
exports.PDFSidebarResizer =
|
27
|
+
exports.PDFSidebarResizer = void 0;
|
28
28
|
|
29
|
-
var
|
29
|
+
var _ui_utils = require("./ui_utils.js");
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
var SIDEBAR_WIDTH_VAR = '--sidebar-width';
|
36
|
-
var SIDEBAR_MIN_WIDTH = 200;
|
37
|
-
var SIDEBAR_RESIZING_CLASS = 'sidebarResizing';
|
38
|
-
|
39
|
-
var PDFSidebarResizer = function () {
|
40
|
-
function PDFSidebarResizer(options, eventBus) {
|
41
|
-
var _this = this;
|
42
|
-
|
43
|
-
var l10n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _ui_utils.NullL10n;
|
44
|
-
|
45
|
-
_classCallCheck(this, PDFSidebarResizer);
|
31
|
+
const SIDEBAR_WIDTH_VAR = "--sidebar-width";
|
32
|
+
const SIDEBAR_MIN_WIDTH = 200;
|
33
|
+
const SIDEBAR_RESIZING_CLASS = "sidebarResizing";
|
46
34
|
|
35
|
+
class PDFSidebarResizer {
|
36
|
+
constructor(options, eventBus, l10n = _ui_utils.NullL10n) {
|
47
37
|
this.enabled = false;
|
48
38
|
this.isRTL = false;
|
49
39
|
this.sidebarOpen = false;
|
@@ -55,111 +45,120 @@ var PDFSidebarResizer = function () {
|
|
55
45
|
this.resizer = options.resizer;
|
56
46
|
this.eventBus = eventBus;
|
57
47
|
this.l10n = l10n;
|
58
|
-
|
59
|
-
|
48
|
+
|
49
|
+
if (typeof CSS === "undefined" || typeof CSS.supports !== "function" || !CSS.supports(SIDEBAR_WIDTH_VAR, `calc(-1 * ${SIDEBAR_MIN_WIDTH}px)`)) {
|
50
|
+
console.warn("PDFSidebarResizer: " + "The browser does not support resizing of the sidebar.");
|
60
51
|
return;
|
61
52
|
}
|
53
|
+
|
62
54
|
this.enabled = true;
|
63
|
-
this.resizer.classList.remove(
|
64
|
-
this.l10n.getDirection().then(
|
65
|
-
|
55
|
+
this.resizer.classList.remove("hidden");
|
56
|
+
this.l10n.getDirection().then(dir => {
|
57
|
+
this.isRTL = dir === "rtl";
|
66
58
|
});
|
59
|
+
|
67
60
|
this._addEventListeners();
|
68
61
|
}
|
69
62
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
63
|
+
get outerContainerWidth() {
|
64
|
+
if (!this._outerContainerWidth) {
|
65
|
+
this._outerContainerWidth = this.outerContainer.clientWidth;
|
66
|
+
}
|
74
67
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
}
|
82
|
-
if (width < SIDEBAR_MIN_WIDTH) {
|
83
|
-
width = SIDEBAR_MIN_WIDTH;
|
84
|
-
}
|
85
|
-
if (width === this._width) {
|
86
|
-
return false;
|
87
|
-
}
|
88
|
-
this._width = width;
|
89
|
-
this.doc.style.setProperty(SIDEBAR_WIDTH_VAR, width + 'px');
|
90
|
-
return true;
|
68
|
+
return this._outerContainerWidth;
|
69
|
+
}
|
70
|
+
|
71
|
+
_updateWidth(width = 0) {
|
72
|
+
if (!this.enabled) {
|
73
|
+
return false;
|
91
74
|
}
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
width = this.outerContainerWidth - width;
|
98
|
-
}
|
99
|
-
this._updateWidth(width);
|
75
|
+
|
76
|
+
const newWidth = (0, _ui_utils.clamp)(width, SIDEBAR_MIN_WIDTH, Math.floor(this.outerContainerWidth / 2));
|
77
|
+
|
78
|
+
if (newWidth === this._width) {
|
79
|
+
return false;
|
100
80
|
}
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
81
|
+
|
82
|
+
this._width = newWidth;
|
83
|
+
this.doc.style.setProperty(SIDEBAR_WIDTH_VAR, `${newWidth}px`);
|
84
|
+
return true;
|
85
|
+
}
|
86
|
+
|
87
|
+
_mouseMove(evt) {
|
88
|
+
let width = evt.clientX;
|
89
|
+
|
90
|
+
if (this.isRTL) {
|
91
|
+
width = this.outerContainerWidth - width;
|
109
92
|
}
|
110
|
-
}, {
|
111
|
-
key: '_addEventListeners',
|
112
|
-
value: function _addEventListeners() {
|
113
|
-
var _this2 = this;
|
114
93
|
|
115
|
-
|
94
|
+
this._updateWidth(width);
|
95
|
+
}
|
96
|
+
|
97
|
+
_mouseUp(evt) {
|
98
|
+
this.outerContainer.classList.remove(SIDEBAR_RESIZING_CLASS);
|
99
|
+
this.eventBus.dispatch("resize", {
|
100
|
+
source: this
|
101
|
+
});
|
102
|
+
const _boundEvents = this._boundEvents;
|
103
|
+
window.removeEventListener("mousemove", _boundEvents.mouseMove);
|
104
|
+
window.removeEventListener("mouseup", _boundEvents.mouseUp);
|
105
|
+
}
|
106
|
+
|
107
|
+
_addEventListeners() {
|
108
|
+
if (!this.enabled) {
|
109
|
+
return;
|
110
|
+
}
|
111
|
+
|
112
|
+
const _boundEvents = this._boundEvents;
|
113
|
+
_boundEvents.mouseMove = this._mouseMove.bind(this);
|
114
|
+
_boundEvents.mouseUp = this._mouseUp.bind(this);
|
115
|
+
this.resizer.addEventListener("mousedown", evt => {
|
116
|
+
if (evt.button !== 0) {
|
116
117
|
return;
|
117
118
|
}
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
}
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
119
|
+
|
120
|
+
this.outerContainer.classList.add(SIDEBAR_RESIZING_CLASS);
|
121
|
+
window.addEventListener("mousemove", _boundEvents.mouseMove);
|
122
|
+
window.addEventListener("mouseup", _boundEvents.mouseUp);
|
123
|
+
});
|
124
|
+
|
125
|
+
this.eventBus._on("sidebarviewchanged", evt => {
|
126
|
+
this.sidebarOpen = !!(evt && evt.view);
|
127
|
+
});
|
128
|
+
|
129
|
+
this.eventBus._on("resize", evt => {
|
130
|
+
if (!evt || evt.source !== window) {
|
131
|
+
return;
|
132
|
+
}
|
133
|
+
|
134
|
+
this._outerContainerWidth = null;
|
135
|
+
|
136
|
+
if (!this._width) {
|
137
|
+
return;
|
138
|
+
}
|
139
|
+
|
140
|
+
if (!this.sidebarOpen) {
|
141
|
+
this._updateWidth(this._width);
|
142
|
+
|
143
|
+
return;
|
144
|
+
}
|
145
|
+
|
146
|
+
this.outerContainer.classList.add(SIDEBAR_RESIZING_CLASS);
|
147
|
+
|
148
|
+
const updated = this._updateWidth(this._width);
|
149
|
+
|
150
|
+
Promise.resolve().then(() => {
|
151
|
+
this.outerContainer.classList.remove(SIDEBAR_RESIZING_CLASS);
|
152
|
+
|
153
|
+
if (updated) {
|
154
|
+
this.eventBus.dispatch("resize", {
|
155
|
+
source: this
|
156
|
+
});
|
149
157
|
}
|
150
158
|
});
|
151
|
-
}
|
152
|
-
}
|
153
|
-
key: 'outerContainerWidth',
|
154
|
-
get: function get() {
|
155
|
-
if (!this._outerContainerWidth) {
|
156
|
-
this._outerContainerWidth = this.outerContainer.clientWidth;
|
157
|
-
}
|
158
|
-
return this._outerContainerWidth;
|
159
|
-
}
|
160
|
-
}]);
|
159
|
+
});
|
160
|
+
}
|
161
161
|
|
162
|
-
|
163
|
-
}();
|
162
|
+
}
|
164
163
|
|
165
164
|
exports.PDFSidebarResizer = PDFSidebarResizer;
|
@@ -2,7 +2,7 @@
|
|
2
2
|
* @licstart The following is the entire license notice for the
|
3
3
|
* Javascript code in this page
|
4
4
|
*
|
5
|
-
* Copyright
|
5
|
+
* Copyright 2020 Mozilla Foundation
|
6
6
|
*
|
7
7
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
8
8
|
* you may not use this file except in compliance with the License.
|
@@ -19,171 +19,119 @@
|
|
19
19
|
* @licend The above is the entire license notice for the
|
20
20
|
* Javascript code in this page
|
21
21
|
*/
|
22
|
-
|
22
|
+
"use strict";
|
23
23
|
|
24
24
|
Object.defineProperty(exports, "__esModule", {
|
25
25
|
value: true
|
26
26
|
});
|
27
|
-
exports.PDFSinglePageViewer =
|
27
|
+
exports.PDFSinglePageViewer = void 0;
|
28
28
|
|
29
|
-
var
|
29
|
+
var _base_viewer = require("./base_viewer.js");
|
30
30
|
|
31
|
-
var
|
31
|
+
var _pdf = require("../pdf");
|
32
32
|
|
33
|
-
|
33
|
+
class PDFSinglePageViewer extends _base_viewer.BaseViewer {
|
34
|
+
constructor(options) {
|
35
|
+
super(options);
|
34
36
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
37
|
+
this.eventBus._on("pagesinit", evt => {
|
38
|
+
this._ensurePageViewVisible();
|
39
|
+
});
|
40
|
+
}
|
40
41
|
|
41
|
-
|
42
|
+
get _setDocumentViewerElement() {
|
43
|
+
return (0, _pdf.shadow)(this, "_setDocumentViewerElement", this._shadowViewer);
|
44
|
+
}
|
42
45
|
|
43
|
-
|
46
|
+
_resetView() {
|
47
|
+
super._resetView();
|
44
48
|
|
45
|
-
|
46
|
-
|
49
|
+
this._previousPageNumber = 1;
|
50
|
+
this._shadowViewer = document.createDocumentFragment();
|
51
|
+
this._updateScrollDown = null;
|
52
|
+
}
|
47
53
|
|
48
|
-
|
49
|
-
|
54
|
+
_ensurePageViewVisible() {
|
55
|
+
const pageView = this._pages[this._currentPageNumber - 1];
|
56
|
+
const previousPageView = this._pages[this._previousPageNumber - 1];
|
57
|
+
const viewerNodes = this.viewer.childNodes;
|
50
58
|
|
51
|
-
|
59
|
+
switch (viewerNodes.length) {
|
60
|
+
case 0:
|
61
|
+
this.viewer.appendChild(pageView.div);
|
62
|
+
break;
|
52
63
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
}
|
64
|
+
case 1:
|
65
|
+
if (viewerNodes[0] !== previousPageView.div) {
|
66
|
+
throw new Error("_ensurePageViewVisible: Unexpected previously visible page.");
|
67
|
+
}
|
58
68
|
|
59
|
-
|
60
|
-
key: '_resetView',
|
61
|
-
value: function _resetView() {
|
62
|
-
_get(PDFSinglePageViewer.prototype.__proto__ || Object.getPrototypeOf(PDFSinglePageViewer.prototype), '_resetView', this).call(this);
|
63
|
-
this._previousPageNumber = 1;
|
64
|
-
this._shadowViewer = document.createDocumentFragment();
|
65
|
-
}
|
66
|
-
}, {
|
67
|
-
key: '_ensurePageViewVisible',
|
68
|
-
value: function _ensurePageViewVisible() {
|
69
|
-
var pageView = this._pages[this._currentPageNumber - 1];
|
70
|
-
var previousPageView = this._pages[this._previousPageNumber - 1];
|
71
|
-
var viewerNodes = this.viewer.childNodes;
|
72
|
-
switch (viewerNodes.length) {
|
73
|
-
case 0:
|
74
|
-
this.viewer.appendChild(pageView.div);
|
75
|
-
break;
|
76
|
-
case 1:
|
77
|
-
if (viewerNodes[0] !== previousPageView.div) {
|
78
|
-
throw new Error('_ensurePageViewVisible: Unexpected previously visible page.');
|
79
|
-
}
|
80
|
-
if (pageView === previousPageView) {
|
81
|
-
break;
|
82
|
-
}
|
83
|
-
this._shadowViewer.appendChild(previousPageView.div);
|
84
|
-
this.viewer.appendChild(pageView.div);
|
85
|
-
this.container.scrollTop = 0;
|
69
|
+
if (pageView === previousPageView) {
|
86
70
|
break;
|
87
|
-
default:
|
88
|
-
throw new Error('_ensurePageViewVisible: Only one page should be visible at a time.');
|
89
|
-
}
|
90
|
-
this._previousPageNumber = this._currentPageNumber;
|
91
|
-
}
|
92
|
-
}, {
|
93
|
-
key: '_scrollUpdate',
|
94
|
-
value: function _scrollUpdate() {
|
95
|
-
if (this._updateScrollDown) {
|
96
|
-
this._updateScrollDown();
|
97
|
-
}
|
98
|
-
_get(PDFSinglePageViewer.prototype.__proto__ || Object.getPrototypeOf(PDFSinglePageViewer.prototype), '_scrollUpdate', this).call(this);
|
99
|
-
}
|
100
|
-
}, {
|
101
|
-
key: '_scrollIntoView',
|
102
|
-
value: function _scrollIntoView(_ref) {
|
103
|
-
var _this2 = this;
|
104
|
-
|
105
|
-
var pageDiv = _ref.pageDiv,
|
106
|
-
_ref$pageSpot = _ref.pageSpot,
|
107
|
-
pageSpot = _ref$pageSpot === undefined ? null : _ref$pageSpot,
|
108
|
-
_ref$pageNumber = _ref.pageNumber,
|
109
|
-
pageNumber = _ref$pageNumber === undefined ? null : _ref$pageNumber;
|
110
|
-
|
111
|
-
if (pageNumber) {
|
112
|
-
this._setCurrentPageNumber(pageNumber);
|
113
|
-
}
|
114
|
-
var scrolledDown = this._currentPageNumber >= this._previousPageNumber;
|
115
|
-
var previousLocation = this._location;
|
116
|
-
this._ensurePageViewVisible();
|
117
|
-
(0, _ui_utils.scrollIntoView)(pageDiv, pageSpot);
|
118
|
-
this._updateScrollDown = function () {
|
119
|
-
_this2.scroll.down = scrolledDown;
|
120
|
-
delete _this2._updateScrollDown;
|
121
|
-
};
|
122
|
-
setTimeout(function () {
|
123
|
-
if (_this2._location === previousLocation) {
|
124
|
-
if (_this2._updateScrollDown) {
|
125
|
-
_this2._updateScrollDown();
|
126
|
-
}
|
127
|
-
_this2.update();
|
128
71
|
}
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
var element = pageView.div;
|
139
|
-
var view = {
|
140
|
-
id: pageView.id,
|
141
|
-
x: element.offsetLeft + element.clientLeft,
|
142
|
-
y: element.offsetTop + element.clientTop,
|
143
|
-
view: pageView
|
144
|
-
};
|
145
|
-
return {
|
146
|
-
first: view,
|
147
|
-
last: view,
|
148
|
-
views: [view]
|
149
|
-
};
|
150
|
-
}
|
151
|
-
}, {
|
152
|
-
key: 'update',
|
153
|
-
value: function update() {
|
154
|
-
var visible = this._getVisiblePages();
|
155
|
-
var visiblePages = visible.views,
|
156
|
-
numVisiblePages = visiblePages.length;
|
157
|
-
if (numVisiblePages === 0) {
|
158
|
-
return;
|
159
|
-
}
|
160
|
-
this._resizeBuffer(numVisiblePages);
|
161
|
-
this.renderingQueue.renderHighestPriority(visible);
|
162
|
-
this._updateLocation(visible.first);
|
163
|
-
this.eventBus.dispatch('updateviewarea', {
|
164
|
-
source: this,
|
165
|
-
location: this._location
|
166
|
-
});
|
72
|
+
|
73
|
+
this._shadowViewer.appendChild(previousPageView.div);
|
74
|
+
|
75
|
+
this.viewer.appendChild(pageView.div);
|
76
|
+
this.container.scrollTop = 0;
|
77
|
+
break;
|
78
|
+
|
79
|
+
default:
|
80
|
+
throw new Error("_ensurePageViewVisible: Only one page should be visible at a time.");
|
167
81
|
}
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
key: '_setDocumentViewerElement',
|
176
|
-
get: function get() {
|
177
|
-
return (0, _pdf.shadow)(this, '_setDocumentViewerElement', this._shadowViewer);
|
82
|
+
|
83
|
+
this._previousPageNumber = this._currentPageNumber;
|
84
|
+
}
|
85
|
+
|
86
|
+
_scrollUpdate() {
|
87
|
+
if (this._updateScrollDown) {
|
88
|
+
this._updateScrollDown();
|
178
89
|
}
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
90
|
+
|
91
|
+
super._scrollUpdate();
|
92
|
+
}
|
93
|
+
|
94
|
+
_scrollIntoView({
|
95
|
+
pageDiv,
|
96
|
+
pageSpot = null,
|
97
|
+
pageNumber = null
|
98
|
+
}) {
|
99
|
+
if (pageNumber) {
|
100
|
+
this._setCurrentPageNumber(pageNumber);
|
183
101
|
}
|
184
|
-
}]);
|
185
102
|
|
186
|
-
|
187
|
-
|
103
|
+
const scrolledDown = this._currentPageNumber >= this._previousPageNumber;
|
104
|
+
|
105
|
+
this._ensurePageViewVisible();
|
106
|
+
|
107
|
+
this.update();
|
108
|
+
|
109
|
+
super._scrollIntoView({
|
110
|
+
pageDiv,
|
111
|
+
pageSpot,
|
112
|
+
pageNumber
|
113
|
+
});
|
114
|
+
|
115
|
+
this._updateScrollDown = () => {
|
116
|
+
this.scroll.down = scrolledDown;
|
117
|
+
this._updateScrollDown = null;
|
118
|
+
};
|
119
|
+
}
|
120
|
+
|
121
|
+
_getVisiblePages() {
|
122
|
+
return this._getCurrentVisiblePage();
|
123
|
+
}
|
124
|
+
|
125
|
+
_updateHelper(visiblePages) {}
|
126
|
+
|
127
|
+
get _isScrollModeHorizontal() {
|
128
|
+
return (0, _pdf.shadow)(this, "_isScrollModeHorizontal", false);
|
129
|
+
}
|
130
|
+
|
131
|
+
_updateScrollMode() {}
|
132
|
+
|
133
|
+
_updateSpreadMode() {}
|
134
|
+
|
135
|
+
}
|
188
136
|
|
189
137
|
exports.PDFSinglePageViewer = PDFSinglePageViewer;
|