@xtctwins/tctwins-pdf-core 0.1.0 → 0.1.1
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/PdfViewer.d.ts +7 -1
- package/dist/PdfViewer.d.ts.map +1 -1
- package/dist/components/MobileConsole.vue.d.ts +13 -0
- package/dist/components/MobileConsole.vue.d.ts.map +1 -0
- package/dist/components/PdfViewer.d.ts +3 -3
- package/dist/components/PdfViewer.vue.d.ts +3 -2
- package/dist/components/PdfViewer.vue.d.ts.map +1 -1
- package/dist/components/useAnnotationCanvas.d.ts +9 -2
- package/dist/components/useAnnotationCanvas.d.ts.map +1 -1
- package/dist/components/useViewerLayout.d.ts +21 -16
- package/dist/components/useViewerLayout.d.ts.map +1 -1
- package/dist/components/useViewerManager.d.ts +2 -0
- package/dist/components/useViewerManager.d.ts.map +1 -1
- package/dist/core/TileRenderer.d.ts +0 -1
- package/dist/core/TileRenderer.d.ts.map +1 -1
- package/dist/pdf-core.js +525 -324
- package/dist/style.css +1 -1
- package/dist/types/components.d.ts +2 -0
- package/dist/types/components.d.ts.map +1 -1
- package/dist/vue/usePdfCore.d.ts +2 -2
- package/dist/vue/usePdfCore.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/pdf-core.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import * as e from "pdfjs-dist";
|
|
2
|
-
import {
|
|
2
|
+
import { Fragment as t, computed as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, createVNode as s, defineComponent as c, nextTick as l, normalizeClass as u, normalizeStyle as d, onBeforeUnmount as f, onMounted as p, openBlock as m, ref as h, renderList as g, shallowRef as _, toDisplayString as v, unref as y, vShow as b, watch as x, withDirectives as S, withModifiers as C } from "vue";
|
|
3
3
|
//#region src/core/PDFLoader.ts
|
|
4
|
-
function
|
|
4
|
+
function w(t) {
|
|
5
5
|
t && (e.GlobalWorkerOptions.workerSrc = t);
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function T(t = "/pdf.worker.min.mjs") {
|
|
8
8
|
e.GlobalWorkerOptions.workerSrc = t, fetch(t, { method: "HEAD" }).catch(() => {
|
|
9
9
|
e.GlobalWorkerOptions.workerSrc = "https://unpkg.com/pdfjs-dist@5.7.284/legacy/build/pdf.worker.min.mjs";
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
|
-
async function
|
|
12
|
+
async function E(t, n = {}) {
|
|
13
13
|
let r = t instanceof File ? await t.arrayBuffer() : t, i = r.slice(0);
|
|
14
|
-
n.workerSrc &&
|
|
14
|
+
n.workerSrc && w(n.workerSrc);
|
|
15
15
|
let a = await e.getDocument({ data: i }).promise;
|
|
16
16
|
return {
|
|
17
17
|
arrayBuffer: r,
|
|
@@ -21,7 +21,7 @@ async function g(t, n = {}) {
|
|
|
21
21
|
}
|
|
22
22
|
//#endregion
|
|
23
23
|
//#region src/core/TileCache.ts
|
|
24
|
-
var
|
|
24
|
+
var D = class e {
|
|
25
25
|
constructor(e = 100) {
|
|
26
26
|
this.cache = /* @__PURE__ */ new Map(), this.capacity = e;
|
|
27
27
|
}
|
|
@@ -57,82 +57,99 @@ var _ = class e {
|
|
|
57
57
|
get size() {
|
|
58
58
|
return this.cache.size;
|
|
59
59
|
}
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
}, O = () => typeof navigator < "u" && /Mobi|Android|iPhone|iPad/i.test(navigator.userAgent);
|
|
61
|
+
function k(e) {
|
|
62
|
+
let t = window.devicePixelRatio ?? 1;
|
|
63
|
+
return e >= 32 ? 1 : e >= 16 ? Math.min(t, 2) : t;
|
|
64
|
+
}
|
|
65
|
+
function ee(e) {
|
|
66
|
+
return e ? 2048 : 4096;
|
|
65
67
|
}
|
|
66
|
-
var
|
|
67
|
-
async function
|
|
68
|
-
let n = t.scale ?? 1.5, r = t.
|
|
68
|
+
var A = 4096, j = 128;
|
|
69
|
+
async function M(e, t = {}) {
|
|
70
|
+
let n = t.scale ?? 1.5, r = O(), i = t.backgroundColor ?? "rgb(255,255,255)";
|
|
69
71
|
t.cache;
|
|
70
|
-
let
|
|
71
|
-
|
|
72
|
-
let
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
72
|
+
let a = k(n), o = e.getViewport({ scale: n * a }), s = o.width, c = o.height, l = ee(r), u = Math.min(l, A, Math.max(s, c)), d = Math.ceil(s / u), f = Math.ceil(c / u), p = d * f;
|
|
73
|
+
p > j && console.warn(`[PDF-CORE] scale=${n} dpr=${a}, tile=${p} (${d}×${f}), tileSize=${u}px (physical). IntersectionObserver 将按需渲染。`);
|
|
74
|
+
let m = s / a, h = c / a, g = document.createElement("div");
|
|
75
|
+
g.style.cssText = [
|
|
76
|
+
"position:relative",
|
|
77
|
+
`width:${m}px`,
|
|
78
|
+
`height:${h}px`,
|
|
79
|
+
"overflow:hidden",
|
|
80
|
+
`background:${i}`
|
|
81
|
+
].join(";");
|
|
82
|
+
let _ = /* @__PURE__ */ new Set(), v = /* @__PURE__ */ new Set(), y = r ? 2 : 4, b = 0, x = [], S = () => {
|
|
83
|
+
for (; x.length > 0 && b < y;) x.shift()();
|
|
84
|
+
}, C = (t, r, o) => {
|
|
85
|
+
let s = t.dataset.tileKey;
|
|
86
|
+
if (_.has(s) || v.has(s)) return;
|
|
87
|
+
v.add(s), b++;
|
|
88
|
+
let c = t.getContext("2d", { alpha: !1 });
|
|
89
|
+
c.setTransform(1, 0, 0, 1, 0, 0), c.fillStyle = i, c.fillRect(0, 0, t.width, t.height);
|
|
90
|
+
let l = r * u, d = o * u, f = e.getViewport({ scale: n * a });
|
|
91
|
+
c.translate(-l, -d), e.render({
|
|
92
|
+
canvas: t,
|
|
93
|
+
canvasContext: c,
|
|
94
|
+
viewport: f
|
|
95
|
+
}).promise.then(() => {
|
|
96
|
+
_.add(s);
|
|
97
|
+
}).catch(() => {
|
|
98
|
+
c.setTransform(1, 0, 0, 1, 0, 0), c.fillStyle = i, c.fillRect(0, 0, t.width, t.height);
|
|
99
|
+
}).finally(() => {
|
|
100
|
+
v.delete(s), b--, S();
|
|
79
101
|
});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
let [s, c] = t.split(",").map(Number), l = s * r, u = c * r, d = e.getViewport({ scale: n * a }), f = o.getContext("2d");
|
|
91
|
-
f.setTransform(1, 0, 0, 1, 0, 0), f.translate(-l, -u), e.render({
|
|
92
|
-
canvas: o,
|
|
93
|
-
canvasContext: f,
|
|
94
|
-
viewport: d,
|
|
95
|
-
background: i
|
|
96
|
-
}).promise.then(() => {
|
|
97
|
-
m.add(t), h.delete(t);
|
|
98
|
-
}).catch(() => {
|
|
99
|
-
h.delete(t);
|
|
100
|
-
});
|
|
101
|
-
} else {
|
|
102
|
-
let e = o.dataset.tileKey;
|
|
103
|
-
n > 8 && m.has(e) && (o.getContext("2d").clearRect(0, 0, o.width, o.height), m.delete(e));
|
|
102
|
+
}, w = r ? "128px" : "256px", T = r ? 2 : 3, E = new IntersectionObserver((e) => {
|
|
103
|
+
e.forEach((e) => {
|
|
104
|
+
let t = e.target, r = t.dataset.tileKey, [a, o] = (t.dataset.tilePos ?? "0,0").split(",").map(Number);
|
|
105
|
+
if (e.isIntersecting) {
|
|
106
|
+
if (_.has(r) || v.has(r)) return;
|
|
107
|
+
let e = () => C(t, a, o);
|
|
108
|
+
b >= y ? x.push(e) : e();
|
|
109
|
+
} else if (n >= T && _.has(r)) {
|
|
110
|
+
let e = t.getContext("2d", { alpha: !1 });
|
|
111
|
+
e.setTransform(1, 0, 0, 1, 0, 0), e.fillStyle = i, e.fillRect(0, 0, t.width, t.height), _.delete(r);
|
|
104
112
|
}
|
|
105
113
|
});
|
|
106
114
|
}, {
|
|
107
115
|
root: null,
|
|
108
|
-
rootMargin:
|
|
116
|
+
rootMargin: w,
|
|
109
117
|
threshold: 0
|
|
110
|
-
}),
|
|
111
|
-
for (let
|
|
112
|
-
let
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
}), M = [];
|
|
119
|
+
for (let t = 0; t < f; t++) for (let r = 0; r < d; r++) {
|
|
120
|
+
let o = r * u, l = t * u, d = Math.round(Math.min(u, s - o)), f = Math.round(Math.min(u, c - l)), p = o / a, m = l / a, h = d / a, _ = f / a, v = document.createElement("canvas");
|
|
121
|
+
v.width = d, v.height = f;
|
|
122
|
+
let y = v.getContext("2d", { alpha: !1 });
|
|
123
|
+
y.fillStyle = i, y.fillRect(0, 0, d, f), v.style.cssText = [
|
|
124
|
+
"position:absolute",
|
|
125
|
+
`left:${p}px`,
|
|
126
|
+
`top:${m}px`,
|
|
127
|
+
`width:${h}px`,
|
|
128
|
+
`height:${_}px`,
|
|
129
|
+
`background:${i}`
|
|
130
|
+
].join(";"), v.dataset.tileKey = D.makeKey(e.pageNumber, n, r, t), v.dataset.tilePos = `${r},${t}`, g.appendChild(v), E.observe(v), M.push({
|
|
131
|
+
canvas: v,
|
|
132
|
+
col: r,
|
|
133
|
+
row: t,
|
|
134
|
+
x: o,
|
|
135
|
+
y: l,
|
|
136
|
+
cssWidth: h,
|
|
137
|
+
cssHeight: _
|
|
121
138
|
});
|
|
122
139
|
}
|
|
123
140
|
return {
|
|
124
141
|
tiledPage: {
|
|
125
|
-
container:
|
|
126
|
-
pageWidth:
|
|
127
|
-
pageHeight:
|
|
128
|
-
tiles:
|
|
142
|
+
container: g,
|
|
143
|
+
pageWidth: m,
|
|
144
|
+
pageHeight: h,
|
|
145
|
+
tiles: M
|
|
129
146
|
},
|
|
130
|
-
observer:
|
|
147
|
+
observer: E
|
|
131
148
|
};
|
|
132
149
|
}
|
|
133
150
|
//#endregion
|
|
134
151
|
//#region src/core/coords/CoordTransformer.ts
|
|
135
|
-
var
|
|
152
|
+
var te = class {
|
|
136
153
|
constructor(e, t, n) {
|
|
137
154
|
if (this.viewport = e, this.scale = t, this.pageSizePt = n, t <= 0) throw RangeError(`scale 必须大于 0,收到: ${t}`);
|
|
138
155
|
}
|
|
@@ -178,7 +195,7 @@ var S = class {
|
|
|
178
195
|
get pageSize() {
|
|
179
196
|
return this.pageSizePt;
|
|
180
197
|
}
|
|
181
|
-
},
|
|
198
|
+
}, N = [
|
|
182
199
|
5,
|
|
183
200
|
10,
|
|
184
201
|
25,
|
|
@@ -196,13 +213,15 @@ var S = class {
|
|
|
196
213
|
800,
|
|
197
214
|
1200,
|
|
198
215
|
1600,
|
|
199
|
-
|
|
200
|
-
|
|
216
|
+
1800,
|
|
217
|
+
2e3,
|
|
218
|
+
2200,
|
|
219
|
+
2800
|
|
201
220
|
];
|
|
202
|
-
function
|
|
203
|
-
return t === "in" ?
|
|
221
|
+
function P(e, t) {
|
|
222
|
+
return t === "in" ? N.find((t) => t > e) ?? N[N.length - 1] : [...N].reverse().find((t) => t < e) ?? N[0];
|
|
204
223
|
}
|
|
205
|
-
var
|
|
224
|
+
var F = class {
|
|
206
225
|
constructor() {
|
|
207
226
|
this.interaction = null, this.toolManager = null, this.drawCallback = null, this.domContainerId = null, this.zoomCtrl = null, this.initialScale = 1.5;
|
|
208
227
|
}
|
|
@@ -240,12 +259,12 @@ var T = class {
|
|
|
240
259
|
}
|
|
241
260
|
zoomIn() {
|
|
242
261
|
if (!this.zoomCtrl) return;
|
|
243
|
-
let e = this.zoomCtrl.getScale(), t =
|
|
262
|
+
let e = this.zoomCtrl.getScale(), t = P(Math.round(e * 100), "in");
|
|
244
263
|
this.zoomCtrl.setScale(t / 100);
|
|
245
264
|
}
|
|
246
265
|
zoomOut() {
|
|
247
266
|
if (!this.zoomCtrl) return;
|
|
248
|
-
let e = this.zoomCtrl.getScale(), t =
|
|
267
|
+
let e = this.zoomCtrl.getScale(), t = P(Math.round(e * 100), "out");
|
|
249
268
|
this.zoomCtrl.setScale(t / 100);
|
|
250
269
|
}
|
|
251
270
|
setScale(e) {
|
|
@@ -257,10 +276,11 @@ var T = class {
|
|
|
257
276
|
getScalePercent() {
|
|
258
277
|
return Math.round((this.zoomCtrl?.getScale() ?? 1) * 100);
|
|
259
278
|
}
|
|
260
|
-
resetView() {
|
|
261
|
-
this.zoomCtrl && this.zoomCtrl.setScale(this.initialScale);
|
|
262
|
-
|
|
263
|
-
|
|
279
|
+
async resetView() {
|
|
280
|
+
this.zoomCtrl && await this.zoomCtrl.setScale(this.initialScale), this.zoomCtrl?.resetPosition();
|
|
281
|
+
}
|
|
282
|
+
toggleTheme() {
|
|
283
|
+
this.zoomCtrl?.toggleTheme();
|
|
264
284
|
}
|
|
265
285
|
getAnnotations() {
|
|
266
286
|
return this.toolManager ? this.toolManager.measureTool.getResults().map((e) => ({
|
|
@@ -305,7 +325,7 @@ var T = class {
|
|
|
305
325
|
};
|
|
306
326
|
//#endregion
|
|
307
327
|
//#region src/annotations/utils.ts
|
|
308
|
-
function
|
|
328
|
+
function I(e, t = 0, n = "px") {
|
|
309
329
|
return {
|
|
310
330
|
id: `measure-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
311
331
|
kind: "measure",
|
|
@@ -317,7 +337,7 @@ function E(e, t = 0, n = "px") {
|
|
|
317
337
|
createdAt: Date.now()
|
|
318
338
|
};
|
|
319
339
|
}
|
|
320
|
-
function
|
|
340
|
+
function L(e, t = "rectangle") {
|
|
321
341
|
return {
|
|
322
342
|
id: `shape-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
323
343
|
kind: "shape",
|
|
@@ -328,12 +348,12 @@ function D(e, t = "rectangle") {
|
|
|
328
348
|
createdAt: Date.now()
|
|
329
349
|
};
|
|
330
350
|
}
|
|
331
|
-
function
|
|
351
|
+
function R(e) {
|
|
332
352
|
return JSON.parse(JSON.stringify(e));
|
|
333
353
|
}
|
|
334
354
|
//#endregion
|
|
335
355
|
//#region src/utils/EventTrigger.ts
|
|
336
|
-
var
|
|
356
|
+
var z = class {
|
|
337
357
|
constructor() {
|
|
338
358
|
this._events = /* @__PURE__ */ new Map();
|
|
339
359
|
}
|
|
@@ -371,59 +391,68 @@ var k = class {
|
|
|
371
391
|
destroy() {
|
|
372
392
|
this._events.clear();
|
|
373
393
|
}
|
|
374
|
-
};
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
function A(e = {}) {
|
|
378
|
-
let t = u(null), n = d(null), r = d(null), i = u(0), a = u(1), o = u(e.scale ?? 1.5), s = e.backgroundColor ?? "rgb(255,255,255)", c = u(!1), l = u(null), f = new k(), p = new _(100), m = !1, h = null, v = null, y = null, b = null, S = async (e) => {
|
|
394
|
+
}, B = () => typeof navigator < "u" && /Mobi|Android|iPhone|iPad/i.test(navigator.userAgent);
|
|
395
|
+
function V(e = {}) {
|
|
396
|
+
let t = h(null), n = _(null), r = _(null), i = h(0), a = h(1), o = h(e.scale ?? 1.5), s = h(e.backgroundColor ?? "rgb(255,255,255)"), c = h(!1), l = h(null), u = new z(), d = new D(B() ? 30 : 100), f = !1, p = 0, m = null, g = B() ? 200 : 60, v = null, y = null, b = null, x = async (e) => {
|
|
379
397
|
c.value = !0, l.value = null;
|
|
380
398
|
try {
|
|
381
|
-
let t = await
|
|
382
|
-
n.value = t.doc, i.value = t.pageCount, a.value = 1, await
|
|
399
|
+
let t = await E(e);
|
|
400
|
+
n.value = t.doc, i.value = t.pageCount, a.value = 1, await S(), u.emit("loaded", {
|
|
383
401
|
pageCount: t.pageCount,
|
|
384
402
|
currentPage: 1
|
|
385
403
|
});
|
|
386
404
|
} catch (e) {
|
|
387
405
|
let t = e instanceof Error ? e.message : "Failed to load PDF";
|
|
388
|
-
l.value = t,
|
|
406
|
+
l.value = t, u.emit("error_occurred", { message: t });
|
|
389
407
|
} finally {
|
|
390
408
|
c.value = !1;
|
|
391
409
|
}
|
|
392
|
-
},
|
|
393
|
-
if (!
|
|
394
|
-
|
|
410
|
+
}, S = async () => {
|
|
411
|
+
if (!n.value || !t.value) return;
|
|
412
|
+
let e = ++p;
|
|
413
|
+
if (!f) {
|
|
414
|
+
f = !0;
|
|
395
415
|
try {
|
|
396
|
-
|
|
397
|
-
let
|
|
398
|
-
|
|
399
|
-
|
|
416
|
+
m &&= (m.disconnect(), null);
|
|
417
|
+
let i = await n.value.getPage(a.value);
|
|
418
|
+
if (e !== p) {
|
|
419
|
+
f = !1;
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
r.value = i;
|
|
423
|
+
let { tiledPage: c, observer: l } = await M(i, {
|
|
400
424
|
scale: o.value,
|
|
401
|
-
cache:
|
|
402
|
-
backgroundColor: s
|
|
425
|
+
cache: d,
|
|
426
|
+
backgroundColor: s.value
|
|
403
427
|
});
|
|
404
|
-
|
|
428
|
+
if (e !== p) {
|
|
429
|
+
l.disconnect(), f = !1;
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
m = l, t.value.replaceChildren(c.container), u.emit("render_complete", {
|
|
405
433
|
pageNum: a.value,
|
|
406
434
|
scale: o.value
|
|
407
435
|
});
|
|
408
436
|
} catch (e) {
|
|
409
|
-
console.error("[PDF-CORE] renderCurrentPage failed:", e),
|
|
437
|
+
console.error("[PDF-CORE] renderCurrentPage failed:", e), u.emit("error_occurred", { message: e instanceof Error ? e.message : "Render failed" });
|
|
410
438
|
} finally {
|
|
411
|
-
|
|
439
|
+
f = !1, p > e && S();
|
|
412
440
|
}
|
|
413
441
|
}
|
|
414
442
|
};
|
|
415
|
-
return
|
|
443
|
+
return {
|
|
416
444
|
containerRef: t,
|
|
417
445
|
doc: n,
|
|
418
446
|
page: r,
|
|
419
447
|
pageCount: i,
|
|
420
448
|
currentPageNum: a,
|
|
421
449
|
currentScale: o,
|
|
450
|
+
backgroundColor: s,
|
|
422
451
|
isLoading: c,
|
|
423
452
|
error: l,
|
|
424
|
-
events:
|
|
425
|
-
loadFile:
|
|
426
|
-
renderCurrentPage:
|
|
453
|
+
events: u,
|
|
454
|
+
loadFile: x,
|
|
455
|
+
renderCurrentPage: S,
|
|
427
456
|
setScale: (e) => new Promise((t) => {
|
|
428
457
|
if (e <= 0) {
|
|
429
458
|
t();
|
|
@@ -436,28 +465,33 @@ function A(e = {}) {
|
|
|
436
465
|
t?.();
|
|
437
466
|
return;
|
|
438
467
|
}
|
|
439
|
-
|
|
468
|
+
d.clear();
|
|
469
|
+
let r = o.value;
|
|
470
|
+
o.value = e, n.value && await S(), t?.(), u.emit("scale_changed", {
|
|
440
471
|
scale: e,
|
|
441
|
-
previousScale:
|
|
472
|
+
previousScale: r
|
|
442
473
|
});
|
|
443
|
-
},
|
|
474
|
+
}, g);
|
|
475
|
+
}),
|
|
476
|
+
setBackgroundColor: (e) => new Promise((t) => {
|
|
477
|
+
s.value = e, d.clear(), n.value ? S().then(() => t()) : t();
|
|
444
478
|
}),
|
|
445
479
|
reset: () => {
|
|
446
|
-
n.value = null, r.value = null, i.value = 0, a.value = 1, l.value = null, c.value = !1, t.value && t.value.replaceChildren(),
|
|
480
|
+
m &&= (m.disconnect(), null), v !== null && (clearTimeout(v), v = null), b?.(), y = null, b = null, d.clear(), n.value = null, r.value = null, i.value = 0, a.value = 1, l.value = null, c.value = !1, f = !1, t.value && t.value.replaceChildren(), u.emit("cleared");
|
|
447
481
|
}
|
|
448
482
|
};
|
|
449
483
|
}
|
|
450
484
|
//#endregion
|
|
451
485
|
//#region src/vue/useAnnotations.ts
|
|
452
|
-
function
|
|
453
|
-
let e =
|
|
486
|
+
function H() {
|
|
487
|
+
let e = h([]);
|
|
454
488
|
return {
|
|
455
489
|
annotations: e,
|
|
456
490
|
addMeasureAnnotation: (t, n = 0, r = "px") => {
|
|
457
|
-
e.value = [...e.value,
|
|
491
|
+
e.value = [...e.value, I(t, n, r)];
|
|
458
492
|
},
|
|
459
493
|
addShapeAnnotation: (t, n = "rectangle") => {
|
|
460
|
-
e.value = [...e.value,
|
|
494
|
+
e.value = [...e.value, L(t, n)];
|
|
461
495
|
},
|
|
462
496
|
removeAnnotation: (t) => {
|
|
463
497
|
e.value = e.value.filter((e) => e.id !== t);
|
|
@@ -466,14 +500,14 @@ function j() {
|
|
|
466
500
|
e.value = [];
|
|
467
501
|
},
|
|
468
502
|
replaceAnnotations: (t) => {
|
|
469
|
-
e.value = t.map(
|
|
503
|
+
e.value = t.map(R);
|
|
470
504
|
}
|
|
471
505
|
};
|
|
472
506
|
}
|
|
473
507
|
//#endregion
|
|
474
508
|
//#region src/vue/useMeasurement.ts
|
|
475
|
-
function
|
|
476
|
-
let e =
|
|
509
|
+
function U() {
|
|
510
|
+
let e = h([]);
|
|
477
511
|
return {
|
|
478
512
|
points: e,
|
|
479
513
|
addPoint: (t) => {
|
|
@@ -482,7 +516,7 @@ function M() {
|
|
|
482
516
|
clearPoints: () => {
|
|
483
517
|
e.value = [];
|
|
484
518
|
},
|
|
485
|
-
distance:
|
|
519
|
+
distance: n(() => {
|
|
486
520
|
if (e.value.length < 2) return 0;
|
|
487
521
|
let [t, n] = e.value.slice(-2);
|
|
488
522
|
return Math.hypot(n.x - t.x, n.y - t.y);
|
|
@@ -491,8 +525,8 @@ function M() {
|
|
|
491
525
|
}
|
|
492
526
|
//#endregion
|
|
493
527
|
//#region src/vue/useInteraction.ts
|
|
494
|
-
function
|
|
495
|
-
let { annotations: e, addMeasureAnnotation: t, clearAnnotations: n } =
|
|
528
|
+
function W() {
|
|
529
|
+
let { annotations: e, addMeasureAnnotation: t, clearAnnotations: n } = H(), { points: r, addPoint: i, clearPoints: a, distance: o } = U(), s = h(!1);
|
|
496
530
|
return {
|
|
497
531
|
points: r,
|
|
498
532
|
annotations: e,
|
|
@@ -513,7 +547,7 @@ function N() {
|
|
|
513
547
|
}
|
|
514
548
|
//#endregion
|
|
515
549
|
//#region src/components/interaction.ts
|
|
516
|
-
function
|
|
550
|
+
function G() {
|
|
517
551
|
let e = [], t = [], n = "none", r = null;
|
|
518
552
|
return {
|
|
519
553
|
get points() {
|
|
@@ -533,11 +567,11 @@ function P() {
|
|
|
533
567
|
},
|
|
534
568
|
addPoint(i) {
|
|
535
569
|
if (e = [...e, i], n === "measure" && e.length >= 2) {
|
|
536
|
-
let n =
|
|
570
|
+
let n = I([e[e.length - 2], e[e.length - 1]], Math.hypot(e[e.length - 1].x - e[e.length - 2].x, e[e.length - 1].y - e[e.length - 2].y));
|
|
537
571
|
return t = [...t, n], r = n.id, e = [], n;
|
|
538
572
|
}
|
|
539
573
|
if (n === "rectangle" && e.length >= 2) {
|
|
540
|
-
let n =
|
|
574
|
+
let n = L([e[e.length - 2], e[e.length - 1]], "rectangle");
|
|
541
575
|
return t = [...t, n], r = n.id, e = [], n;
|
|
542
576
|
}
|
|
543
577
|
return null;
|
|
@@ -559,67 +593,71 @@ function P() {
|
|
|
559
593
|
}
|
|
560
594
|
//#endregion
|
|
561
595
|
//#region src/components/useAnnotationCanvas.ts
|
|
562
|
-
function
|
|
563
|
-
let { annotationCanvas: t, rootRef: n,
|
|
596
|
+
function K(e) {
|
|
597
|
+
let { annotationCanvas: t, rootRef: n, pdfLayerRef: r, interaction: i, previewPoint: a } = e, o = (e) => {
|
|
564
598
|
let t = e.currentTarget.getBoundingClientRect();
|
|
565
599
|
return {
|
|
566
600
|
x: e.clientX - t.left,
|
|
567
601
|
y: e.clientY - t.top
|
|
568
602
|
};
|
|
569
|
-
},
|
|
603
|
+
}, s = (e, t, n) => {
|
|
570
604
|
let r = n.x - t.x, i = n.y - t.y, a = r * r + i * i;
|
|
571
605
|
if (a === 0) return Math.hypot(e.x - t.x, e.y - t.y);
|
|
572
|
-
let o = Math.max(0, Math.min(1, ((e.x - t.x) * r + (e.y - t.y) * i) / a))
|
|
573
|
-
return Math.hypot(e.x -
|
|
574
|
-
},
|
|
606
|
+
let o = Math.max(0, Math.min(1, ((e.x - t.x) * r + (e.y - t.y) * i) / a));
|
|
607
|
+
return Math.hypot(e.x - (t.x + o * r), e.y - (t.y + o * i));
|
|
608
|
+
}, c = (e, t) => {
|
|
575
609
|
if (t.kind === "measure") {
|
|
576
610
|
let [n, r] = t.points;
|
|
577
|
-
return
|
|
611
|
+
return s(e, n, r) <= 8;
|
|
578
612
|
}
|
|
579
613
|
if (t.kind === "shape" && t.shapeType === "rectangle") {
|
|
580
614
|
let [n, r] = t.points, i = Math.min(n.x, r.x), a = Math.min(n.y, r.y), o = Math.abs(n.x - r.x), s = Math.abs(n.y - r.y);
|
|
581
615
|
return e.x >= i - 4 && e.x <= i + o + 4 && e.y >= a - 4 && e.y <= a + s + 4;
|
|
582
616
|
}
|
|
583
617
|
return !1;
|
|
584
|
-
},
|
|
618
|
+
}, l = () => {
|
|
585
619
|
if (!t.value) return;
|
|
586
620
|
let e = t.value.getContext("2d");
|
|
587
|
-
e && (e.clearRect(0, 0, t.value.width, t.value.height),
|
|
588
|
-
let n = t.id ===
|
|
589
|
-
t.kind === "measure" &&
|
|
590
|
-
}),
|
|
591
|
-
},
|
|
621
|
+
e && (e.clearRect(0, 0, t.value.width, t.value.height), i.annotations.forEach((t) => {
|
|
622
|
+
let n = t.id === i.selectedAnnotationId, r = t.color ?? (t.kind === "measure" ? "#10b981" : "#3b82f6"), a = (t.strokeWidth ?? 2) + (n ? 2 : 0);
|
|
623
|
+
t.kind === "measure" && u(e, t, n, r, a), t.kind === "shape" && t.shapeType === "rectangle" && d(e, t, n, r, a);
|
|
624
|
+
}), a.value && i.points.length === 1 && f(e));
|
|
625
|
+
}, u = (e, t, n, r, i) => {
|
|
592
626
|
let [a, o] = t.points;
|
|
593
627
|
e.save(), e.strokeStyle = n ? "#ef4444" : r, e.lineWidth = i, e.setLineDash(n ? [6, 4] : []), e.beginPath(), e.moveTo(a.x, a.y), e.lineTo(o.x, o.y), e.stroke(), e.setLineDash([]), e.fillStyle = n ? "#ef4444" : r, e.beginPath(), e.arc(a.x, a.y, n ? 4 : 3, 0, Math.PI * 2), e.arc(o.x, o.y, n ? 4 : 3, 0, Math.PI * 2), e.fill(), e.font = "12px sans-serif", e.fillText(t.label ?? `${t.value?.toFixed(1) ?? 0}`, o.x + 6, o.y - 6), e.restore();
|
|
594
|
-
},
|
|
628
|
+
}, d = (e, t, n, r, i) => {
|
|
595
629
|
let [a, o] = t.points, s = Math.min(a.x, o.x), c = Math.min(a.y, o.y), l = Math.abs(a.x - o.x), u = Math.abs(a.y - o.y);
|
|
596
630
|
e.save(), e.strokeStyle = n ? "#ef4444" : r, e.lineWidth = i, e.setLineDash(n ? [6, 4] : []), e.strokeRect(s, c, l, u), e.fillStyle = n ? "rgba(239, 68, 68, 0.12)" : "rgba(59, 130, 246, 0.12)", e.fillRect(s, c, l, u), e.setLineDash([]), e.fillStyle = n ? "#ef4444" : r, e.font = "12px sans-serif", e.fillText(t.label ?? "", s + 6, c + 16), e.restore();
|
|
597
|
-
},
|
|
598
|
-
let t =
|
|
599
|
-
if (e.save(), e.strokeStyle =
|
|
600
|
-
else if (
|
|
601
|
-
let r = Math.min(t.x, n.x), i = Math.min(t.y, n.y)
|
|
602
|
-
e.strokeRect(r, i,
|
|
631
|
+
}, f = (e) => {
|
|
632
|
+
let t = i.points[0], n = a.value;
|
|
633
|
+
if (e.save(), e.strokeStyle = i.mode === "measure" ? "#8b5cf6" : "#2563eb", e.lineWidth = 2, e.setLineDash([6, 4]), i.mode === "measure") e.beginPath(), e.moveTo(t.x, t.y), e.lineTo(n.x, n.y), e.stroke(), e.beginPath(), e.arc(t.x, t.y, 3, 0, Math.PI * 2), e.arc(n.x, n.y, 3, 0, Math.PI * 2), e.fillStyle = "#8b5cf6", e.fill();
|
|
634
|
+
else if (i.mode === "rectangle") {
|
|
635
|
+
let r = Math.min(t.x, n.x), i = Math.min(t.y, n.y);
|
|
636
|
+
e.strokeRect(r, i, Math.abs(t.x - n.x), Math.abs(t.y - n.y));
|
|
603
637
|
}
|
|
604
638
|
e.restore();
|
|
605
639
|
};
|
|
606
640
|
return {
|
|
607
|
-
getCanvasPoint:
|
|
608
|
-
getDistanceToSegment:
|
|
609
|
-
hitTestAnnotation:
|
|
610
|
-
drawAnnotations:
|
|
641
|
+
getCanvasPoint: o,
|
|
642
|
+
getDistanceToSegment: s,
|
|
643
|
+
hitTestAnnotation: c,
|
|
644
|
+
drawAnnotations: l,
|
|
611
645
|
syncCanvasSize: () => {
|
|
612
|
-
if (!
|
|
613
|
-
let e =
|
|
614
|
-
|
|
615
|
-
let i =
|
|
616
|
-
|
|
646
|
+
if (!t.value) return;
|
|
647
|
+
let e = r?.value ?? n.value;
|
|
648
|
+
if (!e) return;
|
|
649
|
+
let i = e.scrollWidth || e.offsetWidth, a = e.scrollHeight || e.offsetHeight;
|
|
650
|
+
if (i === 0 || a === 0) return;
|
|
651
|
+
let o = t.value, s = window.devicePixelRatio || 1;
|
|
652
|
+
(o.width !== Math.round(i * s) || o.height !== Math.round(a * s)) && (o.width = Math.round(i * s), o.height = Math.round(a * s)), o.style.width = `${i}px`, o.style.height = `${a}px`;
|
|
653
|
+
let c = o.getContext("2d");
|
|
654
|
+
c && c.setTransform(s, 0, 0, s, 0, 0);
|
|
617
655
|
}
|
|
618
656
|
};
|
|
619
657
|
}
|
|
620
658
|
//#endregion
|
|
621
659
|
//#region src/components/usePointerInteraction.ts
|
|
622
|
-
function
|
|
660
|
+
function ne(e) {
|
|
623
661
|
let { annotationCanvas: t, interaction: n, previewPoint: r, isRectangleDragging: i, getCanvasPoint: a, hitTestAnnotation: o, drawAnnotations: s, deleteSelectedAnnotation: c, emit: l } = e;
|
|
624
662
|
return {
|
|
625
663
|
handlePointerDown: (e) => {
|
|
@@ -684,88 +722,158 @@ function I(e) {
|
|
|
684
722
|
}
|
|
685
723
|
//#endregion
|
|
686
724
|
//#region src/components/useViewerLayout.ts
|
|
687
|
-
var
|
|
688
|
-
if (e.length < 2) return 0;
|
|
689
|
-
let t = e[0].clientX - e[1].clientX, n = e[0].clientY - e[1].clientY;
|
|
690
|
-
return Math.hypot(t, n);
|
|
691
|
-
}, R = (e) => ({
|
|
725
|
+
var q = (e, t, n) => Math.max(t, Math.min(n, e)), J = (e) => Math.hypot(e[0].clientX - e[1].clientX, e[0].clientY - e[1].clientY), Y = (e) => ({
|
|
692
726
|
x: (e[0].clientX + e[1].clientX) / 2,
|
|
693
727
|
y: (e[0].clientY + e[1].clientY) / 2
|
|
694
|
-
}),
|
|
695
|
-
let t =
|
|
696
|
-
for (let r = 1; r <
|
|
697
|
-
let i = Math.abs(e -
|
|
698
|
-
i < n && (n = i, t =
|
|
728
|
+
}), X = (e) => {
|
|
729
|
+
let t = N[0], n = Math.abs(e - t);
|
|
730
|
+
for (let r = 1; r < N.length; r++) {
|
|
731
|
+
let i = Math.abs(e - N[r]);
|
|
732
|
+
i < n && (n = i, t = N[r]);
|
|
699
733
|
}
|
|
700
734
|
return t;
|
|
701
|
-
};
|
|
702
|
-
function
|
|
703
|
-
let { viewerRef:
|
|
735
|
+
}, Z = () => typeof navigator < "u" && /Mobi|Android|iPhone|iPad/i.test(navigator.userAgent);
|
|
736
|
+
function re(e) {
|
|
737
|
+
let { viewerRef: t, rootRef: r, pdfLayerRef: i, currentScale: a, setScale: o, zoomSpeed: s, theme: c, syncCanvasSize: l, drawAnnotations: u } = e, d = 0, f = 0, p = a.value, m = 1, g = null, _ = () => {
|
|
738
|
+
let e = r.value;
|
|
739
|
+
e && (e.style.transformOrigin = "0 0", m === 1 ? e.style.transform = `translate(${d}px, ${f}px)` : e.style.transform = `translate(${d}px, ${f}px) scale(${m})`);
|
|
740
|
+
}, v = () => {
|
|
741
|
+
let e = i.value;
|
|
742
|
+
return e ? {
|
|
743
|
+
w: e.scrollWidth || e.offsetWidth,
|
|
744
|
+
h: e.scrollHeight || e.offsetHeight
|
|
745
|
+
} : {
|
|
746
|
+
w: 0,
|
|
747
|
+
h: 0
|
|
748
|
+
};
|
|
749
|
+
}, y = (e, n) => {
|
|
750
|
+
let r = t.value;
|
|
751
|
+
if (!r) return {
|
|
752
|
+
ntx: e,
|
|
753
|
+
nty: n
|
|
754
|
+
};
|
|
755
|
+
let i = r.clientWidth, a = r.clientHeight, { w: o, h: s } = v(), c = o * m, l = s * m;
|
|
756
|
+
return {
|
|
757
|
+
ntx: q(e, -(c - 80), i - 80),
|
|
758
|
+
nty: q(n, -(l - 80), a - 80)
|
|
759
|
+
};
|
|
760
|
+
}, b = () => {
|
|
761
|
+
let e = t.value;
|
|
762
|
+
if (!e) return;
|
|
763
|
+
let { w: n, h: r } = v(), i = n * m, a = r * m;
|
|
764
|
+
d = Math.max(0, (e.clientWidth - i) / 2), f = Math.max(0, (e.clientHeight - a) / 2), _();
|
|
765
|
+
}, x = (e = !1) => {
|
|
766
|
+
let t = r.value;
|
|
767
|
+
t && (t.style.position = "absolute", t.style.top = "0", t.style.left = "0", t.style.width = "auto", t.style.height = "auto"), e ? requestAnimationFrame(() => requestAnimationFrame(() => {
|
|
768
|
+
b(), l(), u();
|
|
769
|
+
})) : (_(), l(), u());
|
|
770
|
+
}, S = n(() => ({
|
|
771
|
+
width: "100%",
|
|
772
|
+
height: "100%",
|
|
773
|
+
background: c.value === "dark" ? "#1e1e1e" : "#ffffff",
|
|
774
|
+
overflow: "hidden",
|
|
775
|
+
borderRadius: "8px",
|
|
776
|
+
border: c.value === "dark" ? "1px solid #374151" : "1px solid #e2e8f0",
|
|
777
|
+
position: "relative",
|
|
778
|
+
touchAction: "none",
|
|
779
|
+
display: "block"
|
|
780
|
+
})), C = h(!1), w = 0, T = 0, E = 0, D = 0, O = null, k = null, ee = (e) => {
|
|
781
|
+
e.button === 0 && (C.value = !0, w = e.clientX, T = e.clientY, E = d, D = f, O = (e) => {
|
|
782
|
+
if (!C.value) return;
|
|
783
|
+
let { ntx: t, nty: n } = y(E + e.clientX - w, D + e.clientY - T);
|
|
784
|
+
d = t, f = n, _();
|
|
785
|
+
}, k = () => {
|
|
786
|
+
C.value = !1, window.removeEventListener("mousemove", O), window.removeEventListener("mouseup", k), O = null, k = null;
|
|
787
|
+
}, window.addEventListener("mousemove", O), window.addEventListener("mouseup", k), e.preventDefault());
|
|
788
|
+
}, A = () => {
|
|
789
|
+
C.value = !1, O &&= (window.removeEventListener("mousemove", O), null), k &&= (window.removeEventListener("mouseup", k), null);
|
|
790
|
+
}, j = (e, t) => {
|
|
791
|
+
g = e;
|
|
792
|
+
let n = m, r = d, i = f, { w: a, h: s } = v();
|
|
793
|
+
o(t).then(() => {
|
|
794
|
+
if (g !== e) return;
|
|
795
|
+
g = null;
|
|
796
|
+
let o = e / t, { w: c, h } = v(), b = a * n, x = s * n, S = c * o, C = h * o;
|
|
797
|
+
d = r + (b - S) / 2, f = i + (x - C) / 2, p = t, m = o;
|
|
798
|
+
let { ntx: w, nty: T } = y(d, f);
|
|
799
|
+
d = w, f = T, _(), l(), u();
|
|
800
|
+
});
|
|
801
|
+
}, M = null, te = (e) => {
|
|
802
|
+
e.preventDefault();
|
|
803
|
+
let n = t.value;
|
|
804
|
+
if (!n) return;
|
|
805
|
+
let r = e.deltaY < 0 ? "in" : "out", i = Math.max(1, s ?? 1), a = p * m, o = Math.round(a * 100);
|
|
806
|
+
for (let e = 0; e < i; e++) {
|
|
807
|
+
let e = P(o, r);
|
|
808
|
+
if (e === o) break;
|
|
809
|
+
o = e;
|
|
810
|
+
}
|
|
811
|
+
let c = o / 100;
|
|
812
|
+
if (Math.abs(c - a) < .001) return;
|
|
813
|
+
let l = n.getBoundingClientRect(), u = e.clientX - l.left, h = e.clientY - l.top, g = c / a;
|
|
814
|
+
d = u - (u - d) * g, f = h - (h - f) * g, m = c / p;
|
|
815
|
+
let { ntx: v, nty: b } = y(d, f);
|
|
816
|
+
d = v, f = b, _(), M !== null && cancelAnimationFrame(M), M = requestAnimationFrame(() => {
|
|
817
|
+
M = null;
|
|
818
|
+
let e = Z() ? Math.min(c, 8) : c;
|
|
819
|
+
j(c, e);
|
|
820
|
+
});
|
|
821
|
+
}, F = 0, I = 0, L = 0, R = 0, z = !1, B = 0, V = 0, H = 0, U = 0, W = null, G = 0, K = null;
|
|
704
822
|
return {
|
|
705
|
-
containerStyle:
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
background: c === "dark" ? "#1e1e1e" : "#ffffff",
|
|
709
|
-
overflow: "auto",
|
|
710
|
-
borderRadius: "8px",
|
|
711
|
-
border: c === "dark" ? "1px solid #374151" : "1px solid #e2e8f0",
|
|
712
|
-
position: "relative",
|
|
713
|
-
touchAction: "pan-x pan-y",
|
|
714
|
-
display: "flex"
|
|
715
|
-
})),
|
|
716
|
-
adjustLayout: (e = !1) => {
|
|
717
|
-
let t = n.value, a = r.value, o = i.value;
|
|
718
|
-
if (!t || !a || !o) return;
|
|
719
|
-
let s = t.clientWidth, c = t.clientHeight, d = o.scrollWidth || s, f = o.scrollHeight || c, p = Math.max(d, s * 1.5), m = Math.max(f, c * 1.5);
|
|
720
|
-
a.style.width = `${p}px`, a.style.height = `${m}px`, e && (t.scrollLeft = p - s, t.scrollTop = (m - c) / 2), l(), u();
|
|
721
|
-
},
|
|
722
|
-
handleWheel: (e) => {
|
|
723
|
-
e.preventDefault();
|
|
724
|
-
let t = n.value, c = r.value, l = i.value;
|
|
725
|
-
if (!t || !c || !l) return;
|
|
726
|
-
let u = e.deltaY < 0 ? "in" : "out", d = Math.max(1, s ?? 1), f = Math.round(a.value * 100);
|
|
727
|
-
for (let e = 0; e < d; e++) {
|
|
728
|
-
let e = w(f, u);
|
|
729
|
-
if (e === f) break;
|
|
730
|
-
f = e;
|
|
731
|
-
}
|
|
732
|
-
let p = f / 100;
|
|
733
|
-
if (p === a.value) return;
|
|
734
|
-
let m = a.value, h = p / m, g = t.getBoundingClientRect(), _ = e.clientX - g.left, v = e.clientY - g.top, y = _ + t.scrollLeft, b = v + t.scrollTop, x = l.scrollWidth, S = l.scrollHeight, C = x / m, T = S / m, E = C * p, D = T * p, O = t.clientWidth, k = t.clientHeight, A = y * h - _, j = b * h - v;
|
|
735
|
-
c.style.width = `${Math.max(E, A + O, O * 1.5)}px`, c.style.height = `${Math.max(D, j + k, k * 1.5)}px`, c.offsetWidth, t.scrollLeft = A, t.scrollTop = j, o(p);
|
|
736
|
-
},
|
|
823
|
+
containerStyle: S,
|
|
824
|
+
adjustLayout: x,
|
|
825
|
+
handleWheel: te,
|
|
737
826
|
handleTouchStart: (e) => {
|
|
738
|
-
e.touches.length ===
|
|
827
|
+
e.touches.length === 1 ? (z = !0, F = e.touches[0].clientX, I = e.touches[0].clientY, L = d, R = f, B = 0, W = null) : e.touches.length === 2 && (z = !1, K !== null && (clearTimeout(K), K = null), B = J(e.touches), V = p * m, W = Y(e.touches), H = d, U = f, G = V);
|
|
739
828
|
},
|
|
740
829
|
handleTouchMove: (e) => {
|
|
741
|
-
if (e.touches.length
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
if (
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
830
|
+
if (e.preventDefault(), e.touches.length === 1 && z) {
|
|
831
|
+
let t = e.touches[0].clientX - F, n = e.touches[0].clientY - I, { ntx: r, nty: i } = y(L + t, R + n);
|
|
832
|
+
d = r, f = i, _();
|
|
833
|
+
} else if (e.touches.length === 2 && B > 0 && W) {
|
|
834
|
+
let n = t.value;
|
|
835
|
+
if (!n) return;
|
|
836
|
+
let r = J(e.touches), i = Y(e.touches);
|
|
837
|
+
if (Math.abs(r - B) < 1) return;
|
|
838
|
+
let a = q(r / B * V, N[0] / 100, N[N.length - 1] / 100);
|
|
839
|
+
G = a;
|
|
840
|
+
let o = n.getBoundingClientRect(), s = W.x - o.left, c = W.y - o.top, l = a / V, u = i.x - W.x, h = i.y - W.y, g = s - (s - H) * l + u, v = c - (c - U) * l + h;
|
|
841
|
+
m = a / p;
|
|
842
|
+
let { ntx: b, nty: x } = y(g, v);
|
|
843
|
+
d = b, f = x, _(), Z() || (K !== null && clearTimeout(K), K = setTimeout(() => {
|
|
844
|
+
K = null;
|
|
845
|
+
let e = X(Math.round(G * 100)) / 100;
|
|
846
|
+
j(e, e);
|
|
847
|
+
}, 300));
|
|
848
|
+
}
|
|
849
|
+
},
|
|
850
|
+
handleTouchEnd: (e) => {
|
|
851
|
+
let t = e.touches.length;
|
|
852
|
+
if (t === 0) {
|
|
853
|
+
if (B > 0 && G > 0) {
|
|
854
|
+
let e = X(Math.round(G * 100)) / 100, t = Z() ? Math.min(e, 8) : e;
|
|
855
|
+
K !== null && (clearTimeout(K), K = null), j(e, t);
|
|
754
856
|
}
|
|
755
|
-
|
|
857
|
+
z = !1, B = 0, W = null, G = 0;
|
|
858
|
+
} else if (t === 1) {
|
|
859
|
+
if (B > 0 && G > 0) {
|
|
860
|
+
let e = X(Math.round(G * 100)) / 100, t = Z() ? Math.min(e, 8) : e;
|
|
861
|
+
K !== null && (clearTimeout(K), K = null), j(e, t);
|
|
862
|
+
}
|
|
863
|
+
z = !0, B = 0, W = null, G = 0, F = e.touches[0].clientX, I = e.touches[0].clientY, L = d, R = f;
|
|
756
864
|
}
|
|
757
865
|
},
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
866
|
+
handleMouseDown: ee,
|
|
867
|
+
isMouseDragging: C,
|
|
868
|
+
cleanupMouseDrag: A
|
|
761
869
|
};
|
|
762
870
|
}
|
|
763
871
|
//#endregion
|
|
764
872
|
//#region src/types/tools.ts
|
|
765
|
-
var
|
|
873
|
+
var ie = {
|
|
766
874
|
mode: "none",
|
|
767
875
|
measureSubType: "distance"
|
|
768
|
-
},
|
|
876
|
+
}, Q = class {
|
|
769
877
|
constructor(e) {
|
|
770
878
|
this.TOOLNAME = "measure", this._active = !1, this._isStart = !1, this._isEnd = !1, this._isMeasuring = !1, this._isDragging = !1, this._startPoint = null, this._endPoint = null, this._points = [], this._measureList = /* @__PURE__ */ new Map(), this._dragStart = null, this._dragThreshold = 3, this.coordProvider = e.coordProvider, this.calibration = e.calibration ?? {
|
|
771
879
|
scale: 1,
|
|
@@ -850,7 +958,7 @@ var V = {
|
|
|
850
958
|
destroy() {
|
|
851
959
|
this._measureList.clear(), this.resetState(), this._active = !1;
|
|
852
960
|
}
|
|
853
|
-
},
|
|
961
|
+
}, ae = class extends Q {
|
|
854
962
|
constructor(e) {
|
|
855
963
|
super(e), this.currentType = "distance", this._previewEnd = null;
|
|
856
964
|
}
|
|
@@ -902,7 +1010,7 @@ var V = {
|
|
|
902
1010
|
interrupt() {
|
|
903
1011
|
this._previewEnd = null, super.interrupt();
|
|
904
1012
|
}
|
|
905
|
-
},
|
|
1013
|
+
}, oe = class extends Q {
|
|
906
1014
|
constructor(e) {
|
|
907
1015
|
super(e), this.currentType = "angle", this._secondPoint = null, this._thirdPoint = null;
|
|
908
1016
|
}
|
|
@@ -932,7 +1040,7 @@ var V = {
|
|
|
932
1040
|
let u = Math.max(-1, Math.min(1, s / (c * l)));
|
|
933
1041
|
return parseFloat((Math.acos(u) * 180 / Math.PI).toFixed(2));
|
|
934
1042
|
}
|
|
935
|
-
},
|
|
1043
|
+
}, se = class extends Q {
|
|
936
1044
|
constructor(e) {
|
|
937
1045
|
super(e), this.currentType = "area";
|
|
938
1046
|
}
|
|
@@ -960,7 +1068,7 @@ var V = {
|
|
|
960
1068
|
}
|
|
961
1069
|
return Math.abs(t) / 2;
|
|
962
1070
|
}
|
|
963
|
-
},
|
|
1071
|
+
}, $ = class {
|
|
964
1072
|
get currentType() {
|
|
965
1073
|
return this._currentSubType;
|
|
966
1074
|
}
|
|
@@ -969,7 +1077,7 @@ var V = {
|
|
|
969
1077
|
this._isCreating = !0;
|
|
970
1078
|
}, this._onMeasureCreated = (e) => {
|
|
971
1079
|
this._isCreating = !1, this._resultList.set(e.result.id, e.result);
|
|
972
|
-
}, this.events = e.eventTrigger ?? new
|
|
1080
|
+
}, this.events = e.eventTrigger ?? new z();
|
|
973
1081
|
let t = {
|
|
974
1082
|
coordProvider: e.coordProvider,
|
|
975
1083
|
calibration: e.calibration ?? {
|
|
@@ -979,7 +1087,7 @@ var V = {
|
|
|
979
1087
|
},
|
|
980
1088
|
eventTrigger: this.events
|
|
981
1089
|
};
|
|
982
|
-
this.distanceMeasure = new
|
|
1090
|
+
this.distanceMeasure = new ae(t), this.angleMeasure = new oe(t), this.areaMeasure = new se(t), this._subTools = /* @__PURE__ */ new Map([
|
|
983
1091
|
["distance", this.distanceMeasure],
|
|
984
1092
|
["angle", this.angleMeasure],
|
|
985
1093
|
["area", this.areaMeasure]
|
|
@@ -1049,9 +1157,9 @@ var V = {
|
|
|
1049
1157
|
for (let e of this._subTools.values()) e.destroy();
|
|
1050
1158
|
this._subTools.clear(), this._resultList.clear(), this._active = !1;
|
|
1051
1159
|
}
|
|
1052
|
-
},
|
|
1160
|
+
}, ce = class {
|
|
1053
1161
|
constructor(e) {
|
|
1054
|
-
this._activeTool = null, this._activeMode = "none", this._tools = /* @__PURE__ */ new Map(), this.events = new
|
|
1162
|
+
this._activeTool = null, this._activeMode = "none", this._tools = /* @__PURE__ */ new Map(), this.events = new z(), this.measureTool = new $({
|
|
1055
1163
|
coordProvider: e.coordProvider,
|
|
1056
1164
|
calibration: e.calibration,
|
|
1057
1165
|
eventTrigger: this.events
|
|
@@ -1099,14 +1207,14 @@ var V = {
|
|
|
1099
1207
|
};
|
|
1100
1208
|
//#endregion
|
|
1101
1209
|
//#region src/components/useViewerManager.ts
|
|
1102
|
-
function
|
|
1103
|
-
let { drawAnnotations: t, currentScale: n, setScale: r, viewerRef: i, adjustLayout:
|
|
1104
|
-
screenToScene:
|
|
1210
|
+
function le(e) {
|
|
1211
|
+
let { drawAnnotations: t, currentScale: n, setScale: r, viewerRef: i, adjustLayout: a, screenToScene: o, toggleTheme: s } = e, c = new ce({ coordProvider: {
|
|
1212
|
+
screenToScene: o,
|
|
1105
1213
|
sceneToScreen: (e) => ({
|
|
1106
1214
|
x: 0,
|
|
1107
1215
|
y: 0
|
|
1108
1216
|
})
|
|
1109
|
-
} }),
|
|
1217
|
+
} }), u = _([]), d = _(null), f = () => {
|
|
1110
1218
|
let e = c.measureTool.getResults().map((e) => ({
|
|
1111
1219
|
id: e.id,
|
|
1112
1220
|
kind: "measure",
|
|
@@ -1121,19 +1229,19 @@ function ee(e) {
|
|
|
1121
1229
|
strokeWidth: 2,
|
|
1122
1230
|
createdAt: e.createdAt
|
|
1123
1231
|
}));
|
|
1124
|
-
|
|
1232
|
+
u.value = e, t();
|
|
1125
1233
|
};
|
|
1126
1234
|
c.events.on("measure_created", (e) => {
|
|
1127
1235
|
f();
|
|
1128
1236
|
}), c.events.on("measure_cancel", () => {
|
|
1129
1237
|
t();
|
|
1130
1238
|
});
|
|
1131
|
-
let p =
|
|
1239
|
+
let p = _("none");
|
|
1132
1240
|
return {
|
|
1133
1241
|
toolManager: c,
|
|
1134
1242
|
mode: p,
|
|
1135
|
-
annotations:
|
|
1136
|
-
selectedAnnotationId:
|
|
1243
|
+
annotations: u,
|
|
1244
|
+
selectedAnnotationId: d,
|
|
1137
1245
|
setMode: (e) => {
|
|
1138
1246
|
let n = {
|
|
1139
1247
|
measure: "measure",
|
|
@@ -1146,23 +1254,29 @@ function ee(e) {
|
|
|
1146
1254
|
c.measureTool.setSubType(e);
|
|
1147
1255
|
},
|
|
1148
1256
|
clearInteraction: () => {
|
|
1149
|
-
c.interrupt(), c.measureTool.clearResults(),
|
|
1257
|
+
c.interrupt(), c.measureTool.clearResults(), u.value = [], d.value = null, t();
|
|
1150
1258
|
},
|
|
1151
1259
|
deleteSelectedAnnotation: () => {
|
|
1152
|
-
|
|
1260
|
+
d.value && (c.measureTool.removeResult(d.value), d.value = null, f());
|
|
1153
1261
|
},
|
|
1154
1262
|
selectAnnotation: (e) => {
|
|
1155
|
-
|
|
1263
|
+
d.value = e, t();
|
|
1156
1264
|
},
|
|
1157
1265
|
registerManager: () => {
|
|
1158
1266
|
let e = {
|
|
1159
1267
|
setScale: async (e) => {
|
|
1160
|
-
await r(e), await
|
|
1268
|
+
await r(e), await l(), a(!1);
|
|
1161
1269
|
},
|
|
1162
1270
|
getScale: () => n.value,
|
|
1163
|
-
getContainerEl: () => i.value
|
|
1164
|
-
|
|
1165
|
-
|
|
1271
|
+
getContainerEl: () => i.value,
|
|
1272
|
+
resetPosition: () => {
|
|
1273
|
+
a(!0);
|
|
1274
|
+
},
|
|
1275
|
+
toggleTheme: () => {
|
|
1276
|
+
s();
|
|
1277
|
+
}
|
|
1278
|
+
}, o = new F();
|
|
1279
|
+
o.registerWithToolManager(c, t, e), window.pdfViewer = o;
|
|
1166
1280
|
},
|
|
1167
1281
|
unregisterManager: () => {
|
|
1168
1282
|
window.pdfViewer?.unregister(), window.pdfViewer = null, c.destroy();
|
|
@@ -1170,12 +1284,91 @@ function ee(e) {
|
|
|
1170
1284
|
};
|
|
1171
1285
|
}
|
|
1172
1286
|
//#endregion
|
|
1173
|
-
//#region src/components/
|
|
1174
|
-
var
|
|
1287
|
+
//#region src/components/MobileConsole.vue?vue&type=script&setup=true&lang.ts
|
|
1288
|
+
var ue = { class: "mobile-console__title" }, de = { class: "mobile-console__count" }, fe = { class: "mobile-console__actions" }, pe = { class: "mobile-console__toggle" }, me = { class: "mobile-console__level" }, he = { class: "mobile-console__msg" }, ge = {
|
|
1289
|
+
key: 0,
|
|
1290
|
+
class: "mobile-console__empty"
|
|
1291
|
+
}, _e = /*@__PURE__*/ c({
|
|
1292
|
+
__name: "MobileConsole",
|
|
1293
|
+
props: {
|
|
1294
|
+
visible: {
|
|
1295
|
+
type: Boolean,
|
|
1296
|
+
default: !1
|
|
1297
|
+
},
|
|
1298
|
+
maxLogs: { default: 200 }
|
|
1299
|
+
},
|
|
1300
|
+
setup(e) {
|
|
1301
|
+
let n = e, s = h([]), c = h(!1), d = h(null), _ = console.log.bind(console), y = (e, t) => {
|
|
1302
|
+
if (!n.visible) return;
|
|
1303
|
+
let r = t.map((e) => {
|
|
1304
|
+
if (typeof e == "string") return e;
|
|
1305
|
+
try {
|
|
1306
|
+
return JSON.stringify(e);
|
|
1307
|
+
} catch {
|
|
1308
|
+
return String(e);
|
|
1309
|
+
}
|
|
1310
|
+
}).join(" ");
|
|
1311
|
+
s.value.push({
|
|
1312
|
+
level: e,
|
|
1313
|
+
message: r
|
|
1314
|
+
}), s.value.length > n.maxLogs && s.value.splice(0, s.value.length - n.maxLogs);
|
|
1315
|
+
};
|
|
1316
|
+
x(() => s.value.length, async () => {
|
|
1317
|
+
await l(), d.value && !c.value && (d.value.scrollTop = d.value.scrollHeight);
|
|
1318
|
+
});
|
|
1319
|
+
let w = () => {
|
|
1320
|
+
s.value = [];
|
|
1321
|
+
}, T = async () => {
|
|
1322
|
+
let e = s.value.map((e) => `[${e.level.toUpperCase()}] ${e.message}`).join("\n");
|
|
1323
|
+
if (e) try {
|
|
1324
|
+
await navigator.clipboard.writeText(e);
|
|
1325
|
+
} catch {
|
|
1326
|
+
let t = document.createElement("textarea");
|
|
1327
|
+
t.value = e, t.style.position = "fixed", t.style.left = "-9999px", document.body.appendChild(t), t.select(), document.execCommand("copy"), document.body.removeChild(t);
|
|
1328
|
+
}
|
|
1329
|
+
}, E = () => {
|
|
1330
|
+
c.value = !c.value, c.value || l(() => {
|
|
1331
|
+
d.value && (d.value.scrollTop = d.value.scrollHeight);
|
|
1332
|
+
});
|
|
1333
|
+
};
|
|
1334
|
+
return p(() => {
|
|
1335
|
+
n.visible && (console.log = (...e) => {
|
|
1336
|
+
y("log", e), _(...e);
|
|
1337
|
+
});
|
|
1338
|
+
}), f(() => {
|
|
1339
|
+
console.log = _;
|
|
1340
|
+
}), (n, l) => e.visible ? (m(), i("div", {
|
|
1341
|
+
key: 0,
|
|
1342
|
+
class: u(["mobile-console", { collapsed: c.value }])
|
|
1343
|
+
}, [a("div", {
|
|
1344
|
+
class: "mobile-console__header",
|
|
1345
|
+
onClick: E
|
|
1346
|
+
}, [a("span", ue, [l[0] ||= o(" 📟 Console ", -1), a("span", de, v(s.value.length), 1)]), a("span", fe, [
|
|
1347
|
+
a("button", {
|
|
1348
|
+
class: "mobile-console__btn",
|
|
1349
|
+
title: "清空",
|
|
1350
|
+
onClick: C(w, ["stop"])
|
|
1351
|
+
}, "🗑"),
|
|
1352
|
+
a("button", {
|
|
1353
|
+
class: "mobile-console__btn",
|
|
1354
|
+
title: "复制全部",
|
|
1355
|
+
onClick: C(T, ["stop"])
|
|
1356
|
+
}, "📋"),
|
|
1357
|
+
a("span", pe, v(c.value ? "▲" : "▼"), 1)
|
|
1358
|
+
])]), S(a("div", {
|
|
1359
|
+
ref_key: "logListRef",
|
|
1360
|
+
ref: d,
|
|
1361
|
+
class: "mobile-console__list"
|
|
1362
|
+
}, [(m(!0), i(t, null, g(s.value, (e, t) => (m(), i("div", {
|
|
1363
|
+
key: t,
|
|
1364
|
+
class: u(["mobile-console__entry", "mobile-console__entry--" + e.level])
|
|
1365
|
+
}, [a("span", me, v(e.level.toUpperCase()), 1), a("span", he, v(e.message), 1)], 2))), 128)), s.value.length === 0 ? (m(), i("div", ge, "暂无日志")) : r("", !0)], 512), [[b, !c.value]])], 2)) : r("", !0);
|
|
1366
|
+
}
|
|
1367
|
+
}), ve = (e, t) => {
|
|
1175
1368
|
let n = e.__vccOpts || e;
|
|
1176
1369
|
for (let [e, r] of t) n[e] = r;
|
|
1177
1370
|
return n;
|
|
1178
|
-
})(/* @__PURE__ */
|
|
1371
|
+
}, ye = /*#__PURE__*/ ve(_e, [["__scopeId", "data-v-ef8b578a"]]), be = /*#__PURE__*/ ve(/* @__PURE__ */ c({
|
|
1179
1372
|
__name: "PdfViewer",
|
|
1180
1373
|
props: {
|
|
1181
1374
|
modelValue: { default: null },
|
|
@@ -1187,122 +1380,130 @@ var J = /*#__PURE__*/ ((e, t) => {
|
|
|
1187
1380
|
type: Boolean,
|
|
1188
1381
|
default: !1
|
|
1189
1382
|
},
|
|
1190
|
-
zoomSpeed: { default: 1 }
|
|
1383
|
+
zoomSpeed: { default: 1 },
|
|
1384
|
+
showConsole: {
|
|
1385
|
+
type: Boolean,
|
|
1386
|
+
default: !1
|
|
1387
|
+
}
|
|
1191
1388
|
},
|
|
1192
1389
|
emits: [
|
|
1193
1390
|
"loaded",
|
|
1194
1391
|
"error",
|
|
1195
1392
|
"annotation-added"
|
|
1196
1393
|
],
|
|
1197
|
-
setup(e, { expose: t, emit:
|
|
1198
|
-
let
|
|
1394
|
+
setup(e, { expose: t, emit: r }) {
|
|
1395
|
+
let o = e, c = r, u = h(null), g = h(null), _ = h(null), v = h(null), b = h(o.theme), S = n(() => b.value === "dark" ? "#1e1e1e" : "rgb(255,255,255)"), w = () => {
|
|
1396
|
+
b.value = b.value === "light" ? "dark" : "light";
|
|
1397
|
+
}, { containerRef: T, loadFile: E, doc: D, pageCount: O, currentPageNum: k, error: ee, currentScale: A, setScale: j, setBackgroundColor: M, reset: te, events: N } = V({
|
|
1199
1398
|
autoLoad: !1,
|
|
1200
|
-
scale:
|
|
1201
|
-
backgroundColor:
|
|
1202
|
-
}),
|
|
1399
|
+
scale: o.scale,
|
|
1400
|
+
backgroundColor: S.value
|
|
1401
|
+
}), P = G(), F = h(null), I = h(!1), { drawAnnotations: L, syncCanvasSize: R, getCanvasPoint: z, hitTestAnnotation: B } = K({
|
|
1203
1402
|
annotationCanvas: v,
|
|
1204
1403
|
rootRef: g,
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1404
|
+
pdfLayerRef: _,
|
|
1405
|
+
interaction: P,
|
|
1406
|
+
previewPoint: F
|
|
1407
|
+
}), { containerStyle: H, adjustLayout: U, handleWheel: W, handleTouchStart: q, handleTouchMove: J, handleTouchEnd: Y, handleMouseDown: X, isMouseDragging: Z, cleanupMouseDrag: ie } = re({
|
|
1408
|
+
viewerRef: u,
|
|
1209
1409
|
rootRef: g,
|
|
1210
1410
|
pdfLayerRef: _,
|
|
1211
|
-
currentScale:
|
|
1212
|
-
setScale:
|
|
1213
|
-
zoomSpeed:
|
|
1214
|
-
theme:
|
|
1215
|
-
syncCanvasSize:
|
|
1216
|
-
drawAnnotations:
|
|
1217
|
-
}),
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1411
|
+
currentScale: A,
|
|
1412
|
+
setScale: j,
|
|
1413
|
+
zoomSpeed: o.zoomSpeed ?? 1,
|
|
1414
|
+
theme: b,
|
|
1415
|
+
syncCanvasSize: R,
|
|
1416
|
+
drawAnnotations: L
|
|
1417
|
+
}), Q = (e) => {
|
|
1418
|
+
P.mode === "none" && X(e);
|
|
1419
|
+
}, ae = n(() => ({
|
|
1420
|
+
...H.value,
|
|
1421
|
+
cursor: Z.value ? "grabbing" : "grab"
|
|
1422
|
+
})), { setMode: oe, clearInteraction: se, deleteSelectedAnnotation: $, selectAnnotation: ce, registerManager: ue, unregisterManager: de } = le({
|
|
1423
|
+
drawAnnotations: L,
|
|
1424
|
+
currentScale: A,
|
|
1425
|
+
setScale: j,
|
|
1426
|
+
viewerRef: u,
|
|
1427
|
+
adjustLayout: U,
|
|
1223
1428
|
screenToScene: (e) => {
|
|
1224
|
-
let t =
|
|
1429
|
+
let t = z(e);
|
|
1225
1430
|
return {
|
|
1226
1431
|
x: t.x,
|
|
1227
1432
|
y: t.y
|
|
1228
1433
|
};
|
|
1229
|
-
}
|
|
1230
|
-
|
|
1434
|
+
},
|
|
1435
|
+
toggleTheme: w
|
|
1436
|
+
}), { handlePointerDown: fe, handlePointerMove: pe, handlePointerUp: me, handleKeydown: he } = ne({
|
|
1231
1437
|
annotationCanvas: v,
|
|
1232
|
-
interaction:
|
|
1233
|
-
previewPoint:
|
|
1234
|
-
isRectangleDragging:
|
|
1235
|
-
getCanvasPoint:
|
|
1236
|
-
hitTestAnnotation:
|
|
1237
|
-
drawAnnotations:
|
|
1238
|
-
deleteSelectedAnnotation:
|
|
1239
|
-
emit:
|
|
1438
|
+
interaction: P,
|
|
1439
|
+
previewPoint: F,
|
|
1440
|
+
isRectangleDragging: I,
|
|
1441
|
+
getCanvasPoint: z,
|
|
1442
|
+
hitTestAnnotation: B,
|
|
1443
|
+
drawAnnotations: L,
|
|
1444
|
+
deleteSelectedAnnotation: $,
|
|
1445
|
+
emit: c
|
|
1240
1446
|
});
|
|
1241
|
-
return
|
|
1242
|
-
|
|
1447
|
+
return N.on("loaded", (e) => {
|
|
1448
|
+
c("loaded", {
|
|
1243
1449
|
pageCount: e.pageCount,
|
|
1244
1450
|
currentPage: e.currentPage
|
|
1245
1451
|
});
|
|
1246
|
-
}),
|
|
1247
|
-
|
|
1248
|
-
}),
|
|
1249
|
-
|
|
1250
|
-
}),
|
|
1251
|
-
e && e !==
|
|
1252
|
-
}),
|
|
1253
|
-
e && (await
|
|
1452
|
+
}), N.on("error_occurred", (e) => {
|
|
1453
|
+
c("error", { message: e.message });
|
|
1454
|
+
}), x(() => P.annotations.length, () => {
|
|
1455
|
+
L();
|
|
1456
|
+
}), x(() => o.scale, async (e) => {
|
|
1457
|
+
e && e !== A.value && (await j(e), await l(), U());
|
|
1458
|
+
}), x(() => o.modelValue, async (e) => {
|
|
1459
|
+
e && (await E(e), await l(), U(!0));
|
|
1254
1460
|
}, {
|
|
1255
1461
|
immediate: !0,
|
|
1256
1462
|
flush: "post"
|
|
1257
|
-
}),
|
|
1258
|
-
|
|
1259
|
-
}),
|
|
1260
|
-
window.
|
|
1463
|
+
}), x(b, async (e) => {
|
|
1464
|
+
await M(e === "dark" ? "#1e1e1e" : "rgb(255,255,255)");
|
|
1465
|
+
}), p(() => {
|
|
1466
|
+
T.value = _.value, g.value && (g.value.style.position = "absolute", g.value.style.top = "0", g.value.style.left = "0"), R(), L(), window.addEventListener("keydown", he), ue(), u.value && (u.value.addEventListener("touchstart", q, { passive: !1 }), u.value.addEventListener("touchmove", J, { passive: !1 }), u.value.addEventListener("touchend", Y, { passive: !1 }));
|
|
1467
|
+
}), f(() => {
|
|
1468
|
+
window.removeEventListener("keydown", he), ie(), u.value && (u.value.removeEventListener("touchstart", q), u.value.removeEventListener("touchmove", J), u.value.removeEventListener("touchend", Y)), de();
|
|
1261
1469
|
}), t({
|
|
1262
1470
|
load: async (e) => {
|
|
1263
|
-
await
|
|
1471
|
+
await E(e);
|
|
1264
1472
|
},
|
|
1265
1473
|
clear: () => {
|
|
1266
|
-
|
|
1474
|
+
te();
|
|
1267
1475
|
},
|
|
1268
|
-
setMode:
|
|
1269
|
-
clearInteraction:
|
|
1270
|
-
deleteSelectedAnnotation:
|
|
1271
|
-
selectAnnotation:
|
|
1272
|
-
}), (
|
|
1476
|
+
setMode: oe,
|
|
1477
|
+
clearInteraction: se,
|
|
1478
|
+
deleteSelectedAnnotation: $,
|
|
1479
|
+
selectAnnotation: ce
|
|
1480
|
+
}), (t, n) => (m(), i("div", {
|
|
1273
1481
|
ref_key: "viewerRef",
|
|
1274
|
-
ref:
|
|
1482
|
+
ref: u,
|
|
1275
1483
|
class: "pdf-core-viewer",
|
|
1276
|
-
style:
|
|
1277
|
-
onWheel:
|
|
1278
|
-
|
|
1484
|
+
style: d(ae.value),
|
|
1485
|
+
onWheel: n[3] ||= C((...e) => y(W) && y(W)(...e), ["prevent"]),
|
|
1486
|
+
onMousedown: Q
|
|
1487
|
+
}, [a("div", {
|
|
1279
1488
|
ref_key: "rootRef",
|
|
1280
1489
|
ref: g,
|
|
1281
1490
|
class: "pdf-core-canvas-wrapper"
|
|
1282
|
-
}, [
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
class: "pdf-core-overlay",
|
|
1295
|
-
onPointerdown: t[0] ||= (...e) => f(X) && f(X)(...e),
|
|
1296
|
-
onPointerup: t[1] ||= (...e) => f(Q) && f(Q)(...e),
|
|
1297
|
-
onPointermove: t[2] ||= (...e) => f(Z) && f(Z)(...e)
|
|
1298
|
-
}, null, 32)
|
|
1299
|
-
], 512)], 36));
|
|
1300
|
-
}
|
|
1301
|
-
}), [["__scopeId", "data-v-0e4941dc"]]);
|
|
1491
|
+
}, [a("div", {
|
|
1492
|
+
ref_key: "pdfLayerRef",
|
|
1493
|
+
ref: _,
|
|
1494
|
+
class: "pdf-core-pdf-layer"
|
|
1495
|
+
}, null, 512), a("div", {
|
|
1496
|
+
class: "pdf-core-overlay",
|
|
1497
|
+
onPointerdown: n[0] ||= (...e) => y(fe) && y(fe)(...e),
|
|
1498
|
+
onPointerup: n[1] ||= (...e) => y(me) && y(me)(...e),
|
|
1499
|
+
onPointermove: n[2] ||= (...e) => y(pe) && y(pe)(...e)
|
|
1500
|
+
}, null, 32)], 512), s(ye, { visible: e.showConsole }, null, 8, ["visible"])], 36));
|
|
1501
|
+
}
|
|
1502
|
+
}), [["__scopeId", "data-v-58f287f7"]]);
|
|
1302
1503
|
//#endregion
|
|
1303
1504
|
//#region src/vue/plugin.ts
|
|
1304
|
-
function
|
|
1305
|
-
e.component("PdfViewer",
|
|
1505
|
+
function xe(e) {
|
|
1506
|
+
e.component("PdfViewer", be);
|
|
1306
1507
|
}
|
|
1307
1508
|
//#endregion
|
|
1308
|
-
export {
|
|
1509
|
+
export { oe as AngleMeasure, se as AreaMeasure, te as CoordTransformer, ie as DEFAULT_TOOL_STATE, ae as DistanceMeasure, z as EventTrigger, Q as MeasureBase, $ as MeasureTool, be as PdfViewer, F as PdfViewerCore, D as TileLRUCache, ce as ToolManager, N as ZOOM_LEVELS, I as createMeasureAnnotation, L as createShapeAnnotation, P as getNextZoom, xe as installPdfCore, E as loadPDF, M as renderPageTiledVirtual, w as setPDFWorkerSrc, H as useAnnotations, T as useDefaultWorker, W as useInteraction, U as useMeasurement, V as usePdfCore };
|