@syncfusion/ej2-pdfviewer 17.3.48-4568 → 17.3.50-4568
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/dist/ej2-pdfviewer.umd.min.js +1 -1
- package/dist/ej2-pdfviewer.umd.min.js.map +1 -1
- package/dist/es6/ej2-pdfviewer.es2015.js +327 -61
- package/dist/es6/ej2-pdfviewer.es2015.js.map +1 -1
- package/dist/es6/ej2-pdfviewer.es5.js +327 -60
- package/dist/es6/ej2-pdfviewer.es5.js.map +1 -1
- package/package.json +54 -29
- package/src/pdfviewer/base/ajax-handler.d.ts +1 -0
- package/src/pdfviewer/base/ajax-handler.js +21 -3
- package/src/pdfviewer/base/pdfviewer-base.d.ts +45 -0
- package/src/pdfviewer/base/pdfviewer-base.js +164 -21
- package/src/pdfviewer/magnification/magnification.d.ts +24 -0
- package/src/pdfviewer/magnification/magnification.js +133 -32
- package/src/pdfviewer/pdfviewer-model.d.ts +15 -8
- package/src/pdfviewer/pdfviewer.d.ts +13 -7
- package/src/pdfviewer/pdfviewer.js +6 -3
- package/src/pdfviewer/toolbar/toolbar.js +3 -1
|
@@ -17787,6 +17787,37 @@ class PdfViewerBase {
|
|
|
17787
17787
|
* @private
|
|
17788
17788
|
*/
|
|
17789
17789
|
this.isReRenderRequired = true;
|
|
17790
|
+
/**
|
|
17791
|
+
* @private
|
|
17792
|
+
*/
|
|
17793
|
+
// eslint-disable-next-line
|
|
17794
|
+
this.isTouchPad = false;
|
|
17795
|
+
/**
|
|
17796
|
+
* @private
|
|
17797
|
+
*/
|
|
17798
|
+
// eslint-disable-next-line
|
|
17799
|
+
this.isMacGestureActive = false;
|
|
17800
|
+
/**
|
|
17801
|
+
* @private
|
|
17802
|
+
*/
|
|
17803
|
+
// eslint-disable-next-line
|
|
17804
|
+
this.macGestureStartScale = 0;
|
|
17805
|
+
/**
|
|
17806
|
+
* @private
|
|
17807
|
+
*/
|
|
17808
|
+
// eslint-disable-next-line
|
|
17809
|
+
this.zoomInterval = 5;
|
|
17810
|
+
/**
|
|
17811
|
+
* EJ2CORE-813 - This flag is represent current device is 'iPad' or 'iPhone' or'iPod' device.
|
|
17812
|
+
* @private
|
|
17813
|
+
*/
|
|
17814
|
+
// eslint-disable-next-line
|
|
17815
|
+
this.isDeviceiOS = (['iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod'].includes(navigator.platform) || (navigator.userAgent.includes("Mac") && "ontouchend" in document));
|
|
17816
|
+
/**
|
|
17817
|
+
* @private
|
|
17818
|
+
*/
|
|
17819
|
+
// eslint-disable-next-line
|
|
17820
|
+
this.isMacSafari = navigator.userAgent.indexOf("Safari") > -1 && navigator.userAgent.indexOf("Chrome") === -1 && !this.isDeviceiOS;
|
|
17790
17821
|
/**
|
|
17791
17822
|
* @private
|
|
17792
17823
|
*/
|
|
@@ -18065,6 +18096,49 @@ class PdfViewerBase {
|
|
|
18065
18096
|
this.isViewerMouseDown = false;
|
|
18066
18097
|
}
|
|
18067
18098
|
};
|
|
18099
|
+
/**
|
|
18100
|
+
* @param {any} event - The Wheel event.
|
|
18101
|
+
* @returns {void}
|
|
18102
|
+
*/
|
|
18103
|
+
this.detectTouchPad = (event) => {
|
|
18104
|
+
// eslint-disable-next-line max-len
|
|
18105
|
+
this.isTouchPad = event.wheelDeltaY ? (event.wheelDeltaY === (event.deltaY * -3) ? true : Math.abs(event.deltaY) < 60) : (event.deltaMode === 0);
|
|
18106
|
+
};
|
|
18107
|
+
/**
|
|
18108
|
+
* @param {any} event - The Wheel event.
|
|
18109
|
+
* @returns {void}
|
|
18110
|
+
*/
|
|
18111
|
+
this.handleMacGestureStart = (event) => {
|
|
18112
|
+
event.preventDefault();
|
|
18113
|
+
event.stopPropagation();
|
|
18114
|
+
this.macGestureStartScale = this.pdfViewer.magnification.zoomFactor;
|
|
18115
|
+
};
|
|
18116
|
+
/**
|
|
18117
|
+
* @param {any} event - The Wheel event.
|
|
18118
|
+
* @returns {void}
|
|
18119
|
+
*/
|
|
18120
|
+
this.handleMacGestureChange = (event) => {
|
|
18121
|
+
event.preventDefault();
|
|
18122
|
+
event.stopPropagation();
|
|
18123
|
+
let macX = event.clientX;
|
|
18124
|
+
let macY = event.clientY;
|
|
18125
|
+
let scale = Number((this.macGestureStartScale * event.scale).toFixed(2));
|
|
18126
|
+
if (!this.isMacGestureActive) {
|
|
18127
|
+
this.isMacGestureActive = true;
|
|
18128
|
+
this.pdfViewer.magnification.initiateMouseZoom(macX, macY, scale * 100);
|
|
18129
|
+
setTimeout(() => {
|
|
18130
|
+
this.isMacGestureActive = false;
|
|
18131
|
+
}, 70);
|
|
18132
|
+
}
|
|
18133
|
+
};
|
|
18134
|
+
/**
|
|
18135
|
+
* @param {any} event - The Wheel event.
|
|
18136
|
+
* @returns {void}
|
|
18137
|
+
*/
|
|
18138
|
+
this.handleMacGestureEnd = (event) => {
|
|
18139
|
+
event.preventDefault();
|
|
18140
|
+
event.stopPropagation();
|
|
18141
|
+
};
|
|
18068
18142
|
this.viewerContainerOnMouseWheel = (event) => {
|
|
18069
18143
|
this.isViewerMouseWheel = true;
|
|
18070
18144
|
if (this.getRerenderCanvasCreated()) {
|
|
@@ -18078,13 +18152,17 @@ class PdfViewerBase {
|
|
|
18078
18152
|
if (this.pdfViewer.magnification.zoomFactor >= 2) {
|
|
18079
18153
|
zoomDifference = 50;
|
|
18080
18154
|
}
|
|
18155
|
+
if (this.isTouchPad && !this.isMacSafari) {
|
|
18156
|
+
zoomDifference = zoomDifference / this.zoomInterval;
|
|
18157
|
+
}
|
|
18081
18158
|
// eslint-disable-next-line
|
|
18082
18159
|
if (event.wheelDelta > 0) {
|
|
18083
|
-
this.pdfViewer.magnification.
|
|
18160
|
+
this.pdfViewer.magnification.initiateMouseZoom(event.x, event.y, (this.pdfViewer.magnification.zoomFactor * 100) + zoomDifference);
|
|
18084
18161
|
}
|
|
18085
18162
|
else {
|
|
18086
|
-
this.pdfViewer.magnification.
|
|
18163
|
+
this.pdfViewer.magnification.initiateMouseZoom(event.x, event.y, (this.pdfViewer.magnification.zoomFactor * 100) - zoomDifference);
|
|
18087
18164
|
}
|
|
18165
|
+
this.isTouchPad = false;
|
|
18088
18166
|
}
|
|
18089
18167
|
if (this.pdfViewer.magnificationModule) {
|
|
18090
18168
|
this.pdfViewer.magnificationModule.pageRerenderOnMouseWheel();
|
|
@@ -18573,8 +18651,8 @@ class PdfViewerBase {
|
|
|
18573
18651
|
this.previousTime = new Date().getTime();
|
|
18574
18652
|
// tslint:disable-next-line:max-line-length
|
|
18575
18653
|
if (touchPoints.length === 1 && !(event.target.classList.contains('e-pv-touch-select-drop') || event.target.classList.contains('e-pv-touch-ellipse'))) {
|
|
18576
|
-
if (Browser.isDevice && this.pageCount > 0 && !this.isThumb && !(event.target.classList.contains('e-pv-hyperlink'))) {
|
|
18577
|
-
this.handleTaps(touchPoints);
|
|
18654
|
+
if ((Browser.isDevice || (typeof navigator !== 'undefined' && navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1 && Browser.isTouch === true)) && this.pageCount > 0 && !this.isThumb && !(event.target.classList.contains('e-pv-hyperlink'))) {
|
|
18655
|
+
this.handleTaps(touchPoints, event);
|
|
18578
18656
|
}
|
|
18579
18657
|
else if (!Browser.isDevice) {
|
|
18580
18658
|
this.handleTextBoxTaps(touchPoints);
|
|
@@ -18603,7 +18681,6 @@ class PdfViewerBase {
|
|
|
18603
18681
|
this.pdfViewer.textSelectionModule.initiateTouchSelection(event, this.touchClientX, this.touchClientY);
|
|
18604
18682
|
if (Browser.isDevice) {
|
|
18605
18683
|
clearTimeout(this.singleTapTimer);
|
|
18606
|
-
this.singleTapTimer = null;
|
|
18607
18684
|
this.tapCount = 0;
|
|
18608
18685
|
}
|
|
18609
18686
|
}
|
|
@@ -20115,7 +20192,16 @@ class PdfViewerBase {
|
|
|
20115
20192
|
}
|
|
20116
20193
|
this.viewerContainer.addEventListener('mousedown', this.viewerContainerOnMousedown);
|
|
20117
20194
|
this.viewerContainer.addEventListener('mouseup', this.viewerContainerOnMouseup);
|
|
20195
|
+
this.viewerContainer.addEventListener("wheel", this.detectTouchPad, false);
|
|
20118
20196
|
this.viewerContainer.addEventListener('wheel', this.viewerContainerOnMouseWheel);
|
|
20197
|
+
if (this.isMacSafari) {
|
|
20198
|
+
window.addEventListener('gesturestart', e => e.preventDefault());
|
|
20199
|
+
window.addEventListener('gesturechange', e => e.preventDefault());
|
|
20200
|
+
window.addEventListener('gestureend', e => e.preventDefault());
|
|
20201
|
+
this.viewerContainer.addEventListener('gesturestart', this.handleMacGestureStart, false);
|
|
20202
|
+
this.viewerContainer.addEventListener('gesturechange', this.handleMacGestureChange, false);
|
|
20203
|
+
this.viewerContainer.addEventListener('gestureend', this.handleMacGestureEnd, false);
|
|
20204
|
+
}
|
|
20119
20205
|
this.viewerContainer.addEventListener('mousemove', this.viewerContainerOnMousemove);
|
|
20120
20206
|
this.viewerContainer.addEventListener('mouseleave', this.viewerContainerOnMouseLeave);
|
|
20121
20207
|
this.viewerContainer.addEventListener('mouseenter', this.viewerContainerOnMouseEnter);
|
|
@@ -20139,6 +20225,12 @@ class PdfViewerBase {
|
|
|
20139
20225
|
}
|
|
20140
20226
|
else {
|
|
20141
20227
|
this.viewerContainer.addEventListener('touchstart', this.viewerContainerOnTouchStart);
|
|
20228
|
+
if (this.isWebkitMobile && this.isDeviceiOS) {
|
|
20229
|
+
// eslint-disable-next-line max-len
|
|
20230
|
+
this.viewerContainer.addEventListener("touchmove", (e) => { if (e.scale !== 1) {
|
|
20231
|
+
e.preventDefault();
|
|
20232
|
+
} }, { passive: false });
|
|
20233
|
+
}
|
|
20142
20234
|
this.viewerContainer.addEventListener('touchmove', this.viewerContainerOnTouchMove);
|
|
20143
20235
|
this.viewerContainer.addEventListener('touchend', this.viewerContainerOnTouchEnd);
|
|
20144
20236
|
this.viewerContainer.addEventListener('touchleave', this.viewerContainerOnTouchEnd);
|
|
@@ -20152,7 +20244,16 @@ class PdfViewerBase {
|
|
|
20152
20244
|
}
|
|
20153
20245
|
this.viewerContainer.removeEventListener('mousedown', this.viewerContainerOnMousedown);
|
|
20154
20246
|
this.viewerContainer.removeEventListener('mouseup', this.viewerContainerOnMouseup);
|
|
20247
|
+
this.viewerContainer.removeEventListener("wheel", this.detectTouchPad, false);
|
|
20155
20248
|
this.viewerContainer.removeEventListener('wheel', this.viewerContainerOnMouseWheel);
|
|
20249
|
+
if (this.isMacSafari) {
|
|
20250
|
+
window.removeEventListener('gesturestart', e => e.preventDefault());
|
|
20251
|
+
window.removeEventListener('gesturechange', e => e.preventDefault());
|
|
20252
|
+
window.removeEventListener('gestureend', e => e.preventDefault());
|
|
20253
|
+
this.viewerContainer.removeEventListener('gesturestart', this.handleMacGestureStart, false);
|
|
20254
|
+
this.viewerContainer.removeEventListener('gesturechange', this.handleMacGestureChange, false);
|
|
20255
|
+
this.viewerContainer.removeEventListener('gestureend', this.handleMacGestureEnd, false);
|
|
20256
|
+
}
|
|
20156
20257
|
this.viewerContainer.removeEventListener('mousemove', this.viewerContainerOnMousemove);
|
|
20157
20258
|
this.viewerContainer.removeEventListener('mouseleave', this.viewerContainerOnMouseLeave);
|
|
20158
20259
|
this.viewerContainer.removeEventListener('mouseenter', this.viewerContainerOnMouseEnter);
|
|
@@ -20173,6 +20274,12 @@ class PdfViewerBase {
|
|
|
20173
20274
|
}
|
|
20174
20275
|
else {
|
|
20175
20276
|
this.viewerContainer.removeEventListener('touchstart', this.viewerContainerOnTouchStart);
|
|
20277
|
+
if (this.isWebkitMobile && this.isDeviceiOS) {
|
|
20278
|
+
// eslint-disable-next-line max-len
|
|
20279
|
+
this.viewerContainer.removeEventListener("touchmove", (e) => { if (e.scale !== 1) {
|
|
20280
|
+
e.preventDefault();
|
|
20281
|
+
} }, false);
|
|
20282
|
+
}
|
|
20176
20283
|
this.viewerContainer.removeEventListener('touchmove', this.viewerContainerOnTouchMove);
|
|
20177
20284
|
this.viewerContainer.removeEventListener('touchend', this.viewerContainerOnTouchEnd);
|
|
20178
20285
|
this.viewerContainer.removeEventListener('touchleave', this.viewerContainerOnTouchEnd);
|
|
@@ -20288,28 +20395,64 @@ class PdfViewerBase {
|
|
|
20288
20395
|
}
|
|
20289
20396
|
this.isViewerContainerDoubleClick = false;
|
|
20290
20397
|
}
|
|
20291
|
-
handleTaps(touchPoints) {
|
|
20292
|
-
|
|
20293
|
-
|
|
20294
|
-
|
|
20295
|
-
|
|
20296
|
-
|
|
20297
|
-
this.
|
|
20398
|
+
handleTaps(touchPoints, event) {
|
|
20399
|
+
//EJ2CORE-813 - Implemented focus removing logic for iOS devices
|
|
20400
|
+
if (this.isDeviceiOS) {
|
|
20401
|
+
const obj = findActiveElement(event, this, this.pdfViewer);
|
|
20402
|
+
// eslint-disable-next-line
|
|
20403
|
+
let isRemoveFocus = !this.pdfViewer.annotation.freeTextAnnotationModule.isNewFreeTextAnnot && (obj && this.pdfViewer.selectedItems.annotations[0] ? obj.id !== this.pdfViewer.selectedItems.annotations[0].id : true) && document.activeElement.classList.contains('free-text-input') && this.isFreeTextAnnotation(this.pdfViewer.selectedItems.annotations);
|
|
20404
|
+
if (!this.singleTapTimer) {
|
|
20405
|
+
this.singleTapTimer = setTimeout(() => {
|
|
20406
|
+
if (isRemoveFocus) {
|
|
20407
|
+
this.pdfViewer.clearSelection(this.pdfViewer.selectedItems.annotations[0].pageIndex);
|
|
20408
|
+
this.focusViewerContainer();
|
|
20409
|
+
}
|
|
20410
|
+
this.onSingleTap(touchPoints);
|
|
20411
|
+
// eslint-disable-next-line
|
|
20412
|
+
}, 300);
|
|
20413
|
+
this.tapCount++;
|
|
20414
|
+
}
|
|
20415
|
+
else {
|
|
20416
|
+
if (this.pdfViewer.enablePinchZoom) {
|
|
20417
|
+
this.tapCount++;
|
|
20418
|
+
clearTimeout(this.singleTapTimer);
|
|
20419
|
+
this.singleTapTimer = null;
|
|
20420
|
+
this.onDoubleTap(touchPoints);
|
|
20421
|
+
}
|
|
20422
|
+
}
|
|
20298
20423
|
}
|
|
20299
20424
|
else {
|
|
20300
|
-
if (this.
|
|
20425
|
+
if (!this.singleTapTimer) {
|
|
20426
|
+
this.singleTapTimer = setTimeout(() => {
|
|
20427
|
+
this.onSingleTap(touchPoints);
|
|
20428
|
+
// eslint-disable-next-line
|
|
20429
|
+
}, 300);
|
|
20301
20430
|
this.tapCount++;
|
|
20302
|
-
|
|
20303
|
-
|
|
20304
|
-
this.
|
|
20431
|
+
}
|
|
20432
|
+
else {
|
|
20433
|
+
if (this.pdfViewer.enablePinchZoom) {
|
|
20434
|
+
this.tapCount++;
|
|
20435
|
+
clearTimeout(this.singleTapTimer);
|
|
20436
|
+
this.singleTapTimer = null;
|
|
20437
|
+
this.onDoubleTap(touchPoints);
|
|
20438
|
+
}
|
|
20305
20439
|
}
|
|
20306
20440
|
}
|
|
20307
20441
|
}
|
|
20308
20442
|
handleTextBoxTaps(touchPoints) {
|
|
20309
|
-
setTimeout(() => {
|
|
20443
|
+
setTimeout(() => {
|
|
20444
|
+
this.inputTapCount = 0;
|
|
20445
|
+
}, 300);
|
|
20310
20446
|
this.inputTapCount++;
|
|
20311
|
-
|
|
20312
|
-
|
|
20447
|
+
if (this.isDeviceiOS) {
|
|
20448
|
+
// eslint-disable-next-line
|
|
20449
|
+
this.onTextBoxDoubleTap(touchPoints);
|
|
20450
|
+
}
|
|
20451
|
+
else {
|
|
20452
|
+
let timer = setTimeout(() => {
|
|
20453
|
+
this.onTextBoxDoubleTap(touchPoints);
|
|
20454
|
+
}, 200);
|
|
20455
|
+
}
|
|
20313
20456
|
if (this.inputTapCount > 2) {
|
|
20314
20457
|
this.inputTapCount = 0;
|
|
20315
20458
|
}
|
|
@@ -20408,7 +20551,7 @@ class PdfViewerBase {
|
|
|
20408
20551
|
if (this.pdfViewer.textSelectionModule) {
|
|
20409
20552
|
// tslint:disable-next-line:max-line-length
|
|
20410
20553
|
if (!this.isPanMode && this.pdfViewer.enableTextSelection && !this.isTextSelectionDisabled && this.getSelectTextMarkupCurrentPage() == null) {
|
|
20411
|
-
if (!(this.isWebkitMobile && Browser.isDevice)) {
|
|
20554
|
+
if (!(this.isWebkitMobile && (Browser.isDevice || (typeof navigator !== 'undefined' && navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1 && Browser.isTouch === true)))) {
|
|
20412
20555
|
event.preventDefault();
|
|
20413
20556
|
event.stopPropagation();
|
|
20414
20557
|
}
|
|
@@ -21060,7 +21203,7 @@ class PdfViewerBase {
|
|
|
21060
21203
|
let proxy = this;
|
|
21061
21204
|
jsonObject = { action: 'RenderTaggedContent', elementId: this.pdfViewer.element.id, hashId: this.hashId, uniqueId: this.documentId, pageIndex: pageIndex };
|
|
21062
21205
|
if (this.jsonDocumentId) {
|
|
21063
|
-
jsonObject.
|
|
21206
|
+
jsonObject.documentId = this.jsonDocumentId;
|
|
21064
21207
|
}
|
|
21065
21208
|
var url = this.pdfViewer.serviceUrl + '/' + "RenderTaggedContent";
|
|
21066
21209
|
this.taggedTextHandler = new AjaxHandler(this.pdfViewer);
|
|
@@ -25332,9 +25475,11 @@ class AjaxHandler {
|
|
|
25332
25475
|
* @private
|
|
25333
25476
|
*/
|
|
25334
25477
|
this.contentType = 'application/json;charset=UTF-8';
|
|
25478
|
+
this.retryTimeout = 0;
|
|
25335
25479
|
this.pdfViewer = pdfviewer;
|
|
25336
25480
|
this.retryCount = pdfviewer.retryCount;
|
|
25337
25481
|
this.retryStatusCodes = pdfviewer.retryStatusCodes;
|
|
25482
|
+
this.retryTimeout = 1000 * pdfviewer.retryTimeout;
|
|
25338
25483
|
}
|
|
25339
25484
|
/**
|
|
25340
25485
|
* Send the request to server
|
|
@@ -25343,6 +25488,7 @@ class AjaxHandler {
|
|
|
25343
25488
|
*/
|
|
25344
25489
|
send(jsonObj) {
|
|
25345
25490
|
this.httpRequest = new XMLHttpRequest();
|
|
25491
|
+
this.httpRequest.timeout = this.retryTimeout;
|
|
25346
25492
|
if (!this.mode) {
|
|
25347
25493
|
setTimeout(() => { this.sendRequest(jsonObj); });
|
|
25348
25494
|
}
|
|
@@ -25358,7 +25504,22 @@ class AjaxHandler {
|
|
|
25358
25504
|
this.retryCount = 0;
|
|
25359
25505
|
}
|
|
25360
25506
|
if (this.retryCount > 0) {
|
|
25361
|
-
isSkip = this.resendRequest(this, jsonObj);
|
|
25507
|
+
isSkip = this.resendRequest(this, jsonObj, false);
|
|
25508
|
+
}
|
|
25509
|
+
if (!isSkip) {
|
|
25510
|
+
this.stateChange(this);
|
|
25511
|
+
}
|
|
25512
|
+
};
|
|
25513
|
+
this.httpRequest.ontimeout = () => {
|
|
25514
|
+
let isSkip = false;
|
|
25515
|
+
// tslint:disable-next-line
|
|
25516
|
+
let viewerBase = this.pdfViewer.viewerBase;
|
|
25517
|
+
if (viewerBase && viewerBase.isPasswordAvailable && viewerBase.passwordData === '') {
|
|
25518
|
+
isSkip = true;
|
|
25519
|
+
this.retryCount = 0;
|
|
25520
|
+
}
|
|
25521
|
+
if (this.retryCount > 0) {
|
|
25522
|
+
isSkip = this.resendRequest(this, jsonObj, true);
|
|
25362
25523
|
}
|
|
25363
25524
|
if (!isSkip) {
|
|
25364
25525
|
this.stateChange(this);
|
|
@@ -25367,7 +25528,7 @@ class AjaxHandler {
|
|
|
25367
25528
|
this.httpRequest.onerror = () => { this.error(this); };
|
|
25368
25529
|
}
|
|
25369
25530
|
// tslint:disable-next-line
|
|
25370
|
-
resendRequest(proxy, jsonObj) {
|
|
25531
|
+
resendRequest(proxy, jsonObj, isTimeout) {
|
|
25371
25532
|
let isSkip = false;
|
|
25372
25533
|
let status = proxy.httpRequest.status;
|
|
25373
25534
|
let statusString = this.retryStatusCodes.indexOf(status) !== -1;
|
|
@@ -25394,7 +25555,7 @@ class AjaxHandler {
|
|
|
25394
25555
|
}
|
|
25395
25556
|
}
|
|
25396
25557
|
}
|
|
25397
|
-
if (statusString || isSkip) {
|
|
25558
|
+
if (statusString || isSkip || isTimeout) {
|
|
25398
25559
|
isSkip = true;
|
|
25399
25560
|
this.retryCount--;
|
|
25400
25561
|
proxy.send(jsonObj);
|
|
@@ -26043,7 +26204,7 @@ class Magnification {
|
|
|
26043
26204
|
this.scrollWidth = 25;
|
|
26044
26205
|
this.zoomPercentages = [10, 25, 50, 75, 100, 125, 150, 200, 400];
|
|
26045
26206
|
this.isNotPredefinedZoom = false;
|
|
26046
|
-
this.pinchStep = 0
|
|
26207
|
+
this.pinchStep = 0;
|
|
26047
26208
|
this.reRenderPageNumber = 0;
|
|
26048
26209
|
// tslint:disable-next-line
|
|
26049
26210
|
this.magnifyPageRerenderTimer = null;
|
|
@@ -26053,6 +26214,8 @@ class Magnification {
|
|
|
26053
26214
|
this.rerenderInterval = null;
|
|
26054
26215
|
this.touchCenterX = 0;
|
|
26055
26216
|
this.touchCenterY = 0;
|
|
26217
|
+
this.mouseCenterX = 0;
|
|
26218
|
+
this.mouseCenterY = 0;
|
|
26056
26219
|
this.pageRerenderCount = 0;
|
|
26057
26220
|
this.imageObjects = [];
|
|
26058
26221
|
this.topValue = 0;
|
|
@@ -26089,6 +26252,10 @@ class Magnification {
|
|
|
26089
26252
|
* @private
|
|
26090
26253
|
*/
|
|
26091
26254
|
this.isAutoZoom = false;
|
|
26255
|
+
/**
|
|
26256
|
+
* @private
|
|
26257
|
+
*/
|
|
26258
|
+
this.isDoubleTapZoom = false;
|
|
26092
26259
|
this.isWebkitMobile = false;
|
|
26093
26260
|
this.pdfViewer = pdfViewer;
|
|
26094
26261
|
this.pdfViewerBase = viewerBase;
|
|
@@ -26102,11 +26269,13 @@ class Magnification {
|
|
|
26102
26269
|
* @returns void
|
|
26103
26270
|
*/
|
|
26104
26271
|
zoomTo(zoomValue) {
|
|
26105
|
-
|
|
26106
|
-
|
|
26272
|
+
let MaximumZoomPercentage = 400;
|
|
26273
|
+
let MinmumZoomPercentage = 10;
|
|
26274
|
+
if (zoomValue < MinmumZoomPercentage) {
|
|
26275
|
+
zoomValue = MinmumZoomPercentage;
|
|
26107
26276
|
}
|
|
26108
|
-
else if (zoomValue >
|
|
26109
|
-
zoomValue =
|
|
26277
|
+
else if (zoomValue > MaximumZoomPercentage) {
|
|
26278
|
+
zoomValue = MaximumZoomPercentage;
|
|
26110
26279
|
}
|
|
26111
26280
|
this.fitType = null;
|
|
26112
26281
|
this.isNotPredefinedZoom = false;
|
|
@@ -26246,6 +26415,16 @@ class Magnification {
|
|
|
26246
26415
|
return parseInt(((viewerHeight / highestHeight) * 100).toString());
|
|
26247
26416
|
}
|
|
26248
26417
|
}
|
|
26418
|
+
/**
|
|
26419
|
+
* Initiating cursor based zoom.
|
|
26420
|
+
* @private
|
|
26421
|
+
*/
|
|
26422
|
+
initiateMouseZoom(pointX, pointY, zoomValue) {
|
|
26423
|
+
let pointInViewer = this.positionInViewer(pointX, pointY);
|
|
26424
|
+
this.mouseCenterX = pointInViewer.x;
|
|
26425
|
+
this.mouseCenterY = pointInViewer.y;
|
|
26426
|
+
this.zoomTo(zoomValue);
|
|
26427
|
+
}
|
|
26249
26428
|
/**
|
|
26250
26429
|
* Performs pinch in operation
|
|
26251
26430
|
*/
|
|
@@ -26255,8 +26434,11 @@ class Magnification {
|
|
|
26255
26434
|
if (temporaryZoomFactor < 4 && temporaryZoomFactor > 2) {
|
|
26256
26435
|
temporaryZoomFactor = this.zoomFactor - this.pinchStep;
|
|
26257
26436
|
}
|
|
26258
|
-
if (temporaryZoomFactor
|
|
26259
|
-
temporaryZoomFactor =
|
|
26437
|
+
if (temporaryZoomFactor <= 1.5) {
|
|
26438
|
+
temporaryZoomFactor = this.zoomFactor - (this.pinchStep / 1.5);
|
|
26439
|
+
}
|
|
26440
|
+
if (temporaryZoomFactor < 0.25) {
|
|
26441
|
+
temporaryZoomFactor = 0.25;
|
|
26260
26442
|
}
|
|
26261
26443
|
this.isPinchZoomed = true;
|
|
26262
26444
|
this.onZoomChanged(temporaryZoomFactor * 100);
|
|
@@ -26276,8 +26458,8 @@ class Magnification {
|
|
|
26276
26458
|
this.fitType = null;
|
|
26277
26459
|
let temporaryZoomFactor = this.zoomFactor + this.pinchStep;
|
|
26278
26460
|
if (Browser.isDevice) {
|
|
26279
|
-
if (temporaryZoomFactor >
|
|
26280
|
-
temporaryZoomFactor =
|
|
26461
|
+
if (temporaryZoomFactor > 4) {
|
|
26462
|
+
temporaryZoomFactor = 4;
|
|
26281
26463
|
}
|
|
26282
26464
|
}
|
|
26283
26465
|
else {
|
|
@@ -26375,8 +26557,9 @@ class Magnification {
|
|
|
26375
26557
|
* @private
|
|
26376
26558
|
*/
|
|
26377
26559
|
setTouchPoints(clientX, clientY) {
|
|
26378
|
-
|
|
26379
|
-
this.
|
|
26560
|
+
let pointInViewer = this.positionInViewer(clientX, clientY);
|
|
26561
|
+
this.touchCenterX = pointInViewer.x;
|
|
26562
|
+
this.touchCenterY = pointInViewer.y;
|
|
26380
26563
|
}
|
|
26381
26564
|
/**
|
|
26382
26565
|
* @private
|
|
@@ -26385,8 +26568,9 @@ class Magnification {
|
|
|
26385
26568
|
this.isPinchScrolled = false;
|
|
26386
26569
|
this.isMagnified = false;
|
|
26387
26570
|
this.reRenderPageNumber = this.pdfViewerBase.currentPageNumber;
|
|
26388
|
-
|
|
26389
|
-
this.
|
|
26571
|
+
let pointInViewer = this.positionInViewer((pointX1 + pointX2) / 2, (pointY1 + pointY2) / 2);
|
|
26572
|
+
this.touchCenterX = pointInViewer.x;
|
|
26573
|
+
this.touchCenterY = pointInViewer.y;
|
|
26390
26574
|
this.zoomOverPages(pointX1, pointY1, pointX2, pointY2);
|
|
26391
26575
|
}
|
|
26392
26576
|
magnifyPages() {
|
|
@@ -26397,7 +26581,7 @@ class Magnification {
|
|
|
26397
26581
|
if (!this.pdfViewerBase.documentLoaded) {
|
|
26398
26582
|
this.isPagesZoomed = true;
|
|
26399
26583
|
}
|
|
26400
|
-
|
|
26584
|
+
const scrollValue = this.pdfViewerBase.viewerContainer.scrollTop;
|
|
26401
26585
|
if (this.pdfViewer.textSelectionModule) {
|
|
26402
26586
|
this.pdfViewer.textSelectionModule.maintainSelectionOnZoom(false, true);
|
|
26403
26587
|
}
|
|
@@ -26406,6 +26590,7 @@ class Magnification {
|
|
|
26406
26590
|
}
|
|
26407
26591
|
this.updatePageLocation();
|
|
26408
26592
|
this.resizeCanvas(this.reRenderPageNumber);
|
|
26593
|
+
this.calculateScrollValuesOnMouse(scrollValue);
|
|
26409
26594
|
if (this.pdfViewer.textSelectionModule) {
|
|
26410
26595
|
this.pdfViewer.textSelectionModule.resizeTouchElements();
|
|
26411
26596
|
}
|
|
@@ -26421,7 +26606,6 @@ class Magnification {
|
|
|
26421
26606
|
let proxy = this;
|
|
26422
26607
|
this.pdfViewerBase.renderedPagesList = [];
|
|
26423
26608
|
this.pdfViewerBase.pinchZoomStorage = [];
|
|
26424
|
-
this.pdfViewerBase.viewerContainer.scrollTop = scrollValue;
|
|
26425
26609
|
if (!this.pdfViewerBase.documentLoaded) {
|
|
26426
26610
|
this.magnifyPageRerenderTimer = setTimeout(() => { proxy.rerenderMagnifiedPages(); }, 800);
|
|
26427
26611
|
}
|
|
@@ -26530,19 +26714,63 @@ class Magnification {
|
|
|
26530
26714
|
let pageIndex = this.pdfViewerBase.currentPageNumber - 1;
|
|
26531
26715
|
let currentPageCanvas = this.pdfViewerBase.getElement('_pageDiv_' + pageIndex);
|
|
26532
26716
|
if (currentPageCanvas) {
|
|
26533
|
-
let
|
|
26717
|
+
let pointInViewer;
|
|
26718
|
+
const currentPageBounds = currentPageCanvas.getBoundingClientRect();
|
|
26719
|
+
if (this.pdfViewer.enableRtl && !this.isDoubleTapZoom) {
|
|
26720
|
+
pointInViewer = this.positionInViewer(currentPageBounds.right, currentPageBounds.top);
|
|
26721
|
+
}
|
|
26722
|
+
else {
|
|
26723
|
+
pointInViewer = this.positionInViewer(currentPageBounds.left, currentPageBounds.top);
|
|
26724
|
+
}
|
|
26725
|
+
let currentPageBoundsLeft = pointInViewer.x;
|
|
26726
|
+
let currentPageBoundsTop = pointInViewer.y;
|
|
26534
26727
|
// update scroll top for the viewer container based on pinch zoom factor
|
|
26535
|
-
|
|
26536
|
-
|
|
26537
|
-
//
|
|
26538
|
-
|
|
26539
|
-
//
|
|
26728
|
+
const previousPageTop = (currentPageBoundsTop) * this.previousZoomFactor;
|
|
26729
|
+
const canvasPreviousY = scrollValue + this.touchCenterY;
|
|
26730
|
+
// eslint-disable-next-line max-len
|
|
26731
|
+
const canvasCurrentY = (currentPageBoundsTop) * this.zoomFactor + ((canvasPreviousY - previousPageTop) < 0 ? canvasPreviousY - previousPageTop : (canvasPreviousY -
|
|
26732
|
+
// eslint-disable-next-line max-len
|
|
26540
26733
|
previousPageTop) * (this.zoomFactor / this.previousZoomFactor));
|
|
26541
|
-
this.pdfViewerBase.
|
|
26734
|
+
let pageGapValue = this.zoomFactor - this.previousZoomFactor > 0 ? -this.pdfViewerBase.pageGap * (this.zoomFactor / this.previousZoomFactor) : this.pdfViewerBase.pageGap * (this.previousZoomFactor / this.zoomFactor);
|
|
26735
|
+
this.pdfViewerBase.viewerContainer.scrollTop = canvasCurrentY - this.touchCenterY + pageGapValue / this.pdfViewerBase.zoomInterval;
|
|
26542
26736
|
// update scroll left for the viewer container based on pinch zoom factor
|
|
26543
|
-
|
|
26544
|
-
|
|
26545
|
-
|
|
26737
|
+
const previousWidthFactor = (currentPageBounds.width * this.previousZoomFactor) / currentPageBounds.width;
|
|
26738
|
+
const scaleCorrectionFactor = this.zoomFactor / previousWidthFactor - 1;
|
|
26739
|
+
const scrollX = this.touchCenterX - currentPageBoundsLeft;
|
|
26740
|
+
this.pdfViewerBase.viewerContainer.scrollLeft += scrollX * scaleCorrectionFactor;
|
|
26741
|
+
}
|
|
26742
|
+
}
|
|
26743
|
+
calculateScrollValuesOnMouse(scrollValue) {
|
|
26744
|
+
const pageIndex = this.pdfViewerBase.currentPageNumber - 1;
|
|
26745
|
+
const currentPageCanvas = this.pdfViewerBase.getElement('_pageDiv_' + pageIndex);
|
|
26746
|
+
if (currentPageCanvas) {
|
|
26747
|
+
let pointInViewer;
|
|
26748
|
+
const currentPageBounds = currentPageCanvas.getBoundingClientRect();
|
|
26749
|
+
if (this.pdfViewer.enableRtl) {
|
|
26750
|
+
pointInViewer = this.positionInViewer(currentPageBounds.right, currentPageBounds.top);
|
|
26751
|
+
}
|
|
26752
|
+
else {
|
|
26753
|
+
pointInViewer = this.positionInViewer(currentPageBounds.left, currentPageBounds.top);
|
|
26754
|
+
}
|
|
26755
|
+
let currentPageBoundsLeft = pointInViewer.x;
|
|
26756
|
+
let currentPageBoundsTop = pointInViewer.y;
|
|
26757
|
+
// update scroll top for the viewer container based on mouse zoom factor
|
|
26758
|
+
const previousPageTop = (currentPageBoundsTop) * this.previousZoomFactor;
|
|
26759
|
+
const canvasPreviousY = scrollValue + this.mouseCenterY;
|
|
26760
|
+
// eslint-disable-next-line max-len
|
|
26761
|
+
const canvasCurrentY = (currentPageBoundsTop) * this.zoomFactor + ((canvasPreviousY - previousPageTop) < 0 ? canvasPreviousY - previousPageTop : (canvasPreviousY -
|
|
26762
|
+
// eslint-disable-next-line max-len
|
|
26763
|
+
previousPageTop) * (this.zoomFactor / this.previousZoomFactor));
|
|
26764
|
+
// eslint-disable-next-line max-len
|
|
26765
|
+
let pageGapValue = this.zoomFactor - this.previousZoomFactor > 0 ? -this.pdfViewerBase.pageGap * (this.zoomFactor / this.previousZoomFactor) : this.pdfViewerBase.pageGap * (this.previousZoomFactor / this.zoomFactor);
|
|
26766
|
+
if (this.pdfViewerBase.isTouchPad && !this.pdfViewerBase.isMacSafari) {
|
|
26767
|
+
pageGapValue = pageGapValue / this.pdfViewerBase.zoomInterval;
|
|
26768
|
+
}
|
|
26769
|
+
this.pdfViewerBase.viewerContainer.scrollTop = canvasCurrentY - this.mouseCenterY + pageGapValue;
|
|
26770
|
+
// update scroll left for the viewer container based on mouse zoom factor
|
|
26771
|
+
const previousWidthFactor = (currentPageBounds.width * this.previousZoomFactor) / currentPageBounds.width;
|
|
26772
|
+
const scaleCorrectionFactor = this.zoomFactor / previousWidthFactor - 1;
|
|
26773
|
+
const scrollX = this.mouseCenterX - currentPageBoundsLeft;
|
|
26546
26774
|
this.pdfViewerBase.viewerContainer.scrollLeft += scrollX * scaleCorrectionFactor;
|
|
26547
26775
|
}
|
|
26548
26776
|
}
|
|
@@ -26905,9 +27133,11 @@ class Magnification {
|
|
|
26905
27133
|
let currentDifference = Math.sqrt(Math.pow((pointX1 - pointX2), 2) + Math.pow((pointY1 - pointY2), 2));
|
|
26906
27134
|
if (this.previousTouchDifference > -1) {
|
|
26907
27135
|
if (currentDifference > this.previousTouchDifference) {
|
|
27136
|
+
this.pinchStep = this.getPinchStep(currentDifference, this.previousTouchDifference);
|
|
26908
27137
|
this.pinchOut();
|
|
26909
27138
|
}
|
|
26910
27139
|
else if (currentDifference < this.previousTouchDifference) {
|
|
27140
|
+
this.pinchStep = this.getPinchStep(this.previousTouchDifference, currentDifference);
|
|
26911
27141
|
this.pinchIn();
|
|
26912
27142
|
}
|
|
26913
27143
|
}
|
|
@@ -27020,19 +27250,24 @@ class Magnification {
|
|
|
27020
27250
|
this.pdfViewer.toolbarModule.showToolbar(false);
|
|
27021
27251
|
}
|
|
27022
27252
|
let scrollValue = this.pdfViewerBase.viewerContainer.scrollTop;
|
|
27023
|
-
if (!this.
|
|
27024
|
-
|
|
27025
|
-
|
|
27253
|
+
if (!this.pdfViewer.selectedItems.annotations[0]) {
|
|
27254
|
+
this.isDoubleTapZoom = true;
|
|
27255
|
+
if (!this.isTapToFitZoom) {
|
|
27256
|
+
if (this.zoomFactor < 2) {
|
|
27257
|
+
this.zoomTo(200);
|
|
27258
|
+
}
|
|
27259
|
+
else {
|
|
27260
|
+
this.fitToWidth();
|
|
27261
|
+
}
|
|
27026
27262
|
}
|
|
27027
27263
|
else {
|
|
27028
27264
|
this.fitToWidth();
|
|
27029
27265
|
}
|
|
27266
|
+
this.calculateScrollValues(scrollValue);
|
|
27267
|
+
this.isTapToFitZoom = !this.isTapToFitZoom;
|
|
27268
|
+
setTimeout(() => { this.isMagnified = false; }, 500);
|
|
27269
|
+
this.isDoubleTapZoom = false;
|
|
27030
27270
|
}
|
|
27031
|
-
else {
|
|
27032
|
-
this.fitToWidth();
|
|
27033
|
-
}
|
|
27034
|
-
this.calculateScrollValues(scrollValue);
|
|
27035
|
-
this.isTapToFitZoom = !this.isTapToFitZoom;
|
|
27036
27271
|
}
|
|
27037
27272
|
downwardScrollFitPage(currentPageIndex) {
|
|
27038
27273
|
if (currentPageIndex !== (this.pdfViewerBase.pageCount - 1)) {
|
|
@@ -27067,6 +27302,32 @@ class Magnification {
|
|
|
27067
27302
|
getModuleName() {
|
|
27068
27303
|
return 'Magnification';
|
|
27069
27304
|
}
|
|
27305
|
+
/**
|
|
27306
|
+
* Returns the pinch step value.
|
|
27307
|
+
* @param higherValue
|
|
27308
|
+
* @param lowerValue
|
|
27309
|
+
*/
|
|
27310
|
+
getPinchStep(higherValue, lowerValue) {
|
|
27311
|
+
let defaultPinchStep = 0.02; // Default pinch step value.
|
|
27312
|
+
let higherPinchStep = 1; // higher pinch step value.
|
|
27313
|
+
let pinchstep = (higherValue - lowerValue) / 100;
|
|
27314
|
+
if (pinchstep < defaultPinchStep) {
|
|
27315
|
+
pinchstep = defaultPinchStep;
|
|
27316
|
+
}
|
|
27317
|
+
else if (pinchstep > higherPinchStep) {
|
|
27318
|
+
pinchstep = 0.1; // set the pinch step as 0.1 if the pinch reaches the higher pinch step value.
|
|
27319
|
+
}
|
|
27320
|
+
return pinchstep;
|
|
27321
|
+
}
|
|
27322
|
+
/**
|
|
27323
|
+
* Returns Point value respect to Main container.
|
|
27324
|
+
* @param pointX
|
|
27325
|
+
* @param pointY
|
|
27326
|
+
*/
|
|
27327
|
+
positionInViewer(pointX, pointY) {
|
|
27328
|
+
let mainRect = this.pdfViewerBase.mainContainer.getBoundingClientRect();
|
|
27329
|
+
return { x: pointX - mainRect.left, y: pointY - mainRect.top };
|
|
27330
|
+
}
|
|
27070
27331
|
}
|
|
27071
27332
|
|
|
27072
27333
|
/**
|
|
@@ -27812,7 +28073,9 @@ class Toolbar$1 {
|
|
|
27812
28073
|
showToolbar(enableToolbar) {
|
|
27813
28074
|
let toolbar = this.toolbarElement;
|
|
27814
28075
|
if (enableToolbar) {
|
|
27815
|
-
toolbar
|
|
28076
|
+
if (toolbar) {
|
|
28077
|
+
toolbar.style.display = 'block';
|
|
28078
|
+
}
|
|
27816
28079
|
if (Browser.isDevice && this.pdfViewer.toolbarModule && this.pdfViewer.toolbarModule.annotationToolbarModule) {
|
|
27817
28080
|
this.pdfViewer.toolbarModule.annotationToolbarModule.hideMobileAnnotationToolbar();
|
|
27818
28081
|
}
|
|
@@ -36534,15 +36797,18 @@ __decorate$2([
|
|
|
36534
36797
|
__decorate$2([
|
|
36535
36798
|
Property(true)
|
|
36536
36799
|
], PdfViewer.prototype, "enableZoomOptimization", void 0);
|
|
36800
|
+
__decorate$2([
|
|
36801
|
+
Property([500])
|
|
36802
|
+
], PdfViewer.prototype, "retryStatusCodes", void 0);
|
|
36803
|
+
__decorate$2([
|
|
36804
|
+
Property(0)
|
|
36805
|
+
], PdfViewer.prototype, "retryTimeout", void 0);
|
|
36537
36806
|
__decorate$2([
|
|
36538
36807
|
Property(false)
|
|
36539
36808
|
], PdfViewer.prototype, "isExtractText", void 0);
|
|
36540
36809
|
__decorate$2([
|
|
36541
36810
|
Property(true)
|
|
36542
36811
|
], PdfViewer.prototype, "enableTaggedPDF", void 0);
|
|
36543
|
-
__decorate$2([
|
|
36544
|
-
Property([500])
|
|
36545
|
-
], PdfViewer.prototype, "retryStatusCodes", void 0);
|
|
36546
36812
|
__decorate$2([
|
|
36547
36813
|
Property({ showTooltip: true, toolbarItems: ['OpenOption', 'UndoRedoTool', 'PageNavigationTool', 'MagnificationTool', 'PanTool', 'SelectionTool', 'CommentTool', 'AnnotationEditTool', 'FreeTextAnnotationOption', 'InkAnnotationOption', 'ShapeAnnotationOption', 'StampAnnotation', 'SignatureOption', 'SearchOption', 'PrintOption', 'DownloadOption'] })
|
|
36548
36814
|
], PdfViewer.prototype, "toolbarSettings", void 0);
|