@flyfish-dev/dwf-viewer 0.5.0
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/CHANGELOG.md +12 -0
- package/LICENSE +235 -0
- package/NOTICE +10 -0
- package/PRODUCTION_3D_NOTES.md +48 -0
- package/README.md +203 -0
- package/dist/format/document.d.ts +186 -0
- package/dist/format/document.js +9 -0
- package/dist/format/dwf.d.ts +4 -0
- package/dist/format/dwf.js +372 -0
- package/dist/format/dwfx.d.ts +6 -0
- package/dist/format/dwfx.js +425 -0
- package/dist/format/emodelMetadata.d.ts +10 -0
- package/dist/format/emodelMetadata.js +368 -0
- package/dist/format/inflate.d.ts +4 -0
- package/dist/format/inflate.js +28 -0
- package/dist/format/opc.d.ts +28 -0
- package/dist/format/opc.js +85 -0
- package/dist/format/open.d.ts +3 -0
- package/dist/format/open.js +69 -0
- package/dist/format/types.d.ts +61 -0
- package/dist/format/types.js +6 -0
- package/dist/format/util.d.ts +18 -0
- package/dist/format/util.js +324 -0
- package/dist/format/w2dBinary.d.ts +19 -0
- package/dist/format/w2dBinary.js +629 -0
- package/dist/format/w2dText.d.ts +13 -0
- package/dist/format/w2dText.js +166 -0
- package/dist/format/w3d.d.ts +8 -0
- package/dist/format/w3d.js +826 -0
- package/dist/format/zip.d.ts +30 -0
- package/dist/format/zip.js +141 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +9 -0
- package/dist/render/PageRenderer.d.ts +27 -0
- package/dist/render/PageRenderer.js +92 -0
- package/dist/render/ThreeJsSceneAdapter.d.ts +29 -0
- package/dist/render/ThreeJsSceneAdapter.js +52 -0
- package/dist/render/ThreeW3dRenderer.d.ts +24 -0
- package/dist/render/ThreeW3dRenderer.js +372 -0
- package/dist/render/W2dRenderer.d.ts +24 -0
- package/dist/render/W2dRenderer.js +198 -0
- package/dist/render/WebGlW2dBackend.d.ts +38 -0
- package/dist/render/WebGlW2dBackend.js +400 -0
- package/dist/render/XpsRenderer.d.ts +20 -0
- package/dist/render/XpsRenderer.js +310 -0
- package/dist/render/style.d.ts +16 -0
- package/dist/render/style.js +115 -0
- package/dist/render/viewport.d.ts +16 -0
- package/dist/render/viewport.js +27 -0
- package/dist/render/xpsPath.d.ts +41 -0
- package/dist/render/xpsPath.js +335 -0
- package/dist/viewer/DwfViewer.d.ts +69 -0
- package/dist/viewer/DwfViewer.js +386 -0
- package/dist/wasm/WasmRasterBackend.d.ts +21 -0
- package/dist/wasm/WasmRasterBackend.js +84 -0
- package/package.json +91 -0
- package/public/dwfv-render.wasm +0 -0
- package/styles/dwf-viewer.css +51 -0
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
export function parsePathData(data) {
|
|
2
|
+
const tokens = tokenizePath(data);
|
|
3
|
+
const commands = [];
|
|
4
|
+
let i = 0;
|
|
5
|
+
let cmd = '';
|
|
6
|
+
let cx = 0, cy = 0, sx = 0, sy = 0;
|
|
7
|
+
let lastC;
|
|
8
|
+
let lastQ;
|
|
9
|
+
const hasNum = () => i < tokens.length && tokens[i]?.kind === 'num';
|
|
10
|
+
const readNum = () => {
|
|
11
|
+
const t = tokens[i++];
|
|
12
|
+
if (!t || t.kind !== 'num')
|
|
13
|
+
throw new Error(`Expected number in path data near token ${i}.`);
|
|
14
|
+
return t.value;
|
|
15
|
+
};
|
|
16
|
+
const readFlag = () => readNum() !== 0;
|
|
17
|
+
while (i < tokens.length) {
|
|
18
|
+
const t = tokens[i];
|
|
19
|
+
if (!t)
|
|
20
|
+
break;
|
|
21
|
+
if (t.kind === 'cmd') {
|
|
22
|
+
cmd = t.value;
|
|
23
|
+
i++;
|
|
24
|
+
// XPS mini-language may start with F0/F1 fill-rule tokens. They are not drawing commands.
|
|
25
|
+
if (cmd === 'F' || cmd === 'f') {
|
|
26
|
+
if (hasNum())
|
|
27
|
+
readNum();
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
else if (!cmd) {
|
|
32
|
+
i++;
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
const rel = cmd === cmd.toLowerCase();
|
|
36
|
+
const up = cmd.toUpperCase();
|
|
37
|
+
const absX = (x) => rel ? cx + x : x;
|
|
38
|
+
const absY = (y) => rel ? cy + y : y;
|
|
39
|
+
if (up === 'M') {
|
|
40
|
+
if (!hasNum())
|
|
41
|
+
continue;
|
|
42
|
+
const x = absX(readNum());
|
|
43
|
+
const y = absY(readNum());
|
|
44
|
+
commands.push({ type: 'M', x, y });
|
|
45
|
+
cx = sx = x;
|
|
46
|
+
cy = sy = y;
|
|
47
|
+
lastC = lastQ = undefined;
|
|
48
|
+
while (hasNum()) {
|
|
49
|
+
const lx = absX(readNum());
|
|
50
|
+
const ly = absY(readNum());
|
|
51
|
+
commands.push({ type: 'L', x: lx, y: ly });
|
|
52
|
+
cx = lx;
|
|
53
|
+
cy = ly;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
else if (up === 'L') {
|
|
57
|
+
while (hasNum()) {
|
|
58
|
+
const x = absX(readNum());
|
|
59
|
+
const y = absY(readNum());
|
|
60
|
+
commands.push({ type: 'L', x, y });
|
|
61
|
+
cx = x;
|
|
62
|
+
cy = y;
|
|
63
|
+
lastC = lastQ = undefined;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
else if (up === 'H') {
|
|
67
|
+
while (hasNum()) {
|
|
68
|
+
const x = absX(readNum());
|
|
69
|
+
commands.push({ type: 'L', x, y: cy });
|
|
70
|
+
cx = x;
|
|
71
|
+
lastC = lastQ = undefined;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
else if (up === 'V') {
|
|
75
|
+
while (hasNum()) {
|
|
76
|
+
const y = absY(readNum());
|
|
77
|
+
commands.push({ type: 'L', x: cx, y });
|
|
78
|
+
cy = y;
|
|
79
|
+
lastC = lastQ = undefined;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
else if (up === 'C') {
|
|
83
|
+
while (hasNum()) {
|
|
84
|
+
const x1 = absX(readNum()), y1 = absY(readNum());
|
|
85
|
+
const x2 = absX(readNum()), y2 = absY(readNum());
|
|
86
|
+
const x = absX(readNum()), y = absY(readNum());
|
|
87
|
+
commands.push({ type: 'C', x1, y1, x2, y2, x, y });
|
|
88
|
+
cx = x;
|
|
89
|
+
cy = y;
|
|
90
|
+
lastC = { x: x2, y: y2 };
|
|
91
|
+
lastQ = undefined;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
else if (up === 'S') {
|
|
95
|
+
while (hasNum()) {
|
|
96
|
+
const reflected = lastC ? { x: 2 * cx - lastC.x, y: 2 * cy - lastC.y } : { x: cx, y: cy };
|
|
97
|
+
const x2 = absX(readNum()), y2 = absY(readNum());
|
|
98
|
+
const x = absX(readNum()), y = absY(readNum());
|
|
99
|
+
commands.push({ type: 'C', x1: reflected.x, y1: reflected.y, x2, y2, x, y });
|
|
100
|
+
cx = x;
|
|
101
|
+
cy = y;
|
|
102
|
+
lastC = { x: x2, y: y2 };
|
|
103
|
+
lastQ = undefined;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
else if (up === 'Q') {
|
|
107
|
+
while (hasNum()) {
|
|
108
|
+
const x1 = absX(readNum()), y1 = absY(readNum());
|
|
109
|
+
const x = absX(readNum()), y = absY(readNum());
|
|
110
|
+
commands.push({ type: 'Q', x1, y1, x, y });
|
|
111
|
+
cx = x;
|
|
112
|
+
cy = y;
|
|
113
|
+
lastQ = { x: x1, y: y1 };
|
|
114
|
+
lastC = undefined;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
else if (up === 'T') {
|
|
118
|
+
while (hasNum()) {
|
|
119
|
+
const reflected = lastQ ? { x: 2 * cx - lastQ.x, y: 2 * cy - lastQ.y } : { x: cx, y: cy };
|
|
120
|
+
const x = absX(readNum()), y = absY(readNum());
|
|
121
|
+
commands.push({ type: 'Q', x1: reflected.x, y1: reflected.y, x, y });
|
|
122
|
+
cx = x;
|
|
123
|
+
cy = y;
|
|
124
|
+
lastQ = reflected;
|
|
125
|
+
lastC = undefined;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
else if (up === 'A') {
|
|
129
|
+
while (hasNum()) {
|
|
130
|
+
const rx = Math.abs(readNum()), ry = Math.abs(readNum());
|
|
131
|
+
const rotation = readNum();
|
|
132
|
+
const largeArc = readFlag();
|
|
133
|
+
const sweep = readFlag();
|
|
134
|
+
const x = absX(readNum()), y = absY(readNum());
|
|
135
|
+
commands.push({ type: 'A', rx, ry, rotation, largeArc, sweep, x, y });
|
|
136
|
+
cx = x;
|
|
137
|
+
cy = y;
|
|
138
|
+
lastC = lastQ = undefined;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
else if (up === 'Z') {
|
|
142
|
+
commands.push({ type: 'Z' });
|
|
143
|
+
cx = sx;
|
|
144
|
+
cy = sy;
|
|
145
|
+
lastC = lastQ = undefined;
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
// Unknown command: skip one token to keep the parser moving.
|
|
149
|
+
i++;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return commands;
|
|
153
|
+
}
|
|
154
|
+
export function applyPathToCanvas(ctx, commands) {
|
|
155
|
+
let cx = 0, cy = 0, sx = 0, sy = 0;
|
|
156
|
+
for (const c of commands) {
|
|
157
|
+
switch (c.type) {
|
|
158
|
+
case 'M':
|
|
159
|
+
ctx.moveTo(c.x, c.y);
|
|
160
|
+
cx = sx = c.x;
|
|
161
|
+
cy = sy = c.y;
|
|
162
|
+
break;
|
|
163
|
+
case 'L':
|
|
164
|
+
ctx.lineTo(c.x, c.y);
|
|
165
|
+
cx = c.x;
|
|
166
|
+
cy = c.y;
|
|
167
|
+
break;
|
|
168
|
+
case 'C':
|
|
169
|
+
ctx.bezierCurveTo(c.x1, c.y1, c.x2, c.y2, c.x, c.y);
|
|
170
|
+
cx = c.x;
|
|
171
|
+
cy = c.y;
|
|
172
|
+
break;
|
|
173
|
+
case 'Q':
|
|
174
|
+
ctx.quadraticCurveTo(c.x1, c.y1, c.x, c.y);
|
|
175
|
+
cx = c.x;
|
|
176
|
+
cy = c.y;
|
|
177
|
+
break;
|
|
178
|
+
case 'A': {
|
|
179
|
+
const pts = arcToPoints(cx, cy, c.rx, c.ry, c.rotation, c.largeArc, c.sweep, c.x, c.y, 32);
|
|
180
|
+
for (const [x, y] of pts)
|
|
181
|
+
ctx.lineTo(x, y);
|
|
182
|
+
cx = c.x;
|
|
183
|
+
cy = c.y;
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
case 'Z':
|
|
187
|
+
ctx.closePath();
|
|
188
|
+
cx = sx;
|
|
189
|
+
cy = sy;
|
|
190
|
+
break;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
export function flattenPath(commands, tolerance = 0.75) {
|
|
195
|
+
const paths = [];
|
|
196
|
+
let current;
|
|
197
|
+
let cx = 0, cy = 0, sx = 0, sy = 0;
|
|
198
|
+
const ensure = () => {
|
|
199
|
+
if (!current) {
|
|
200
|
+
current = { points: [], closed: false };
|
|
201
|
+
paths.push(current);
|
|
202
|
+
}
|
|
203
|
+
return current;
|
|
204
|
+
};
|
|
205
|
+
const push = (x, y) => {
|
|
206
|
+
const p = ensure();
|
|
207
|
+
const n = p.points.length;
|
|
208
|
+
if (n >= 2 && Math.abs(p.points[n - 2] - x) < 1e-9 && Math.abs(p.points[n - 1] - y) < 1e-9)
|
|
209
|
+
return;
|
|
210
|
+
p.points.push(x, y);
|
|
211
|
+
};
|
|
212
|
+
for (const c of commands) {
|
|
213
|
+
switch (c.type) {
|
|
214
|
+
case 'M':
|
|
215
|
+
current = { points: [c.x, c.y], closed: false };
|
|
216
|
+
paths.push(current);
|
|
217
|
+
cx = sx = c.x;
|
|
218
|
+
cy = sy = c.y;
|
|
219
|
+
break;
|
|
220
|
+
case 'L':
|
|
221
|
+
push(c.x, c.y);
|
|
222
|
+
cx = c.x;
|
|
223
|
+
cy = c.y;
|
|
224
|
+
break;
|
|
225
|
+
case 'C': {
|
|
226
|
+
const steps = curveSteps(cx, cy, c.x, c.y, tolerance);
|
|
227
|
+
for (let i = 1; i <= steps; i++) {
|
|
228
|
+
const t = i / steps;
|
|
229
|
+
const x = cubic(cx, c.x1, c.x2, c.x, t);
|
|
230
|
+
const y = cubic(cy, c.y1, c.y2, c.y, t);
|
|
231
|
+
push(x, y);
|
|
232
|
+
}
|
|
233
|
+
cx = c.x;
|
|
234
|
+
cy = c.y;
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
237
|
+
case 'Q': {
|
|
238
|
+
const steps = curveSteps(cx, cy, c.x, c.y, tolerance);
|
|
239
|
+
for (let i = 1; i <= steps; i++) {
|
|
240
|
+
const t = i / steps;
|
|
241
|
+
const x = quad(cx, c.x1, c.x, t);
|
|
242
|
+
const y = quad(cy, c.y1, c.y, t);
|
|
243
|
+
push(x, y);
|
|
244
|
+
}
|
|
245
|
+
cx = c.x;
|
|
246
|
+
cy = c.y;
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
249
|
+
case 'A': {
|
|
250
|
+
const pts = arcToPoints(cx, cy, c.rx, c.ry, c.rotation, c.largeArc, c.sweep, c.x, c.y, Math.max(8, Math.ceil(24 / Math.max(tolerance, 0.1))));
|
|
251
|
+
for (const [x, y] of pts)
|
|
252
|
+
push(x, y);
|
|
253
|
+
cx = c.x;
|
|
254
|
+
cy = c.y;
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
257
|
+
case 'Z':
|
|
258
|
+
if (current) {
|
|
259
|
+
push(sx, sy);
|
|
260
|
+
current.closed = true;
|
|
261
|
+
}
|
|
262
|
+
cx = sx;
|
|
263
|
+
cy = sy;
|
|
264
|
+
break;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
return paths.filter(p => p.points.length >= 2);
|
|
268
|
+
}
|
|
269
|
+
function tokenizePath(data) {
|
|
270
|
+
const tokens = [];
|
|
271
|
+
const re = /([MmLlHhVvCcSsQqTtAaZzFf])|([-+]?(?:\d+\.\d*|\.\d+|\d+)(?:[eE][-+]?\d+)?)/g;
|
|
272
|
+
let m;
|
|
273
|
+
while ((m = re.exec(data)) !== null) {
|
|
274
|
+
if (m[1])
|
|
275
|
+
tokens.push({ kind: 'cmd', value: m[1] });
|
|
276
|
+
else if (m[2])
|
|
277
|
+
tokens.push({ kind: 'num', value: Number(m[2]) });
|
|
278
|
+
}
|
|
279
|
+
return tokens;
|
|
280
|
+
}
|
|
281
|
+
function curveSteps(x0, y0, x1, y1, tolerance) {
|
|
282
|
+
const d = Math.hypot(x1 - x0, y1 - y0);
|
|
283
|
+
return Math.max(4, Math.min(96, Math.ceil(d / Math.max(1.5, tolerance * 6))));
|
|
284
|
+
}
|
|
285
|
+
function cubic(a, b, c, d, t) {
|
|
286
|
+
const mt = 1 - t;
|
|
287
|
+
return mt * mt * mt * a + 3 * mt * mt * t * b + 3 * mt * t * t * c + t * t * t * d;
|
|
288
|
+
}
|
|
289
|
+
function quad(a, b, c, t) {
|
|
290
|
+
const mt = 1 - t;
|
|
291
|
+
return mt * mt * a + 2 * mt * t * b + t * t * c;
|
|
292
|
+
}
|
|
293
|
+
// SVG/XPS endpoint-to-center arc conversion, sampled to points.
|
|
294
|
+
function arcToPoints(x1, y1, rx, ry, angleDeg, largeArc, sweep, x2, y2, maxSegments) {
|
|
295
|
+
if (rx === 0 || ry === 0 || (Math.abs(x1 - x2) < 1e-9 && Math.abs(y1 - y2) < 1e-9))
|
|
296
|
+
return [[x2, y2]];
|
|
297
|
+
const phi = angleDeg * Math.PI / 180;
|
|
298
|
+
const cosPhi = Math.cos(phi), sinPhi = Math.sin(phi);
|
|
299
|
+
const dx = (x1 - x2) / 2, dy = (y1 - y2) / 2;
|
|
300
|
+
let x1p = cosPhi * dx + sinPhi * dy;
|
|
301
|
+
let y1p = -sinPhi * dx + cosPhi * dy;
|
|
302
|
+
rx = Math.abs(rx);
|
|
303
|
+
ry = Math.abs(ry);
|
|
304
|
+
const lambda = (x1p * x1p) / (rx * rx) + (y1p * y1p) / (ry * ry);
|
|
305
|
+
if (lambda > 1) {
|
|
306
|
+
const s = Math.sqrt(lambda);
|
|
307
|
+
rx *= s;
|
|
308
|
+
ry *= s;
|
|
309
|
+
}
|
|
310
|
+
const rx2 = rx * rx, ry2 = ry * ry, x1p2 = x1p * x1p, y1p2 = y1p * y1p;
|
|
311
|
+
let factor = (rx2 * ry2 - rx2 * y1p2 - ry2 * x1p2) / (rx2 * y1p2 + ry2 * x1p2);
|
|
312
|
+
factor = Math.max(0, factor);
|
|
313
|
+
const coef = (largeArc === sweep ? -1 : 1) * Math.sqrt(factor);
|
|
314
|
+
const cxp = coef * (rx * y1p / ry);
|
|
315
|
+
const cyp = coef * (-ry * x1p / rx);
|
|
316
|
+
const cx = cosPhi * cxp - sinPhi * cyp + (x1 + x2) / 2;
|
|
317
|
+
const cy = sinPhi * cxp + cosPhi * cyp + (y1 + y2) / 2;
|
|
318
|
+
const v1x = (x1p - cxp) / rx, v1y = (y1p - cyp) / ry;
|
|
319
|
+
const v2x = (-x1p - cxp) / rx, v2y = (-y1p - cyp) / ry;
|
|
320
|
+
let theta1 = Math.atan2(v1y, v1x);
|
|
321
|
+
let delta = Math.atan2(v1x * v2y - v1y * v2x, v1x * v2x + v1y * v2y);
|
|
322
|
+
if (!sweep && delta > 0)
|
|
323
|
+
delta -= 2 * Math.PI;
|
|
324
|
+
if (sweep && delta < 0)
|
|
325
|
+
delta += 2 * Math.PI;
|
|
326
|
+
const segs = Math.max(2, Math.min(maxSegments, Math.ceil(Math.abs(delta) / (Math.PI / 16))));
|
|
327
|
+
const pts = [];
|
|
328
|
+
for (let i = 1; i <= segs; i++) {
|
|
329
|
+
const t = theta1 + delta * i / segs;
|
|
330
|
+
const x = cosPhi * rx * Math.cos(t) - sinPhi * ry * Math.sin(t) + cx;
|
|
331
|
+
const y = sinPhi * rx * Math.cos(t) + cosPhi * ry * Math.sin(t) + cy;
|
|
332
|
+
pts.push([x, y]);
|
|
333
|
+
}
|
|
334
|
+
return pts;
|
|
335
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { LoadedDwfDocument } from '../format/document.js';
|
|
2
|
+
import type { PageRenderOptions, RenderStats } from '../format/types.js';
|
|
3
|
+
export interface DwfViewerOptions {
|
|
4
|
+
wasmUrl?: string;
|
|
5
|
+
preferWebgl?: boolean;
|
|
6
|
+
preferWasm?: boolean;
|
|
7
|
+
background?: string;
|
|
8
|
+
maxDevicePixelRatio?: number;
|
|
9
|
+
maxCanvasPixels?: number;
|
|
10
|
+
maxGpuCacheBytes?: number;
|
|
11
|
+
maxCachedScenes?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface LoadOptions extends PageRenderOptions {
|
|
14
|
+
fileName?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare class DwfViewer {
|
|
17
|
+
readonly root: HTMLDivElement;
|
|
18
|
+
readonly canvas: HTMLCanvasElement;
|
|
19
|
+
readonly webglCanvas: HTMLCanvasElement;
|
|
20
|
+
readonly pageSelect: HTMLSelectElement;
|
|
21
|
+
readonly status: HTMLSpanElement;
|
|
22
|
+
readonly treePanel: HTMLDivElement;
|
|
23
|
+
private readonly zoomInButton;
|
|
24
|
+
private readonly zoomOutButton;
|
|
25
|
+
private readonly resetButton;
|
|
26
|
+
private doc?;
|
|
27
|
+
private renderer?;
|
|
28
|
+
private pageIndex;
|
|
29
|
+
private zoom;
|
|
30
|
+
private panX;
|
|
31
|
+
private panY;
|
|
32
|
+
private preferWebgl;
|
|
33
|
+
private preferWasm;
|
|
34
|
+
private wasmUrl?;
|
|
35
|
+
private background;
|
|
36
|
+
private maxDevicePixelRatio;
|
|
37
|
+
private maxCanvasPixels;
|
|
38
|
+
private maxGpuCacheBytes?;
|
|
39
|
+
private maxCachedScenes?;
|
|
40
|
+
private drag?;
|
|
41
|
+
private yaw;
|
|
42
|
+
private pitch;
|
|
43
|
+
private pendingRender?;
|
|
44
|
+
private renderRaf;
|
|
45
|
+
private renderSeq;
|
|
46
|
+
private currentDpr;
|
|
47
|
+
constructor(container: HTMLElement, options?: DwfViewerOptions);
|
|
48
|
+
setPreferWebgl(value: boolean): void;
|
|
49
|
+
setPreferWasm(value: boolean): void;
|
|
50
|
+
load(input: ArrayBuffer | Uint8Array | Blob | File, options?: LoadOptions): Promise<void>;
|
|
51
|
+
render(): Promise<RenderStats | undefined>;
|
|
52
|
+
getDocument(): LoadedDwfDocument | undefined;
|
|
53
|
+
fit(): void;
|
|
54
|
+
dispose(): void;
|
|
55
|
+
private requestRender;
|
|
56
|
+
private populatePages;
|
|
57
|
+
private populateModelTree;
|
|
58
|
+
private resizeCanvasToDisplaySize;
|
|
59
|
+
private resetView;
|
|
60
|
+
private zoomAtCenter;
|
|
61
|
+
private zoomAroundPoint;
|
|
62
|
+
private onWheel;
|
|
63
|
+
private onPointerDown;
|
|
64
|
+
private onPointerMove;
|
|
65
|
+
private is3dPage;
|
|
66
|
+
private pagePointAtCanvasPoint;
|
|
67
|
+
private pageMatrixAt;
|
|
68
|
+
private setStatus;
|
|
69
|
+
}
|