@progress/kendo-pdfviewer-common 0.5.0-develop.1 → 0.5.0-develop.2
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/es/annotations/annotation-editor-layer-builder.js +6 -1
- package/dist/es/annotations/annotation-layer-builder.js +12 -2
- package/dist/es/annotations/annotation-layer.js +6 -0
- package/dist/es/annotations/draw-layer-builder.js +5 -1
- package/dist/es/annotations/helpers/text-accessibility-manager.js +5 -0
- package/dist/es/text/text-layer-builder.js +13 -1
- package/dist/es/utils.js +1 -0
- package/dist/es/widget/page.js +21 -0
- package/dist/es/widget/pdfviewer.js +4 -7
- package/dist/es2015/annotations/annotation-editor-layer-builder.js +6 -1
- package/dist/es2015/annotations/annotation-layer-builder.js +12 -2
- package/dist/es2015/annotations/annotation-layer.js +6 -0
- package/dist/es2015/annotations/draw-layer-builder.js +5 -1
- package/dist/es2015/annotations/helpers/text-accessibility-manager.js +5 -0
- package/dist/es2015/text/text-layer-builder.js +13 -1
- package/dist/es2015/utils.js +1 -0
- package/dist/es2015/widget/page.js +21 -0
- package/dist/es2015/widget/pdfviewer.js +4 -7
- package/dist/npm/annotations/annotation-editor-layer-builder.d.ts +3 -1
- package/dist/npm/annotations/annotation-editor-layer-builder.js +6 -1
- package/dist/npm/annotations/annotation-layer-builder.d.ts +3 -1
- package/dist/npm/annotations/annotation-layer-builder.js +12 -2
- package/dist/npm/annotations/annotation-layer.d.ts +3 -1
- package/dist/npm/annotations/annotation-layer.js +6 -0
- package/dist/npm/annotations/draw-layer-builder.d.ts +3 -1
- package/dist/npm/annotations/draw-layer-builder.js +5 -1
- package/dist/npm/annotations/helpers/text-accessibility-manager.d.ts +1 -0
- package/dist/npm/annotations/helpers/text-accessibility-manager.js +5 -0
- package/dist/npm/text/text-layer-builder.d.ts +3 -1
- package/dist/npm/text/text-layer-builder.js +13 -1
- package/dist/npm/utils.d.ts +1 -0
- package/dist/npm/utils.js +3 -1
- package/dist/npm/widget/page.js +21 -0
- package/dist/npm/widget/pdfviewer.js +3 -6
- package/package.json +1 -1
|
@@ -112,11 +112,12 @@ class AnnotationEditorLayerBuilder {
|
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
114
|
cancel() {
|
|
115
|
+
var _a;
|
|
115
116
|
this._cancelled = true;
|
|
116
117
|
if (!this.div) {
|
|
117
118
|
return;
|
|
118
119
|
}
|
|
119
|
-
this.annotationEditorLayer.destroy();
|
|
120
|
+
(_a = this.annotationEditorLayer) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
120
121
|
}
|
|
121
122
|
hide() {
|
|
122
123
|
if (!this.div) {
|
|
@@ -130,6 +131,10 @@ class AnnotationEditorLayerBuilder {
|
|
|
130
131
|
}
|
|
131
132
|
this.div.hidden = false;
|
|
132
133
|
}
|
|
134
|
+
destroy() {
|
|
135
|
+
var _a;
|
|
136
|
+
(_a = this.annotationEditorLayer) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
137
|
+
}
|
|
133
138
|
}
|
|
134
139
|
_AnnotationEditorLayerBuilder_annotationLayer = new WeakMap(), _AnnotationEditorLayerBuilder_drawLayer = new WeakMap(), _AnnotationEditorLayerBuilder_onAppend = new WeakMap(), _AnnotationEditorLayerBuilder_textLayer = new WeakMap(), _AnnotationEditorLayerBuilder_uiManager = new WeakMap();
|
|
135
140
|
export { AnnotationEditorLayerBuilder };
|
|
@@ -143,8 +143,8 @@ class AnnotationLayerBuilder {
|
|
|
143
143
|
(_b = __classPrivateFieldGet(this, _AnnotationLayerBuilder_onAppend, "f")) === null || _b === void 0 ? void 0 : _b.call(this, div);
|
|
144
144
|
this.annotationLayer = new AnnotationLayer({
|
|
145
145
|
div,
|
|
146
|
-
|
|
147
|
-
accessibilityManager: null,
|
|
146
|
+
accessibilityManager: this._accessibilityManager,
|
|
147
|
+
// accessibilityManager: null,
|
|
148
148
|
annotationCanvasMap: this._annotationCanvasMap,
|
|
149
149
|
annotationEditorUIManager: this._annotationEditorUIManager,
|
|
150
150
|
page: this.pdfPage,
|
|
@@ -190,6 +190,16 @@ class AnnotationLayerBuilder {
|
|
|
190
190
|
var _a;
|
|
191
191
|
return !!((_a = this.annotationLayer) === null || _a === void 0 ? void 0 : _a.hasEditableAnnotations());
|
|
192
192
|
}
|
|
193
|
+
destroy() {
|
|
194
|
+
var _a, _b, _c;
|
|
195
|
+
this.cancel();
|
|
196
|
+
(_a = this.annotationLayer) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
197
|
+
this.annotationLayer = null;
|
|
198
|
+
(_b = __classPrivateFieldGet(this, _AnnotationLayerBuilder_eventAbortController, "f")) === null || _b === void 0 ? void 0 : _b.abort();
|
|
199
|
+
__classPrivateFieldSet(this, _AnnotationLayerBuilder_eventAbortController, null, "f");
|
|
200
|
+
(_c = this.div) === null || _c === void 0 ? void 0 : _c.remove();
|
|
201
|
+
this.div = null;
|
|
202
|
+
}
|
|
193
203
|
}
|
|
194
204
|
_AnnotationLayerBuilder_onAppend = new WeakMap(), _AnnotationLayerBuilder_eventAbortController = new WeakMap(), _AnnotationLayerBuilder_instances = new WeakSet(), _AnnotationLayerBuilder_updatePresentationModeState = function _AnnotationLayerBuilder_updatePresentationModeState(state) {
|
|
195
205
|
if (!this.div) {
|
|
@@ -2766,6 +2766,12 @@ class AnnotationLayer {
|
|
|
2766
2766
|
getEditableAnnotation(id) {
|
|
2767
2767
|
return __classPrivateFieldGet(this, _AnnotationLayer_editableAnnotations, "f").get(id);
|
|
2768
2768
|
}
|
|
2769
|
+
destroy() {
|
|
2770
|
+
var _a, _b;
|
|
2771
|
+
(_a = __classPrivateFieldGet(this, _AnnotationLayer_annotationCanvasMap, "f")) === null || _a === void 0 ? void 0 : _a.clear();
|
|
2772
|
+
(_b = this.div) === null || _b === void 0 ? void 0 : _b.remove();
|
|
2773
|
+
this.div = null;
|
|
2774
|
+
}
|
|
2769
2775
|
}
|
|
2770
2776
|
_AnnotationLayer_accessibilityManager = new WeakMap(), _AnnotationLayer_annotationCanvasMap = new WeakMap(), _AnnotationLayer_editableAnnotations = new WeakMap(), _AnnotationLayer_instances = new WeakSet(), _AnnotationLayer_appendElement = function _AnnotationLayer_appendElement(element, id) {
|
|
2771
2777
|
var _a;
|
|
@@ -47,10 +47,11 @@ class DrawLayerBuilder {
|
|
|
47
47
|
}
|
|
48
48
|
cancel() {
|
|
49
49
|
// this._cancelled = true;
|
|
50
|
+
var _a;
|
|
50
51
|
if (!__classPrivateFieldGet(this, _DrawLayerBuilder_drawLayer, "f")) {
|
|
51
52
|
return;
|
|
52
53
|
}
|
|
53
|
-
__classPrivateFieldGet(this, _DrawLayerBuilder_drawLayer, "f").destroy();
|
|
54
|
+
(_a = __classPrivateFieldGet(this, _DrawLayerBuilder_drawLayer, "f")) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
54
55
|
__classPrivateFieldSet(this, _DrawLayerBuilder_drawLayer, null, "f");
|
|
55
56
|
}
|
|
56
57
|
setParent(parent) {
|
|
@@ -60,6 +61,9 @@ class DrawLayerBuilder {
|
|
|
60
61
|
getDrawLayer() {
|
|
61
62
|
return __classPrivateFieldGet(this, _DrawLayerBuilder_drawLayer, "f");
|
|
62
63
|
}
|
|
64
|
+
destroy() {
|
|
65
|
+
this.cancel();
|
|
66
|
+
}
|
|
63
67
|
}
|
|
64
68
|
_DrawLayerBuilder_drawLayer = new WeakMap();
|
|
65
69
|
export { DrawLayerBuilder };
|
|
@@ -178,6 +178,11 @@ class TextAccessibilityManager {
|
|
|
178
178
|
}
|
|
179
179
|
return id;
|
|
180
180
|
}
|
|
181
|
+
destroy() {
|
|
182
|
+
__classPrivateFieldSet(this, _TextAccessibilityManager_textNodes, new Map(), "f");
|
|
183
|
+
__classPrivateFieldSet(this, _TextAccessibilityManager_waitingElements, new Map(), "f");
|
|
184
|
+
__classPrivateFieldSet(this, _TextAccessibilityManager_textChildren, null, "f");
|
|
185
|
+
}
|
|
181
186
|
}
|
|
182
187
|
_a = TextAccessibilityManager, _TextAccessibilityManager_enabled = new WeakMap(), _TextAccessibilityManager_textChildren = new WeakMap(), _TextAccessibilityManager_textNodes = new WeakMap(), _TextAccessibilityManager_waitingElements = new WeakMap(), _TextAccessibilityManager_instances = new WeakSet(), _TextAccessibilityManager_compareElementPositions = function _TextAccessibilityManager_compareElementPositions(e1, e2) {
|
|
183
188
|
const rect1 = e1.getBoundingClientRect();
|
|
@@ -124,13 +124,25 @@ class TextLayerBuilder {
|
|
|
124
124
|
* Cancel rendering of the text layer.
|
|
125
125
|
*/
|
|
126
126
|
cancel() {
|
|
127
|
-
var _b, _c;
|
|
127
|
+
var _b, _c, _d;
|
|
128
128
|
(_b = __classPrivateFieldGet(this, _TextLayerBuilder_textLayer, "f")) === null || _b === void 0 ? void 0 : _b.cancel();
|
|
129
129
|
__classPrivateFieldSet(this, _TextLayerBuilder_textLayer, null, "f");
|
|
130
130
|
// this.highlighter?.disable();
|
|
131
131
|
(_c = this.accessibilityManager) === null || _c === void 0 ? void 0 : _c.disable();
|
|
132
|
+
(_d = this.accessibilityManager) === null || _d === void 0 ? void 0 : _d.destroy();
|
|
132
133
|
__classPrivateFieldGet(_a, _a, "m", _TextLayerBuilder_removeGlobalSelectionListener).call(_a, this.div);
|
|
133
134
|
}
|
|
135
|
+
destroy() {
|
|
136
|
+
var _b, _c;
|
|
137
|
+
TextLayer.cleanup();
|
|
138
|
+
this.cancel();
|
|
139
|
+
this.pdfPage = null;
|
|
140
|
+
// this.highlighter = null;
|
|
141
|
+
(_b = this.accessibilityManager) === null || _b === void 0 ? void 0 : _b.destroy();
|
|
142
|
+
this.accessibilityManager = null;
|
|
143
|
+
(_c = this.div) === null || _c === void 0 ? void 0 : _c.remove();
|
|
144
|
+
this.div = null;
|
|
145
|
+
}
|
|
134
146
|
}
|
|
135
147
|
_a = TextLayerBuilder, _TextLayerBuilder_onAppend = new WeakMap(), _TextLayerBuilder_textLayer = new WeakMap(), _TextLayerBuilder_instances = new WeakSet(), _TextLayerBuilder_bindMouse = function _TextLayerBuilder_bindMouse(end) {
|
|
136
148
|
const { div } = this;
|
package/dist/es/utils.js
CHANGED
package/dist/es/widget/page.js
CHANGED
|
@@ -96,9 +96,27 @@ export class Page extends Component {
|
|
|
96
96
|
this.resetState();
|
|
97
97
|
}
|
|
98
98
|
destroy() {
|
|
99
|
+
var _a, _b, _c, _d, _e;
|
|
99
100
|
this.destroyTextLayer();
|
|
101
|
+
if (this.canvas) {
|
|
102
|
+
this.canvas.width = 0;
|
|
103
|
+
this.canvas.height = 0;
|
|
104
|
+
this.canvas.remove();
|
|
105
|
+
this.canvas = null;
|
|
106
|
+
}
|
|
107
|
+
if (this.canvasForPrint) {
|
|
108
|
+
this.canvasForPrint.width = 0;
|
|
109
|
+
this.canvasForPrint.height = 0;
|
|
110
|
+
this.canvasForPrint.remove();
|
|
111
|
+
this.canvasForPrint = null;
|
|
112
|
+
}
|
|
113
|
+
(_a = this.drawLayer) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
114
|
+
(_b = this.annotationLayer) === null || _b === void 0 ? void 0 : _b.destroy();
|
|
115
|
+
(_c = this.annotationEditorLayer) === null || _c === void 0 ? void 0 : _c.destroy();
|
|
116
|
+
(_d = this.div) === null || _d === void 0 ? void 0 : _d.remove();
|
|
100
117
|
this.div = null;
|
|
101
118
|
this.pdfViewer = null;
|
|
119
|
+
(_e = this.pdfPage) === null || _e === void 0 ? void 0 : _e.cleanup();
|
|
102
120
|
this.pdfPage = null;
|
|
103
121
|
}
|
|
104
122
|
get isEditing() {
|
|
@@ -129,6 +147,9 @@ export class Page extends Component {
|
|
|
129
147
|
return viewport;
|
|
130
148
|
}
|
|
131
149
|
destroyTextLayer() {
|
|
150
|
+
var _a, _b;
|
|
151
|
+
(_a = this.textLayer) === null || _a === void 0 ? void 0 : _a.cancel();
|
|
152
|
+
(_b = this.textLayer) === null || _b === void 0 ? void 0 : _b.destroy();
|
|
132
153
|
this.removeTextLayer();
|
|
133
154
|
this.textLayer = null;
|
|
134
155
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _PdfViewer_instances, _PdfViewer_annotationEditorMode, _PdfViewer_switchAnnotationEditorModeTimeoutId, _PdfViewer_annotationMode, _PdfViewer_eventAbortController, _PdfViewer_onPageRenderedCallback, _PdfViewer_switchToEditAnnotationMode, _PdfViewer_scrollIntoView;
|
|
2
2
|
import { __awaiter, __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
|
|
3
3
|
import { deepExtend, Component, isString, toArray, noop, hasValue, toClassSelector, addClass, removeClass, mousewheelDelta, convertToHtml, clamp, createPromise } from "../common/main";
|
|
4
|
-
import { currentPage, parsePdfFromBase64String,
|
|
4
|
+
import { currentPage, parsePdfFromBase64String, adjustCanvasSize, createElement, getDevicePixelRatio } from "../utils";
|
|
5
5
|
import { SearchService } from "../search";
|
|
6
6
|
import { Scroller, throttle } from "../scroller";
|
|
7
7
|
import { saveAs } from "@progress/kendo-file-saver";
|
|
@@ -61,6 +61,7 @@ export class PdfViewer extends Component {
|
|
|
61
61
|
pageWheelThrottleDelay: 200,
|
|
62
62
|
// ported from pdf.js
|
|
63
63
|
printResolution: 100,
|
|
64
|
+
renderScale: 1.4,
|
|
64
65
|
loadOnDemand: false,
|
|
65
66
|
loadOnDemandPageSize: 2,
|
|
66
67
|
messages: {
|
|
@@ -219,6 +220,7 @@ export class PdfViewer extends Component {
|
|
|
219
220
|
return;
|
|
220
221
|
}
|
|
221
222
|
e.preventDefault();
|
|
223
|
+
e.stopPropagation();
|
|
222
224
|
const wheelDelta = mousewheelDelta(e);
|
|
223
225
|
const zoomModifier = wheelDelta < 0 ? 1 : -1;
|
|
224
226
|
const zoomLevel = this.state.zoomLevel + (zoomModifier * this.options.zoomRate);
|
|
@@ -746,20 +748,15 @@ export class PdfViewer extends Component {
|
|
|
746
748
|
if (zoom <= 0) {
|
|
747
749
|
return;
|
|
748
750
|
}
|
|
749
|
-
const renderScale =
|
|
751
|
+
const renderScale = this.options.renderScale * getDevicePixelRatio();
|
|
750
752
|
let scaleNum = zoom * renderScale;
|
|
751
753
|
if (printUnits) {
|
|
752
754
|
scaleNum = zoom || renderScale;
|
|
753
755
|
}
|
|
754
|
-
// const scaleNum = zoom * renderScale;
|
|
755
756
|
// changing the viewport dimensions here requires changes in
|
|
756
757
|
// page.getPrintContentAsync for the printing dimensions
|
|
757
758
|
const viewport = pdfPage === null || pdfPage === void 0 ? void 0 : pdfPage.getViewport({ scale: scaleNum });
|
|
758
759
|
const { adjustedWidth, adjustedHeight, adjustRatio } = adjustCanvasSize(viewport.width, viewport.height);
|
|
759
|
-
// const styles = {
|
|
760
|
-
// width: Math.floor(viewport.width / scaleNum) * zoom + 'pt',
|
|
761
|
-
// height: Math.floor(viewport.height / scaleNum) * zoom + 'pt'
|
|
762
|
-
// };
|
|
763
760
|
// use PageView.setLayerDimensions
|
|
764
761
|
const { pageWidth, pageHeight } = viewport.rawDims;
|
|
765
762
|
const styles = {
|
|
@@ -112,11 +112,12 @@ class AnnotationEditorLayerBuilder {
|
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
114
|
cancel() {
|
|
115
|
+
var _a;
|
|
115
116
|
this._cancelled = true;
|
|
116
117
|
if (!this.div) {
|
|
117
118
|
return;
|
|
118
119
|
}
|
|
119
|
-
this.annotationEditorLayer.destroy();
|
|
120
|
+
(_a = this.annotationEditorLayer) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
120
121
|
}
|
|
121
122
|
hide() {
|
|
122
123
|
if (!this.div) {
|
|
@@ -130,6 +131,10 @@ class AnnotationEditorLayerBuilder {
|
|
|
130
131
|
}
|
|
131
132
|
this.div.hidden = false;
|
|
132
133
|
}
|
|
134
|
+
destroy() {
|
|
135
|
+
var _a;
|
|
136
|
+
(_a = this.annotationEditorLayer) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
137
|
+
}
|
|
133
138
|
}
|
|
134
139
|
_AnnotationEditorLayerBuilder_annotationLayer = new WeakMap(), _AnnotationEditorLayerBuilder_drawLayer = new WeakMap(), _AnnotationEditorLayerBuilder_onAppend = new WeakMap(), _AnnotationEditorLayerBuilder_textLayer = new WeakMap(), _AnnotationEditorLayerBuilder_uiManager = new WeakMap();
|
|
135
140
|
export { AnnotationEditorLayerBuilder };
|
|
@@ -143,8 +143,8 @@ class AnnotationLayerBuilder {
|
|
|
143
143
|
(_b = __classPrivateFieldGet(this, _AnnotationLayerBuilder_onAppend, "f")) === null || _b === void 0 ? void 0 : _b.call(this, div);
|
|
144
144
|
this.annotationLayer = new AnnotationLayer({
|
|
145
145
|
div,
|
|
146
|
-
|
|
147
|
-
accessibilityManager: null,
|
|
146
|
+
accessibilityManager: this._accessibilityManager,
|
|
147
|
+
// accessibilityManager: null,
|
|
148
148
|
annotationCanvasMap: this._annotationCanvasMap,
|
|
149
149
|
annotationEditorUIManager: this._annotationEditorUIManager,
|
|
150
150
|
page: this.pdfPage,
|
|
@@ -190,6 +190,16 @@ class AnnotationLayerBuilder {
|
|
|
190
190
|
var _a;
|
|
191
191
|
return !!((_a = this.annotationLayer) === null || _a === void 0 ? void 0 : _a.hasEditableAnnotations());
|
|
192
192
|
}
|
|
193
|
+
destroy() {
|
|
194
|
+
var _a, _b, _c;
|
|
195
|
+
this.cancel();
|
|
196
|
+
(_a = this.annotationLayer) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
197
|
+
this.annotationLayer = null;
|
|
198
|
+
(_b = __classPrivateFieldGet(this, _AnnotationLayerBuilder_eventAbortController, "f")) === null || _b === void 0 ? void 0 : _b.abort();
|
|
199
|
+
__classPrivateFieldSet(this, _AnnotationLayerBuilder_eventAbortController, null, "f");
|
|
200
|
+
(_c = this.div) === null || _c === void 0 ? void 0 : _c.remove();
|
|
201
|
+
this.div = null;
|
|
202
|
+
}
|
|
193
203
|
}
|
|
194
204
|
_AnnotationLayerBuilder_onAppend = new WeakMap(), _AnnotationLayerBuilder_eventAbortController = new WeakMap(), _AnnotationLayerBuilder_instances = new WeakSet(), _AnnotationLayerBuilder_updatePresentationModeState = function _AnnotationLayerBuilder_updatePresentationModeState(state) {
|
|
195
205
|
if (!this.div) {
|
|
@@ -2766,6 +2766,12 @@ class AnnotationLayer {
|
|
|
2766
2766
|
getEditableAnnotation(id) {
|
|
2767
2767
|
return __classPrivateFieldGet(this, _AnnotationLayer_editableAnnotations, "f").get(id);
|
|
2768
2768
|
}
|
|
2769
|
+
destroy() {
|
|
2770
|
+
var _a, _b;
|
|
2771
|
+
(_a = __classPrivateFieldGet(this, _AnnotationLayer_annotationCanvasMap, "f")) === null || _a === void 0 ? void 0 : _a.clear();
|
|
2772
|
+
(_b = this.div) === null || _b === void 0 ? void 0 : _b.remove();
|
|
2773
|
+
this.div = null;
|
|
2774
|
+
}
|
|
2769
2775
|
}
|
|
2770
2776
|
_AnnotationLayer_accessibilityManager = new WeakMap(), _AnnotationLayer_annotationCanvasMap = new WeakMap(), _AnnotationLayer_editableAnnotations = new WeakMap(), _AnnotationLayer_instances = new WeakSet(), _AnnotationLayer_appendElement = function _AnnotationLayer_appendElement(element, id) {
|
|
2771
2777
|
var _a;
|
|
@@ -47,10 +47,11 @@ class DrawLayerBuilder {
|
|
|
47
47
|
}
|
|
48
48
|
cancel() {
|
|
49
49
|
// this._cancelled = true;
|
|
50
|
+
var _a;
|
|
50
51
|
if (!__classPrivateFieldGet(this, _DrawLayerBuilder_drawLayer, "f")) {
|
|
51
52
|
return;
|
|
52
53
|
}
|
|
53
|
-
__classPrivateFieldGet(this, _DrawLayerBuilder_drawLayer, "f").destroy();
|
|
54
|
+
(_a = __classPrivateFieldGet(this, _DrawLayerBuilder_drawLayer, "f")) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
54
55
|
__classPrivateFieldSet(this, _DrawLayerBuilder_drawLayer, null, "f");
|
|
55
56
|
}
|
|
56
57
|
setParent(parent) {
|
|
@@ -60,6 +61,9 @@ class DrawLayerBuilder {
|
|
|
60
61
|
getDrawLayer() {
|
|
61
62
|
return __classPrivateFieldGet(this, _DrawLayerBuilder_drawLayer, "f");
|
|
62
63
|
}
|
|
64
|
+
destroy() {
|
|
65
|
+
this.cancel();
|
|
66
|
+
}
|
|
63
67
|
}
|
|
64
68
|
_DrawLayerBuilder_drawLayer = new WeakMap();
|
|
65
69
|
export { DrawLayerBuilder };
|
|
@@ -178,6 +178,11 @@ class TextAccessibilityManager {
|
|
|
178
178
|
}
|
|
179
179
|
return id;
|
|
180
180
|
}
|
|
181
|
+
destroy() {
|
|
182
|
+
__classPrivateFieldSet(this, _TextAccessibilityManager_textNodes, new Map(), "f");
|
|
183
|
+
__classPrivateFieldSet(this, _TextAccessibilityManager_waitingElements, new Map(), "f");
|
|
184
|
+
__classPrivateFieldSet(this, _TextAccessibilityManager_textChildren, null, "f");
|
|
185
|
+
}
|
|
181
186
|
}
|
|
182
187
|
_a = TextAccessibilityManager, _TextAccessibilityManager_enabled = new WeakMap(), _TextAccessibilityManager_textChildren = new WeakMap(), _TextAccessibilityManager_textNodes = new WeakMap(), _TextAccessibilityManager_waitingElements = new WeakMap(), _TextAccessibilityManager_instances = new WeakSet(), _TextAccessibilityManager_compareElementPositions = function _TextAccessibilityManager_compareElementPositions(e1, e2) {
|
|
183
188
|
const rect1 = e1.getBoundingClientRect();
|
|
@@ -124,13 +124,25 @@ class TextLayerBuilder {
|
|
|
124
124
|
* Cancel rendering of the text layer.
|
|
125
125
|
*/
|
|
126
126
|
cancel() {
|
|
127
|
-
var _b, _c;
|
|
127
|
+
var _b, _c, _d;
|
|
128
128
|
(_b = __classPrivateFieldGet(this, _TextLayerBuilder_textLayer, "f")) === null || _b === void 0 ? void 0 : _b.cancel();
|
|
129
129
|
__classPrivateFieldSet(this, _TextLayerBuilder_textLayer, null, "f");
|
|
130
130
|
// this.highlighter?.disable();
|
|
131
131
|
(_c = this.accessibilityManager) === null || _c === void 0 ? void 0 : _c.disable();
|
|
132
|
+
(_d = this.accessibilityManager) === null || _d === void 0 ? void 0 : _d.destroy();
|
|
132
133
|
__classPrivateFieldGet(_a, _a, "m", _TextLayerBuilder_removeGlobalSelectionListener).call(_a, this.div);
|
|
133
134
|
}
|
|
135
|
+
destroy() {
|
|
136
|
+
var _b, _c;
|
|
137
|
+
TextLayer.cleanup();
|
|
138
|
+
this.cancel();
|
|
139
|
+
this.pdfPage = null;
|
|
140
|
+
// this.highlighter = null;
|
|
141
|
+
(_b = this.accessibilityManager) === null || _b === void 0 ? void 0 : _b.destroy();
|
|
142
|
+
this.accessibilityManager = null;
|
|
143
|
+
(_c = this.div) === null || _c === void 0 ? void 0 : _c.remove();
|
|
144
|
+
this.div = null;
|
|
145
|
+
}
|
|
134
146
|
}
|
|
135
147
|
_a = TextLayerBuilder, _TextLayerBuilder_onAppend = new WeakMap(), _TextLayerBuilder_textLayer = new WeakMap(), _TextLayerBuilder_instances = new WeakSet(), _TextLayerBuilder_bindMouse = function _TextLayerBuilder_bindMouse(end) {
|
|
136
148
|
const { div } = this;
|
package/dist/es2015/utils.js
CHANGED
|
@@ -96,9 +96,27 @@ export class Page extends Component {
|
|
|
96
96
|
this.resetState();
|
|
97
97
|
}
|
|
98
98
|
destroy() {
|
|
99
|
+
var _a, _b, _c, _d, _e;
|
|
99
100
|
this.destroyTextLayer();
|
|
101
|
+
if (this.canvas) {
|
|
102
|
+
this.canvas.width = 0;
|
|
103
|
+
this.canvas.height = 0;
|
|
104
|
+
this.canvas.remove();
|
|
105
|
+
this.canvas = null;
|
|
106
|
+
}
|
|
107
|
+
if (this.canvasForPrint) {
|
|
108
|
+
this.canvasForPrint.width = 0;
|
|
109
|
+
this.canvasForPrint.height = 0;
|
|
110
|
+
this.canvasForPrint.remove();
|
|
111
|
+
this.canvasForPrint = null;
|
|
112
|
+
}
|
|
113
|
+
(_a = this.drawLayer) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
114
|
+
(_b = this.annotationLayer) === null || _b === void 0 ? void 0 : _b.destroy();
|
|
115
|
+
(_c = this.annotationEditorLayer) === null || _c === void 0 ? void 0 : _c.destroy();
|
|
116
|
+
(_d = this.div) === null || _d === void 0 ? void 0 : _d.remove();
|
|
100
117
|
this.div = null;
|
|
101
118
|
this.pdfViewer = null;
|
|
119
|
+
(_e = this.pdfPage) === null || _e === void 0 ? void 0 : _e.cleanup();
|
|
102
120
|
this.pdfPage = null;
|
|
103
121
|
}
|
|
104
122
|
get isEditing() {
|
|
@@ -129,6 +147,9 @@ export class Page extends Component {
|
|
|
129
147
|
return viewport;
|
|
130
148
|
}
|
|
131
149
|
destroyTextLayer() {
|
|
150
|
+
var _a, _b;
|
|
151
|
+
(_a = this.textLayer) === null || _a === void 0 ? void 0 : _a.cancel();
|
|
152
|
+
(_b = this.textLayer) === null || _b === void 0 ? void 0 : _b.destroy();
|
|
132
153
|
this.removeTextLayer();
|
|
133
154
|
this.textLayer = null;
|
|
134
155
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _PdfViewer_instances, _PdfViewer_annotationEditorMode, _PdfViewer_switchAnnotationEditorModeTimeoutId, _PdfViewer_annotationMode, _PdfViewer_eventAbortController, _PdfViewer_onPageRenderedCallback, _PdfViewer_switchToEditAnnotationMode, _PdfViewer_scrollIntoView;
|
|
2
2
|
import { __awaiter, __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
|
|
3
3
|
import { deepExtend, Component, isString, toArray, noop, hasValue, toClassSelector, addClass, removeClass, mousewheelDelta, convertToHtml, clamp, createPromise } from "../common/main";
|
|
4
|
-
import { currentPage, parsePdfFromBase64String,
|
|
4
|
+
import { currentPage, parsePdfFromBase64String, adjustCanvasSize, createElement, getDevicePixelRatio } from "../utils";
|
|
5
5
|
import { SearchService } from "../search";
|
|
6
6
|
import { Scroller, throttle } from "../scroller";
|
|
7
7
|
import { saveAs } from "@progress/kendo-file-saver";
|
|
@@ -61,6 +61,7 @@ export class PdfViewer extends Component {
|
|
|
61
61
|
pageWheelThrottleDelay: 200,
|
|
62
62
|
// ported from pdf.js
|
|
63
63
|
printResolution: 100,
|
|
64
|
+
renderScale: 1.4,
|
|
64
65
|
loadOnDemand: false,
|
|
65
66
|
loadOnDemandPageSize: 2,
|
|
66
67
|
messages: {
|
|
@@ -219,6 +220,7 @@ export class PdfViewer extends Component {
|
|
|
219
220
|
return;
|
|
220
221
|
}
|
|
221
222
|
e.preventDefault();
|
|
223
|
+
e.stopPropagation();
|
|
222
224
|
const wheelDelta = mousewheelDelta(e);
|
|
223
225
|
const zoomModifier = wheelDelta < 0 ? 1 : -1;
|
|
224
226
|
const zoomLevel = this.state.zoomLevel + (zoomModifier * this.options.zoomRate);
|
|
@@ -746,20 +748,15 @@ export class PdfViewer extends Component {
|
|
|
746
748
|
if (zoom <= 0) {
|
|
747
749
|
return;
|
|
748
750
|
}
|
|
749
|
-
const renderScale =
|
|
751
|
+
const renderScale = this.options.renderScale * getDevicePixelRatio();
|
|
750
752
|
let scaleNum = zoom * renderScale;
|
|
751
753
|
if (printUnits) {
|
|
752
754
|
scaleNum = zoom || renderScale;
|
|
753
755
|
}
|
|
754
|
-
// const scaleNum = zoom * renderScale;
|
|
755
756
|
// changing the viewport dimensions here requires changes in
|
|
756
757
|
// page.getPrintContentAsync for the printing dimensions
|
|
757
758
|
const viewport = pdfPage === null || pdfPage === void 0 ? void 0 : pdfPage.getViewport({ scale: scaleNum });
|
|
758
759
|
const { adjustedWidth, adjustedHeight, adjustRatio } = adjustCanvasSize(viewport.width, viewport.height);
|
|
759
|
-
// const styles = {
|
|
760
|
-
// width: Math.floor(viewport.width / scaleNum) * zoom + 'pt',
|
|
761
|
-
// height: Math.floor(viewport.height / scaleNum) * zoom + 'pt'
|
|
762
|
-
// };
|
|
763
760
|
// use PageView.setLayerDimensions
|
|
764
761
|
const { pageWidth, pageHeight } = viewport.rawDims;
|
|
765
762
|
const styles = {
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
/** @typedef {import("./interfaces").IL10n} IL10n */
|
|
6
6
|
/** @typedef {import("../src/display/annotation_layer.js").AnnotationLayer} AnnotationLayer */
|
|
7
7
|
import { AnnotationEditorLayer } from "./annotation-editor-layer";
|
|
8
|
+
import { TextAccessibilityManager } from "./helpers/text-accessibility-manager";
|
|
8
9
|
/**
|
|
9
10
|
* @typedef {Object} AnnotationEditorLayerBuilderOptions
|
|
10
11
|
* @property {AnnotationEditorUIManager} [uiManager]
|
|
@@ -22,7 +23,7 @@ declare class AnnotationEditorLayerBuilder {
|
|
|
22
23
|
annotationEditorLayer: AnnotationEditorLayer;
|
|
23
24
|
_cancelled: any;
|
|
24
25
|
div: any;
|
|
25
|
-
accessibilityManager:
|
|
26
|
+
accessibilityManager: TextAccessibilityManager;
|
|
26
27
|
/**
|
|
27
28
|
* @param {AnnotationEditorLayerBuilderOptions} options
|
|
28
29
|
*/
|
|
@@ -35,5 +36,6 @@ declare class AnnotationEditorLayerBuilder {
|
|
|
35
36
|
cancel(): void;
|
|
36
37
|
hide(): void;
|
|
37
38
|
show(): void;
|
|
39
|
+
destroy(): void;
|
|
38
40
|
}
|
|
39
41
|
export { AnnotationEditorLayerBuilder };
|
|
@@ -115,11 +115,12 @@ class AnnotationEditorLayerBuilder {
|
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
117
|
cancel() {
|
|
118
|
+
var _a;
|
|
118
119
|
this._cancelled = true;
|
|
119
120
|
if (!this.div) {
|
|
120
121
|
return;
|
|
121
122
|
}
|
|
122
|
-
this.annotationEditorLayer.destroy();
|
|
123
|
+
(_a = this.annotationEditorLayer) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
123
124
|
}
|
|
124
125
|
hide() {
|
|
125
126
|
if (!this.div) {
|
|
@@ -133,6 +134,10 @@ class AnnotationEditorLayerBuilder {
|
|
|
133
134
|
}
|
|
134
135
|
this.div.hidden = false;
|
|
135
136
|
}
|
|
137
|
+
destroy() {
|
|
138
|
+
var _a;
|
|
139
|
+
(_a = this.annotationEditorLayer) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
140
|
+
}
|
|
136
141
|
}
|
|
137
142
|
exports.AnnotationEditorLayerBuilder = AnnotationEditorLayerBuilder;
|
|
138
143
|
_AnnotationEditorLayerBuilder_annotationLayer = new WeakMap(), _AnnotationEditorLayerBuilder_drawLayer = new WeakMap(), _AnnotationEditorLayerBuilder_onAppend = new WeakMap(), _AnnotationEditorLayerBuilder_textLayer = new WeakMap(), _AnnotationEditorLayerBuilder_uiManager = new WeakMap();
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PDFLinkService } from "../links/link-service";
|
|
2
2
|
import { AnnotationLayer } from "./annotation-layer";
|
|
3
|
+
import { TextAccessibilityManager } from "./helpers/text-accessibility-manager";
|
|
3
4
|
import { EventBus } from "./shared/event_utils";
|
|
4
5
|
/**
|
|
5
6
|
* @typedef {Object} AnnotationLayerBuilderOptions
|
|
@@ -30,7 +31,7 @@ declare class AnnotationLayerBuilder {
|
|
|
30
31
|
div: any;
|
|
31
32
|
_cancelled: any;
|
|
32
33
|
_eventBus: EventBus;
|
|
33
|
-
_accessibilityManager:
|
|
34
|
+
_accessibilityManager: TextAccessibilityManager;
|
|
34
35
|
renderForms: any;
|
|
35
36
|
/**
|
|
36
37
|
* @param {AnnotationLayerBuilderOptions} options
|
|
@@ -56,5 +57,6 @@ declare class AnnotationLayerBuilder {
|
|
|
56
57
|
cancel(): void;
|
|
57
58
|
hide(): void;
|
|
58
59
|
hasEditableAnnotations(): boolean;
|
|
60
|
+
destroy(): void;
|
|
59
61
|
}
|
|
60
62
|
export { AnnotationLayerBuilder };
|
|
@@ -146,8 +146,8 @@ class AnnotationLayerBuilder {
|
|
|
146
146
|
(_b = tslib_1.__classPrivateFieldGet(this, _AnnotationLayerBuilder_onAppend, "f")) === null || _b === void 0 ? void 0 : _b.call(this, div);
|
|
147
147
|
this.annotationLayer = new annotation_layer_1.AnnotationLayer({
|
|
148
148
|
div,
|
|
149
|
-
|
|
150
|
-
accessibilityManager: null,
|
|
149
|
+
accessibilityManager: this._accessibilityManager,
|
|
150
|
+
// accessibilityManager: null,
|
|
151
151
|
annotationCanvasMap: this._annotationCanvasMap,
|
|
152
152
|
annotationEditorUIManager: this._annotationEditorUIManager,
|
|
153
153
|
page: this.pdfPage,
|
|
@@ -193,6 +193,16 @@ class AnnotationLayerBuilder {
|
|
|
193
193
|
var _a;
|
|
194
194
|
return !!((_a = this.annotationLayer) === null || _a === void 0 ? void 0 : _a.hasEditableAnnotations());
|
|
195
195
|
}
|
|
196
|
+
destroy() {
|
|
197
|
+
var _a, _b, _c;
|
|
198
|
+
this.cancel();
|
|
199
|
+
(_a = this.annotationLayer) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
200
|
+
this.annotationLayer = null;
|
|
201
|
+
(_b = tslib_1.__classPrivateFieldGet(this, _AnnotationLayerBuilder_eventAbortController, "f")) === null || _b === void 0 ? void 0 : _b.abort();
|
|
202
|
+
tslib_1.__classPrivateFieldSet(this, _AnnotationLayerBuilder_eventAbortController, null, "f");
|
|
203
|
+
(_c = this.div) === null || _c === void 0 ? void 0 : _c.remove();
|
|
204
|
+
this.div = null;
|
|
205
|
+
}
|
|
196
206
|
}
|
|
197
207
|
exports.AnnotationLayerBuilder = AnnotationLayerBuilder;
|
|
198
208
|
_AnnotationLayerBuilder_onAppend = new WeakMap(), _AnnotationLayerBuilder_eventAbortController = new WeakMap(), _AnnotationLayerBuilder_instances = new WeakSet(), _AnnotationLayerBuilder_updatePresentationModeState = function _AnnotationLayerBuilder_updatePresentationModeState(state) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AnnotationEditorUIManager } from "./annotation-editor-ui-manager";
|
|
1
2
|
declare class AnnotationElement {
|
|
2
3
|
#private;
|
|
3
4
|
isRenderable: any;
|
|
@@ -101,7 +102,7 @@ declare class AnnotationLayer {
|
|
|
101
102
|
page: any;
|
|
102
103
|
viewport: any;
|
|
103
104
|
zIndex: any;
|
|
104
|
-
_annotationEditorUIManager:
|
|
105
|
+
_annotationEditorUIManager: AnnotationEditorUIManager;
|
|
105
106
|
constructor({ div, accessibilityManager, annotationCanvasMap, annotationEditorUIManager, page, viewport }: {
|
|
106
107
|
div: any;
|
|
107
108
|
accessibilityManager: any;
|
|
@@ -130,5 +131,6 @@ declare class AnnotationLayer {
|
|
|
130
131
|
}): void;
|
|
131
132
|
getEditableAnnotations(): any[];
|
|
132
133
|
getEditableAnnotation(id: any): any;
|
|
134
|
+
destroy(): void;
|
|
133
135
|
}
|
|
134
136
|
export { AnnotationLayer, FreeTextAnnotationElement };
|
|
@@ -2770,6 +2770,12 @@ class AnnotationLayer {
|
|
|
2770
2770
|
getEditableAnnotation(id) {
|
|
2771
2771
|
return tslib_1.__classPrivateFieldGet(this, _AnnotationLayer_editableAnnotations, "f").get(id);
|
|
2772
2772
|
}
|
|
2773
|
+
destroy() {
|
|
2774
|
+
var _a, _b;
|
|
2775
|
+
(_a = tslib_1.__classPrivateFieldGet(this, _AnnotationLayer_annotationCanvasMap, "f")) === null || _a === void 0 ? void 0 : _a.clear();
|
|
2776
|
+
(_b = this.div) === null || _b === void 0 ? void 0 : _b.remove();
|
|
2777
|
+
this.div = null;
|
|
2778
|
+
}
|
|
2773
2779
|
}
|
|
2774
2780
|
exports.AnnotationLayer = AnnotationLayer;
|
|
2775
2781
|
_AnnotationLayer_accessibilityManager = new WeakMap(), _AnnotationLayer_annotationCanvasMap = new WeakMap(), _AnnotationLayer_editableAnnotations = new WeakMap(), _AnnotationLayer_instances = new WeakSet(), _AnnotationLayer_appendElement = function _AnnotationLayer_appendElement(element, id) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DrawLayer } from "./draw-layer";
|
|
1
2
|
/**
|
|
2
3
|
* @typedef {Object} DrawLayerBuilderOptions
|
|
3
4
|
* @property {number} pageIndex
|
|
@@ -16,6 +17,7 @@ declare class DrawLayerBuilder {
|
|
|
16
17
|
render(intent?: string): Promise<void>;
|
|
17
18
|
cancel(): void;
|
|
18
19
|
setParent(parent: any): void;
|
|
19
|
-
getDrawLayer():
|
|
20
|
+
getDrawLayer(): DrawLayer;
|
|
21
|
+
destroy(): void;
|
|
20
22
|
}
|
|
21
23
|
export { DrawLayerBuilder };
|
|
@@ -50,10 +50,11 @@ class DrawLayerBuilder {
|
|
|
50
50
|
}
|
|
51
51
|
cancel() {
|
|
52
52
|
// this._cancelled = true;
|
|
53
|
+
var _a;
|
|
53
54
|
if (!tslib_1.__classPrivateFieldGet(this, _DrawLayerBuilder_drawLayer, "f")) {
|
|
54
55
|
return;
|
|
55
56
|
}
|
|
56
|
-
tslib_1.__classPrivateFieldGet(this, _DrawLayerBuilder_drawLayer, "f").destroy();
|
|
57
|
+
(_a = tslib_1.__classPrivateFieldGet(this, _DrawLayerBuilder_drawLayer, "f")) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
57
58
|
tslib_1.__classPrivateFieldSet(this, _DrawLayerBuilder_drawLayer, null, "f");
|
|
58
59
|
}
|
|
59
60
|
setParent(parent) {
|
|
@@ -63,6 +64,9 @@ class DrawLayerBuilder {
|
|
|
63
64
|
getDrawLayer() {
|
|
64
65
|
return tslib_1.__classPrivateFieldGet(this, _DrawLayerBuilder_drawLayer, "f");
|
|
65
66
|
}
|
|
67
|
+
destroy() {
|
|
68
|
+
this.cancel();
|
|
69
|
+
}
|
|
66
70
|
}
|
|
67
71
|
exports.DrawLayerBuilder = DrawLayerBuilder;
|
|
68
72
|
_DrawLayerBuilder_drawLayer = new WeakMap();
|
|
@@ -32,5 +32,6 @@ declare class TextAccessibilityManager {
|
|
|
32
32
|
* @returns {string|null} The id in the struct tree if any.
|
|
33
33
|
*/
|
|
34
34
|
moveElementInDOM(container: any, element: any, contentElement: any, isRemovable: any): any;
|
|
35
|
+
destroy(): void;
|
|
35
36
|
}
|
|
36
37
|
export { TextAccessibilityManager };
|
|
@@ -181,6 +181,11 @@ class TextAccessibilityManager {
|
|
|
181
181
|
}
|
|
182
182
|
return id;
|
|
183
183
|
}
|
|
184
|
+
destroy() {
|
|
185
|
+
tslib_1.__classPrivateFieldSet(this, _TextAccessibilityManager_textNodes, new Map(), "f");
|
|
186
|
+
tslib_1.__classPrivateFieldSet(this, _TextAccessibilityManager_waitingElements, new Map(), "f");
|
|
187
|
+
tslib_1.__classPrivateFieldSet(this, _TextAccessibilityManager_textChildren, null, "f");
|
|
188
|
+
}
|
|
184
189
|
}
|
|
185
190
|
exports.TextAccessibilityManager = TextAccessibilityManager;
|
|
186
191
|
_a = TextAccessibilityManager, _TextAccessibilityManager_enabled = new WeakMap(), _TextAccessibilityManager_textChildren = new WeakMap(), _TextAccessibilityManager_textNodes = new WeakMap(), _TextAccessibilityManager_waitingElements = new WeakMap(), _TextAccessibilityManager_instances = new WeakSet(), _TextAccessibilityManager_compareElementPositions = function _TextAccessibilityManager_compareElementPositions(e1, e2) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TextAccessibilityManager } from "../annotations/helpers/text-accessibility-manager";
|
|
1
2
|
/**
|
|
2
3
|
* The text layer builder provides text selection functionality for the PDF.
|
|
3
4
|
* It does this by creating overlay divs over the PDF's text. These divs
|
|
@@ -7,7 +8,7 @@ declare class TextLayerBuilder {
|
|
|
7
8
|
#private;
|
|
8
9
|
pdfPage: any;
|
|
9
10
|
div: any;
|
|
10
|
-
accessibilityManager:
|
|
11
|
+
accessibilityManager: TextAccessibilityManager;
|
|
11
12
|
constructor({ pdfPage, accessibilityManager, styles, onAppend }: {
|
|
12
13
|
pdfPage: any;
|
|
13
14
|
accessibilityManager: any;
|
|
@@ -26,5 +27,6 @@ declare class TextLayerBuilder {
|
|
|
26
27
|
* Cancel rendering of the text layer.
|
|
27
28
|
*/
|
|
28
29
|
cancel(): void;
|
|
30
|
+
destroy(): void;
|
|
29
31
|
}
|
|
30
32
|
export { TextLayerBuilder };
|
|
@@ -127,13 +127,25 @@ class TextLayerBuilder {
|
|
|
127
127
|
* Cancel rendering of the text layer.
|
|
128
128
|
*/
|
|
129
129
|
cancel() {
|
|
130
|
-
var _b, _c;
|
|
130
|
+
var _b, _c, _d;
|
|
131
131
|
(_b = tslib_1.__classPrivateFieldGet(this, _TextLayerBuilder_textLayer, "f")) === null || _b === void 0 ? void 0 : _b.cancel();
|
|
132
132
|
tslib_1.__classPrivateFieldSet(this, _TextLayerBuilder_textLayer, null, "f");
|
|
133
133
|
// this.highlighter?.disable();
|
|
134
134
|
(_c = this.accessibilityManager) === null || _c === void 0 ? void 0 : _c.disable();
|
|
135
|
+
(_d = this.accessibilityManager) === null || _d === void 0 ? void 0 : _d.destroy();
|
|
135
136
|
tslib_1.__classPrivateFieldGet(_a, _a, "m", _TextLayerBuilder_removeGlobalSelectionListener).call(_a, this.div);
|
|
136
137
|
}
|
|
138
|
+
destroy() {
|
|
139
|
+
var _b, _c;
|
|
140
|
+
pdf_mjs_1.TextLayer.cleanup();
|
|
141
|
+
this.cancel();
|
|
142
|
+
this.pdfPage = null;
|
|
143
|
+
// this.highlighter = null;
|
|
144
|
+
(_b = this.accessibilityManager) === null || _b === void 0 ? void 0 : _b.destroy();
|
|
145
|
+
this.accessibilityManager = null;
|
|
146
|
+
(_c = this.div) === null || _c === void 0 ? void 0 : _c.remove();
|
|
147
|
+
this.div = null;
|
|
148
|
+
}
|
|
137
149
|
}
|
|
138
150
|
exports.TextLayerBuilder = TextLayerBuilder;
|
|
139
151
|
_a = TextLayerBuilder, _TextLayerBuilder_onAppend = new WeakMap(), _TextLayerBuilder_textLayer = new WeakMap(), _TextLayerBuilder_instances = new WeakSet(), _TextLayerBuilder_bindMouse = function _TextLayerBuilder_bindMouse(end) {
|
package/dist/npm/utils.d.ts
CHANGED
package/dist/npm/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.adjustCanvasSize = exports.currentPage = exports.scrollToPage = exports.calculateZoomLevel = exports.goToPreviousSearchMatch = exports.goToNextSearchMatch = exports.renderPage = exports.transforms = exports.createElement = exports.print = exports.reloadDocument = exports.loadPDF = exports.download = exports.removeChildren = exports.parsePdfFromBase64String = exports.scale = exports.DEFAULT_ZOOM_LEVEL = void 0;
|
|
3
|
+
exports.getDevicePixelRatio = exports.adjustCanvasSize = exports.currentPage = exports.scrollToPage = exports.calculateZoomLevel = exports.goToPreviousSearchMatch = exports.goToNextSearchMatch = exports.renderPage = exports.transforms = exports.createElement = exports.print = exports.reloadDocument = exports.loadPDF = exports.download = exports.removeChildren = exports.parsePdfFromBase64String = exports.scale = exports.DEFAULT_ZOOM_LEVEL = void 0;
|
|
4
4
|
const kendo_file_saver_1 = require("@progress/kendo-file-saver");
|
|
5
5
|
const kendo_common_1 = require("@progress/kendo-common");
|
|
6
6
|
const pdf_mjs_1 = require("pdfjs-dist/legacy/build/pdf.mjs");
|
|
@@ -500,3 +500,5 @@ const createCanvas = (page, zoom = 1, cssClass = '') => {
|
|
|
500
500
|
styles
|
|
501
501
|
};
|
|
502
502
|
};
|
|
503
|
+
const getDevicePixelRatio = () => (window === null || window === void 0 ? void 0 : window.devicePixelRatio) || 1;
|
|
504
|
+
exports.getDevicePixelRatio = getDevicePixelRatio;
|
package/dist/npm/widget/page.js
CHANGED
|
@@ -96,9 +96,27 @@ class Page extends component_1.Component {
|
|
|
96
96
|
this.resetState();
|
|
97
97
|
}
|
|
98
98
|
destroy() {
|
|
99
|
+
var _a, _b, _c, _d, _e;
|
|
99
100
|
this.destroyTextLayer();
|
|
101
|
+
if (this.canvas) {
|
|
102
|
+
this.canvas.width = 0;
|
|
103
|
+
this.canvas.height = 0;
|
|
104
|
+
this.canvas.remove();
|
|
105
|
+
this.canvas = null;
|
|
106
|
+
}
|
|
107
|
+
if (this.canvasForPrint) {
|
|
108
|
+
this.canvasForPrint.width = 0;
|
|
109
|
+
this.canvasForPrint.height = 0;
|
|
110
|
+
this.canvasForPrint.remove();
|
|
111
|
+
this.canvasForPrint = null;
|
|
112
|
+
}
|
|
113
|
+
(_a = this.drawLayer) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
114
|
+
(_b = this.annotationLayer) === null || _b === void 0 ? void 0 : _b.destroy();
|
|
115
|
+
(_c = this.annotationEditorLayer) === null || _c === void 0 ? void 0 : _c.destroy();
|
|
116
|
+
(_d = this.div) === null || _d === void 0 ? void 0 : _d.remove();
|
|
100
117
|
this.div = null;
|
|
101
118
|
this.pdfViewer = null;
|
|
119
|
+
(_e = this.pdfPage) === null || _e === void 0 ? void 0 : _e.cleanup();
|
|
102
120
|
this.pdfPage = null;
|
|
103
121
|
}
|
|
104
122
|
get isEditing() {
|
|
@@ -129,6 +147,9 @@ class Page extends component_1.Component {
|
|
|
129
147
|
return viewport;
|
|
130
148
|
}
|
|
131
149
|
destroyTextLayer() {
|
|
150
|
+
var _a, _b;
|
|
151
|
+
(_a = this.textLayer) === null || _a === void 0 ? void 0 : _a.cancel();
|
|
152
|
+
(_b = this.textLayer) === null || _b === void 0 ? void 0 : _b.destroy();
|
|
132
153
|
this.removeTextLayer();
|
|
133
154
|
this.textLayer = null;
|
|
134
155
|
}
|
|
@@ -64,6 +64,7 @@ class PdfViewer extends main_1.Component {
|
|
|
64
64
|
pageWheelThrottleDelay: 200,
|
|
65
65
|
// ported from pdf.js
|
|
66
66
|
printResolution: 100,
|
|
67
|
+
renderScale: 1.4,
|
|
67
68
|
loadOnDemand: false,
|
|
68
69
|
loadOnDemandPageSize: 2,
|
|
69
70
|
messages: {
|
|
@@ -222,6 +223,7 @@ class PdfViewer extends main_1.Component {
|
|
|
222
223
|
return;
|
|
223
224
|
}
|
|
224
225
|
e.preventDefault();
|
|
226
|
+
e.stopPropagation();
|
|
225
227
|
const wheelDelta = (0, main_1.mousewheelDelta)(e);
|
|
226
228
|
const zoomModifier = wheelDelta < 0 ? 1 : -1;
|
|
227
229
|
const zoomLevel = this.state.zoomLevel + (zoomModifier * this.options.zoomRate);
|
|
@@ -749,20 +751,15 @@ class PdfViewer extends main_1.Component {
|
|
|
749
751
|
if (zoom <= 0) {
|
|
750
752
|
return;
|
|
751
753
|
}
|
|
752
|
-
const renderScale = (0, utils_1.
|
|
754
|
+
const renderScale = this.options.renderScale * (0, utils_1.getDevicePixelRatio)();
|
|
753
755
|
let scaleNum = zoom * renderScale;
|
|
754
756
|
if (printUnits) {
|
|
755
757
|
scaleNum = zoom || renderScale;
|
|
756
758
|
}
|
|
757
|
-
// const scaleNum = zoom * renderScale;
|
|
758
759
|
// changing the viewport dimensions here requires changes in
|
|
759
760
|
// page.getPrintContentAsync for the printing dimensions
|
|
760
761
|
const viewport = pdfPage === null || pdfPage === void 0 ? void 0 : pdfPage.getViewport({ scale: scaleNum });
|
|
761
762
|
const { adjustedWidth, adjustedHeight, adjustRatio } = (0, utils_1.adjustCanvasSize)(viewport.width, viewport.height);
|
|
762
|
-
// const styles = {
|
|
763
|
-
// width: Math.floor(viewport.width / scaleNum) * zoom + 'pt',
|
|
764
|
-
// height: Math.floor(viewport.height / scaleNum) * zoom + 'pt'
|
|
765
|
-
// };
|
|
766
763
|
// use PageView.setLayerDimensions
|
|
767
764
|
const { pageWidth, pageHeight } = viewport.rawDims;
|
|
768
765
|
const styles = {
|
package/package.json
CHANGED