pdfjs-dist 2.0.489 → 2.2.228
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/bower.json +1 -1
- package/build/pdf.js +18515 -11402
- package/build/pdf.js.map +1 -1
- package/build/pdf.min.js +1 -1
- package/build/pdf.worker.js +48266 -37137
- package/build/pdf.worker.js.map +1 -1
- package/build/pdf.worker.min.js +1 -1
- package/external/url/url-lib.js +627 -0
- package/image_decoders/pdf.image_decoders.js +11350 -0
- package/image_decoders/pdf.image_decoders.js.map +1 -0
- package/image_decoders/pdf.image_decoders.min.js +1 -0
- package/lib/core/annotation.js +587 -242
- package/lib/core/arithmetic_decoder.js +275 -245
- package/lib/core/bidi.js +65 -6
- package/lib/core/ccitt.js +173 -18
- package/lib/core/ccitt_stream.js +15 -6
- package/lib/core/cff_parser.js +433 -61
- package/lib/core/charsets.js +5 -4
- package/lib/core/chunked_stream.js +400 -152
- package/lib/core/cmap.js +326 -87
- package/lib/core/colorspace.js +874 -594
- package/lib/core/core_utils.js +147 -0
- package/lib/core/crypto.js +290 -45
- package/lib/core/document.js +560 -268
- package/lib/core/encodings.js +19 -10
- package/lib/core/evaluator.js +1005 -360
- package/lib/core/font_renderer.js +331 -97
- package/lib/core/fonts.js +812 -195
- package/lib/core/function.js +284 -71
- package/lib/core/glyphlist.js +4 -3
- package/lib/core/image.js +169 -62
- package/lib/core/image_utils.js +111 -0
- package/lib/core/jbig2.js +479 -66
- package/lib/core/jbig2_stream.js +19 -8
- package/lib/core/jpeg_stream.js +38 -13
- package/lib/core/jpg.js +253 -29
- package/lib/core/jpx.js +396 -6
- package/lib/core/jpx_stream.js +18 -6
- package/lib/core/metrics.js +15 -15
- package/lib/core/murmurhash3.js +56 -34
- package/lib/core/obj.js +1354 -488
- package/lib/core/operator_list.js +144 -31
- package/lib/core/parser.js +539 -191
- package/lib/core/pattern.js +148 -14
- package/lib/core/pdf_manager.js +323 -133
- package/lib/core/primitives.js +111 -24
- package/lib/core/ps_parser.js +134 -45
- package/lib/core/standard_fonts.js +17 -17
- package/lib/core/stream.js +313 -34
- package/lib/core/type1_parser.js +143 -13
- package/lib/core/unicode.js +32 -5
- package/lib/core/worker.js +217 -190
- package/lib/core/worker_stream.js +277 -0
- package/lib/display/annotation_layer.js +450 -133
- package/lib/display/api.js +1597 -784
- package/lib/display/api_compatibility.js +11 -13
- package/lib/display/canvas.js +360 -44
- package/lib/display/content_disposition.js +83 -32
- package/lib/display/display_utils.js +747 -0
- package/lib/display/fetch_stream.js +221 -90
- package/lib/display/font_loader.js +468 -236
- package/lib/display/metadata.js +38 -16
- package/lib/display/network.js +635 -428
- package/lib/display/network_utils.js +32 -19
- package/lib/display/node_stream.js +367 -175
- package/lib/display/pattern_helper.js +81 -31
- package/lib/display/svg.js +1235 -519
- package/lib/display/text_layer.js +153 -29
- package/lib/display/transport_stream.js +345 -94
- package/lib/display/webgl.js +64 -18
- package/lib/display/worker_options.js +5 -4
- package/lib/display/xml_parser.js +166 -53
- package/lib/examples/node/domstubs.js +60 -4
- package/lib/pdf.js +36 -14
- package/lib/pdf.worker.js +5 -3
- package/lib/shared/compatibility.js +158 -564
- package/lib/shared/global_scope.js +2 -2
- package/lib/shared/is_node.js +4 -4
- package/lib/shared/message_handler.js +521 -0
- package/lib/shared/streams_polyfill.js +21 -17
- package/lib/shared/url_polyfill.js +56 -0
- package/lib/shared/util.js +243 -710
- package/lib/test/unit/annotation_spec.js +870 -401
- package/lib/test/unit/api_spec.js +657 -345
- package/lib/test/unit/bidi_spec.js +7 -7
- package/lib/test/unit/cff_parser_spec.js +54 -11
- package/lib/test/unit/clitests_helper.js +10 -8
- package/lib/test/unit/cmap_spec.js +95 -41
- package/lib/test/unit/colorspace_spec.js +115 -63
- package/lib/test/unit/core_utils_spec.js +191 -0
- package/lib/test/unit/crypto_spec.js +17 -5
- package/lib/test/unit/custom_spec.js +43 -55
- package/lib/test/unit/display_svg_spec.js +34 -18
- package/lib/test/unit/display_utils_spec.js +273 -0
- package/lib/test/unit/document_spec.js +8 -13
- package/lib/test/unit/encodings_spec.js +25 -45
- package/lib/test/unit/evaluator_spec.js +38 -15
- package/lib/test/unit/fetch_stream_spec.js +109 -0
- package/lib/test/unit/function_spec.js +17 -5
- package/lib/test/unit/jasmine-boot.js +33 -20
- package/lib/test/unit/{util_stream_spec.js → message_handler_spec.js} +41 -69
- package/lib/test/unit/metadata_spec.js +71 -11
- package/lib/test/unit/murmurhash3_spec.js +3 -3
- package/lib/test/unit/network_spec.js +19 -54
- package/lib/test/unit/network_utils_spec.js +91 -14
- package/lib/test/unit/node_stream_spec.js +56 -32
- package/lib/test/unit/parser_spec.js +162 -71
- package/lib/test/unit/pdf_find_controller_spec.js +230 -0
- package/lib/test/unit/pdf_find_utils_spec.js +63 -0
- package/lib/test/unit/pdf_history_spec.js +21 -9
- package/lib/test/unit/primitives_spec.js +53 -20
- package/lib/test/unit/stream_spec.js +12 -4
- package/lib/test/unit/test_utils.js +273 -56
- package/lib/test/unit/testreporter.js +21 -3
- package/lib/test/unit/type1_parser_spec.js +8 -6
- package/lib/test/unit/ui_utils_spec.js +454 -16
- package/lib/test/unit/unicode_spec.js +18 -15
- package/lib/test/unit/util_spec.js +87 -128
- package/lib/web/annotation_layer_builder.js +39 -22
- package/lib/web/app.js +1290 -588
- package/lib/web/app_options.js +100 -62
- package/lib/web/base_viewer.js +511 -182
- package/lib/web/chromecom.js +261 -117
- package/lib/web/debugger.js +166 -22
- package/lib/web/download_manager.js +32 -13
- package/lib/web/firefox_print_service.js +20 -10
- package/lib/web/firefoxcom.js +315 -80
- package/lib/web/genericcom.js +89 -30
- package/lib/web/genericl10n.js +142 -30
- package/lib/web/grab_to_pan.js +28 -4
- package/lib/web/interfaces.js +170 -47
- package/lib/web/overlay_manager.js +235 -85
- package/lib/web/password_prompt.js +22 -14
- package/lib/web/pdf_attachment_viewer.js +38 -18
- package/lib/web/pdf_cursor_tools.js +39 -16
- package/lib/web/pdf_document_properties.js +255 -136
- package/lib/web/pdf_find_bar.js +84 -40
- package/lib/web/pdf_find_controller.js +495 -184
- package/lib/web/pdf_find_utils.js +111 -0
- package/lib/web/pdf_history.js +190 -53
- package/lib/web/pdf_link_service.js +138 -77
- package/lib/web/pdf_outline_viewer.js +122 -46
- package/lib/web/pdf_page_view.js +191 -67
- package/lib/web/pdf_presentation_mode.js +99 -34
- package/lib/web/pdf_print_service.js +61 -13
- package/lib/web/pdf_rendering_queue.js +28 -9
- package/lib/web/pdf_sidebar.js +141 -81
- package/lib/web/pdf_sidebar_resizer.js +42 -16
- package/lib/web/pdf_single_page_viewer.js +74 -66
- package/lib/web/pdf_thumbnail_view.js +104 -33
- package/lib/web/pdf_thumbnail_viewer.js +66 -26
- package/lib/web/pdf_viewer.component.js +112 -32
- package/lib/web/pdf_viewer.js +91 -52
- package/lib/web/preferences.js +284 -89
- package/lib/web/secondary_toolbar.js +165 -40
- package/lib/web/text_layer_builder.js +134 -59
- package/lib/web/toolbar.js +78 -43
- package/lib/web/ui_utils.js +462 -136
- package/lib/web/view_history.js +215 -67
- package/lib/web/viewer_compatibility.js +4 -13
- package/package.json +5 -4
- package/web/pdf_viewer.css +79 -11
- package/web/pdf_viewer.js +6107 -3748
- package/web/pdf_viewer.js.map +1 -1
- package/lib/display/dom_utils.js +0 -309
- package/lib/test/unit/dom_utils_spec.js +0 -89
- package/lib/test/unit/fonts_spec.js +0 -81
- package/lib/web/dom_events.js +0 -137
@@ -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 2019 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,19 +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.PDFPresentationMode =
|
27
|
+
exports.PDFPresentationMode = void 0;
|
28
28
|
|
29
|
-
var
|
30
|
-
|
31
|
-
var _ui_utils = require('./ui_utils');
|
29
|
+
var _ui_utils = require("./ui_utils");
|
32
30
|
|
33
31
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
34
32
|
|
33
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
34
|
+
|
35
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
36
|
+
|
35
37
|
var DELAY_BEFORE_RESETTING_SWITCH_IN_PROGRESS = 1500;
|
36
38
|
var DELAY_BEFORE_HIDING_CONTROLS = 3000;
|
37
39
|
var ACTIVE_SELECTOR = 'pdfPresentationMode';
|
@@ -41,17 +43,19 @@ var PAGE_SWITCH_THRESHOLD = 0.1;
|
|
41
43
|
var SWIPE_MIN_DISTANCE_THRESHOLD = 50;
|
42
44
|
var SWIPE_ANGLE_THRESHOLD = Math.PI / 6;
|
43
45
|
|
44
|
-
var PDFPresentationMode =
|
46
|
+
var PDFPresentationMode =
|
47
|
+
/*#__PURE__*/
|
48
|
+
function () {
|
45
49
|
function PDFPresentationMode(_ref) {
|
46
50
|
var _this = this;
|
47
51
|
|
48
52
|
var container = _ref.container,
|
49
53
|
_ref$viewer = _ref.viewer,
|
50
|
-
viewer = _ref$viewer ===
|
54
|
+
viewer = _ref$viewer === void 0 ? null : _ref$viewer,
|
51
55
|
pdfViewer = _ref.pdfViewer,
|
52
56
|
eventBus = _ref.eventBus,
|
53
57
|
_ref$contextMenuItems = _ref.contextMenuItems,
|
54
|
-
contextMenuItems = _ref$contextMenuItems ===
|
58
|
+
contextMenuItems = _ref$contextMenuItems === void 0 ? null : _ref$contextMenuItems;
|
55
59
|
|
56
60
|
_classCallCheck(this, PDFPresentationMode);
|
57
61
|
|
@@ -65,35 +69,52 @@ var PDFPresentationMode = function () {
|
|
65
69
|
this.mouseScrollTimeStamp = 0;
|
66
70
|
this.mouseScrollDelta = 0;
|
67
71
|
this.touchSwipeState = null;
|
72
|
+
|
68
73
|
if (contextMenuItems) {
|
69
74
|
contextMenuItems.contextFirstPage.addEventListener('click', function () {
|
70
75
|
_this.contextMenuOpen = false;
|
71
|
-
|
76
|
+
|
77
|
+
_this.eventBus.dispatch('firstpage', {
|
78
|
+
source: _this
|
79
|
+
});
|
72
80
|
});
|
73
81
|
contextMenuItems.contextLastPage.addEventListener('click', function () {
|
74
82
|
_this.contextMenuOpen = false;
|
75
|
-
|
83
|
+
|
84
|
+
_this.eventBus.dispatch('lastpage', {
|
85
|
+
source: _this
|
86
|
+
});
|
76
87
|
});
|
77
88
|
contextMenuItems.contextPageRotateCw.addEventListener('click', function () {
|
78
89
|
_this.contextMenuOpen = false;
|
79
|
-
|
90
|
+
|
91
|
+
_this.eventBus.dispatch('rotatecw', {
|
92
|
+
source: _this
|
93
|
+
});
|
80
94
|
});
|
81
95
|
contextMenuItems.contextPageRotateCcw.addEventListener('click', function () {
|
82
96
|
_this.contextMenuOpen = false;
|
83
|
-
|
97
|
+
|
98
|
+
_this.eventBus.dispatch('rotateccw', {
|
99
|
+
source: _this
|
100
|
+
});
|
84
101
|
});
|
85
102
|
}
|
86
103
|
}
|
87
104
|
|
88
105
|
_createClass(PDFPresentationMode, [{
|
89
|
-
key:
|
106
|
+
key: "request",
|
90
107
|
value: function request() {
|
91
108
|
if (this.switchInProgress || this.active || !this.viewer.hasChildNodes()) {
|
92
109
|
return false;
|
93
110
|
}
|
111
|
+
|
94
112
|
this._addFullscreenChangeListeners();
|
113
|
+
|
95
114
|
this._setSwitchInProgress();
|
115
|
+
|
96
116
|
this._notifyStateChange();
|
117
|
+
|
97
118
|
if (this.container.requestFullscreen) {
|
98
119
|
this.container.requestFullscreen();
|
99
120
|
} else if (this.container.mozRequestFullScreen) {
|
@@ -105,6 +126,7 @@ var PDFPresentationMode = function () {
|
|
105
126
|
} else {
|
106
127
|
return false;
|
107
128
|
}
|
129
|
+
|
108
130
|
this.args = {
|
109
131
|
page: this.pdfViewer.currentPageNumber,
|
110
132
|
previousScale: this.pdfViewer.currentScaleValue
|
@@ -112,53 +134,65 @@ var PDFPresentationMode = function () {
|
|
112
134
|
return true;
|
113
135
|
}
|
114
136
|
}, {
|
115
|
-
key:
|
137
|
+
key: "_mouseWheel",
|
116
138
|
value: function _mouseWheel(evt) {
|
117
139
|
if (!this.active) {
|
118
140
|
return;
|
119
141
|
}
|
142
|
+
|
120
143
|
evt.preventDefault();
|
121
144
|
var delta = (0, _ui_utils.normalizeWheelEventDelta)(evt);
|
122
145
|
var currentTime = new Date().getTime();
|
123
146
|
var storedTime = this.mouseScrollTimeStamp;
|
147
|
+
|
124
148
|
if (currentTime > storedTime && currentTime - storedTime < MOUSE_SCROLL_COOLDOWN_TIME) {
|
125
149
|
return;
|
126
150
|
}
|
151
|
+
|
127
152
|
if (this.mouseScrollDelta > 0 && delta < 0 || this.mouseScrollDelta < 0 && delta > 0) {
|
128
153
|
this._resetMouseScrollState();
|
129
154
|
}
|
155
|
+
|
130
156
|
this.mouseScrollDelta += delta;
|
157
|
+
|
131
158
|
if (Math.abs(this.mouseScrollDelta) >= PAGE_SWITCH_THRESHOLD) {
|
132
159
|
var totalDelta = this.mouseScrollDelta;
|
160
|
+
|
133
161
|
this._resetMouseScrollState();
|
162
|
+
|
134
163
|
var success = totalDelta > 0 ? this._goToPreviousPage() : this._goToNextPage();
|
164
|
+
|
135
165
|
if (success) {
|
136
166
|
this.mouseScrollTimeStamp = currentTime;
|
137
167
|
}
|
138
168
|
}
|
139
169
|
}
|
140
170
|
}, {
|
141
|
-
key:
|
171
|
+
key: "_goToPreviousPage",
|
142
172
|
value: function _goToPreviousPage() {
|
143
173
|
var page = this.pdfViewer.currentPageNumber;
|
174
|
+
|
144
175
|
if (page <= 1) {
|
145
176
|
return false;
|
146
177
|
}
|
178
|
+
|
147
179
|
this.pdfViewer.currentPageNumber = page - 1;
|
148
180
|
return true;
|
149
181
|
}
|
150
182
|
}, {
|
151
|
-
key:
|
183
|
+
key: "_goToNextPage",
|
152
184
|
value: function _goToNextPage() {
|
153
185
|
var page = this.pdfViewer.currentPageNumber;
|
186
|
+
|
154
187
|
if (page >= this.pdfViewer.pagesCount) {
|
155
188
|
return false;
|
156
189
|
}
|
190
|
+
|
157
191
|
this.pdfViewer.currentPageNumber = page + 1;
|
158
192
|
return true;
|
159
193
|
}
|
160
194
|
}, {
|
161
|
-
key:
|
195
|
+
key: "_notifyStateChange",
|
162
196
|
value: function _notifyStateChange() {
|
163
197
|
this.eventBus.dispatch('presentationmodechanged', {
|
164
198
|
source: this,
|
@@ -167,21 +201,24 @@ var PDFPresentationMode = function () {
|
|
167
201
|
});
|
168
202
|
}
|
169
203
|
}, {
|
170
|
-
key:
|
204
|
+
key: "_setSwitchInProgress",
|
171
205
|
value: function _setSwitchInProgress() {
|
172
206
|
var _this2 = this;
|
173
207
|
|
174
208
|
if (this.switchInProgress) {
|
175
209
|
clearTimeout(this.switchInProgress);
|
176
210
|
}
|
211
|
+
|
177
212
|
this.switchInProgress = setTimeout(function () {
|
178
213
|
_this2._removeFullscreenChangeListeners();
|
214
|
+
|
179
215
|
delete _this2.switchInProgress;
|
216
|
+
|
180
217
|
_this2._notifyStateChange();
|
181
218
|
}, DELAY_BEFORE_RESETTING_SWITCH_IN_PROGRESS);
|
182
219
|
}
|
183
220
|
}, {
|
184
|
-
key:
|
221
|
+
key: "_resetSwitchInProgress",
|
185
222
|
value: function _resetSwitchInProgress() {
|
186
223
|
if (this.switchInProgress) {
|
187
224
|
clearTimeout(this.switchInProgress);
|
@@ -189,26 +226,32 @@ var PDFPresentationMode = function () {
|
|
189
226
|
}
|
190
227
|
}
|
191
228
|
}, {
|
192
|
-
key:
|
229
|
+
key: "_enter",
|
193
230
|
value: function _enter() {
|
194
231
|
var _this3 = this;
|
195
232
|
|
196
233
|
this.active = true;
|
234
|
+
|
197
235
|
this._resetSwitchInProgress();
|
236
|
+
|
198
237
|
this._notifyStateChange();
|
238
|
+
|
199
239
|
this.container.classList.add(ACTIVE_SELECTOR);
|
200
240
|
setTimeout(function () {
|
201
241
|
_this3.pdfViewer.currentPageNumber = _this3.args.page;
|
202
242
|
_this3.pdfViewer.currentScaleValue = 'page-fit';
|
203
243
|
}, 0);
|
244
|
+
|
204
245
|
this._addWindowListeners();
|
246
|
+
|
205
247
|
this._showControls();
|
248
|
+
|
206
249
|
this.contextMenuOpen = false;
|
207
250
|
this.container.setAttribute('contextmenu', 'viewerContextMenu');
|
208
251
|
window.getSelection().removeAllRanges();
|
209
252
|
}
|
210
253
|
}, {
|
211
|
-
key:
|
254
|
+
key: "_exit",
|
212
255
|
value: function _exit() {
|
213
256
|
var _this4 = this;
|
214
257
|
|
@@ -216,30 +259,40 @@ var PDFPresentationMode = function () {
|
|
216
259
|
this.container.classList.remove(ACTIVE_SELECTOR);
|
217
260
|
setTimeout(function () {
|
218
261
|
_this4.active = false;
|
262
|
+
|
219
263
|
_this4._removeFullscreenChangeListeners();
|
264
|
+
|
220
265
|
_this4._notifyStateChange();
|
266
|
+
|
221
267
|
_this4.pdfViewer.currentScaleValue = _this4.args.previousScale;
|
222
268
|
_this4.pdfViewer.currentPageNumber = page;
|
223
269
|
_this4.args = null;
|
224
270
|
}, 0);
|
271
|
+
|
225
272
|
this._removeWindowListeners();
|
273
|
+
|
226
274
|
this._hideControls();
|
275
|
+
|
227
276
|
this._resetMouseScrollState();
|
277
|
+
|
228
278
|
this.container.removeAttribute('contextmenu');
|
229
279
|
this.contextMenuOpen = false;
|
230
280
|
}
|
231
281
|
}, {
|
232
|
-
key:
|
282
|
+
key: "_mouseDown",
|
233
283
|
value: function _mouseDown(evt) {
|
234
284
|
if (this.contextMenuOpen) {
|
235
285
|
this.contextMenuOpen = false;
|
236
286
|
evt.preventDefault();
|
237
287
|
return;
|
238
288
|
}
|
289
|
+
|
239
290
|
if (evt.button === 0) {
|
240
291
|
var isInternalLink = evt.target.href && evt.target.classList.contains('internalLink');
|
292
|
+
|
241
293
|
if (!isInternalLink) {
|
242
294
|
evt.preventDefault();
|
295
|
+
|
243
296
|
if (evt.shiftKey) {
|
244
297
|
this._goToPreviousPage();
|
245
298
|
} else {
|
@@ -249,12 +302,12 @@ var PDFPresentationMode = function () {
|
|
249
302
|
}
|
250
303
|
}
|
251
304
|
}, {
|
252
|
-
key:
|
305
|
+
key: "_contextMenu",
|
253
306
|
value: function _contextMenu() {
|
254
307
|
this.contextMenuOpen = true;
|
255
308
|
}
|
256
309
|
}, {
|
257
|
-
key:
|
310
|
+
key: "_showControls",
|
258
311
|
value: function _showControls() {
|
259
312
|
var _this5 = this;
|
260
313
|
|
@@ -263,37 +316,42 @@ var PDFPresentationMode = function () {
|
|
263
316
|
} else {
|
264
317
|
this.container.classList.add(CONTROLS_SELECTOR);
|
265
318
|
}
|
319
|
+
|
266
320
|
this.controlsTimeout = setTimeout(function () {
|
267
321
|
_this5.container.classList.remove(CONTROLS_SELECTOR);
|
322
|
+
|
268
323
|
delete _this5.controlsTimeout;
|
269
324
|
}, DELAY_BEFORE_HIDING_CONTROLS);
|
270
325
|
}
|
271
326
|
}, {
|
272
|
-
key:
|
327
|
+
key: "_hideControls",
|
273
328
|
value: function _hideControls() {
|
274
329
|
if (!this.controlsTimeout) {
|
275
330
|
return;
|
276
331
|
}
|
332
|
+
|
277
333
|
clearTimeout(this.controlsTimeout);
|
278
334
|
this.container.classList.remove(CONTROLS_SELECTOR);
|
279
335
|
delete this.controlsTimeout;
|
280
336
|
}
|
281
337
|
}, {
|
282
|
-
key:
|
338
|
+
key: "_resetMouseScrollState",
|
283
339
|
value: function _resetMouseScrollState() {
|
284
340
|
this.mouseScrollTimeStamp = 0;
|
285
341
|
this.mouseScrollDelta = 0;
|
286
342
|
}
|
287
343
|
}, {
|
288
|
-
key:
|
344
|
+
key: "_touchSwipe",
|
289
345
|
value: function _touchSwipe(evt) {
|
290
346
|
if (!this.active) {
|
291
347
|
return;
|
292
348
|
}
|
349
|
+
|
293
350
|
if (evt.touches.length > 1) {
|
294
351
|
this.touchSwipeState = null;
|
295
352
|
return;
|
296
353
|
}
|
354
|
+
|
297
355
|
switch (evt.type) {
|
298
356
|
case 'touchstart':
|
299
357
|
this.touchSwipeState = {
|
@@ -303,37 +361,44 @@ var PDFPresentationMode = function () {
|
|
303
361
|
endY: evt.touches[0].pageY
|
304
362
|
};
|
305
363
|
break;
|
364
|
+
|
306
365
|
case 'touchmove':
|
307
366
|
if (this.touchSwipeState === null) {
|
308
367
|
return;
|
309
368
|
}
|
369
|
+
|
310
370
|
this.touchSwipeState.endX = evt.touches[0].pageX;
|
311
371
|
this.touchSwipeState.endY = evt.touches[0].pageY;
|
312
372
|
evt.preventDefault();
|
313
373
|
break;
|
374
|
+
|
314
375
|
case 'touchend':
|
315
376
|
if (this.touchSwipeState === null) {
|
316
377
|
return;
|
317
378
|
}
|
379
|
+
|
318
380
|
var delta = 0;
|
319
381
|
var dx = this.touchSwipeState.endX - this.touchSwipeState.startX;
|
320
382
|
var dy = this.touchSwipeState.endY - this.touchSwipeState.startY;
|
321
383
|
var absAngle = Math.abs(Math.atan2(dy, dx));
|
384
|
+
|
322
385
|
if (Math.abs(dx) > SWIPE_MIN_DISTANCE_THRESHOLD && (absAngle <= SWIPE_ANGLE_THRESHOLD || absAngle >= Math.PI - SWIPE_ANGLE_THRESHOLD)) {
|
323
386
|
delta = dx;
|
324
387
|
} else if (Math.abs(dy) > SWIPE_MIN_DISTANCE_THRESHOLD && Math.abs(absAngle - Math.PI / 2) <= SWIPE_ANGLE_THRESHOLD) {
|
325
388
|
delta = dy;
|
326
389
|
}
|
390
|
+
|
327
391
|
if (delta > 0) {
|
328
392
|
this._goToPreviousPage();
|
329
393
|
} else if (delta < 0) {
|
330
394
|
this._goToNextPage();
|
331
395
|
}
|
396
|
+
|
332
397
|
break;
|
333
398
|
}
|
334
399
|
}
|
335
400
|
}, {
|
336
|
-
key:
|
401
|
+
key: "_addWindowListeners",
|
337
402
|
value: function _addWindowListeners() {
|
338
403
|
this.showControlsBind = this._showControls.bind(this);
|
339
404
|
this.mouseDownBind = this._mouseDown.bind(this);
|
@@ -351,7 +416,7 @@ var PDFPresentationMode = function () {
|
|
351
416
|
window.addEventListener('touchend', this.touchSwipeBind);
|
352
417
|
}
|
353
418
|
}, {
|
354
|
-
key:
|
419
|
+
key: "_removeWindowListeners",
|
355
420
|
value: function _removeWindowListeners() {
|
356
421
|
window.removeEventListener('mousemove', this.showControlsBind);
|
357
422
|
window.removeEventListener('mousedown', this.mouseDownBind);
|
@@ -369,7 +434,7 @@ var PDFPresentationMode = function () {
|
|
369
434
|
delete this.touchSwipeBind;
|
370
435
|
}
|
371
436
|
}, {
|
372
|
-
key:
|
437
|
+
key: "_fullscreenChange",
|
373
438
|
value: function _fullscreenChange() {
|
374
439
|
if (this.isFullscreen) {
|
375
440
|
this._enter();
|
@@ -378,7 +443,7 @@ var PDFPresentationMode = function () {
|
|
378
443
|
}
|
379
444
|
}
|
380
445
|
}, {
|
381
|
-
key:
|
446
|
+
key: "_addFullscreenChangeListeners",
|
382
447
|
value: function _addFullscreenChangeListeners() {
|
383
448
|
this.fullscreenChangeBind = this._fullscreenChange.bind(this);
|
384
449
|
window.addEventListener('fullscreenchange', this.fullscreenChangeBind);
|
@@ -387,7 +452,7 @@ var PDFPresentationMode = function () {
|
|
387
452
|
window.addEventListener('MSFullscreenChange', this.fullscreenChangeBind);
|
388
453
|
}
|
389
454
|
}, {
|
390
|
-
key:
|
455
|
+
key: "_removeFullscreenChangeListeners",
|
391
456
|
value: function _removeFullscreenChangeListeners() {
|
392
457
|
window.removeEventListener('fullscreenchange', this.fullscreenChangeBind);
|
393
458
|
window.removeEventListener('mozfullscreenchange', this.fullscreenChangeBind);
|
@@ -396,7 +461,7 @@ var PDFPresentationMode = function () {
|
|
396
461
|
delete this.fullscreenChangeBind;
|
397
462
|
}
|
398
463
|
}, {
|
399
|
-
key:
|
464
|
+
key: "isFullscreen",
|
400
465
|
get: function get() {
|
401
466
|
return !!(document.fullscreenElement || document.mozFullScreen || document.webkitIsFullScreen || document.msFullscreenElement);
|
402
467
|
}
|