presenter 0.9.3 → 0.10.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/dist/3d/index.d.ts +17 -0
- package/dist/3d/objects/ThreeBox.d.ts +9 -0
- package/dist/3d/objects/ThreeCameraType.d.ts +5 -0
- package/dist/3d/objects/ThreeMesh.d.ts +30 -0
- package/dist/3d/objects/ThreeModel.d.ts +18 -0
- package/dist/3d/objects/ThreeModelMaterial.d.ts +11 -0
- package/dist/3d/objects/ThreeModelNode.d.ts +24 -0
- package/dist/3d/objects/ThreeModelTarget.d.ts +9 -0
- package/dist/3d/objects/ThreeObjectType.d.ts +10 -0
- package/dist/3d/objects/ThreePresenterGroup.d.ts +13 -0
- package/dist/3d/objects/ThreeScene.d.ts +39 -0
- package/dist/3d/objects/ThreeSphere.d.ts +9 -0
- package/dist/3d/renderers/getThreeObjectRenderers.d.ts +6 -0
- package/dist/3d/renderers/renderThreeSceneFallback.d.ts +3 -0
- package/dist/3d/renderers/renderThreeScenePowerPointFallback.d.ts +3 -0
- package/dist/3d/renderers/threeFallbackRenderers.d.ts +5 -0
- package/dist/3d/types/ThreeModules.d.ts +10 -0
- package/dist/3d/utils/colorToThreeHex.d.ts +2 -0
- package/dist/3d/utils/inspectThreeModel.d.ts +4 -0
- package/dist/3d/utils/installThreeSceneCaptureApi.d.ts +21 -0
- package/dist/3d/utils/loadThreeModules.d.ts +2 -0
- package/dist/3d/utils/modelCache.d.ts +6 -0
- package/dist/3d/utils/modelInspection.d.ts +23 -0
- package/dist/3d/utils/modelInspection.test.d.ts +1 -0
- package/dist/3d/utils/modelPaths.d.ts +14 -0
- package/dist/3d/utils/modelPaths.test.d.ts +1 -0
- package/dist/3d.js +2 -0
- package/dist/3d.js.map +1 -0
- package/dist/3d.mjs +1055 -0
- package/dist/3d.mjs.map +1 -0
- package/dist/export/browser-image-renderer/BrowserImageRenderer.d.ts +7 -0
- package/dist/export/browser-image-renderer/types/BrowserImageRendererProps.d.ts +36 -0
- package/dist/export/browser.d.ts +2 -0
- package/dist/export/image-renderer/ImageRenderer.d.ts +1 -1
- package/dist/export/index.d.ts +2 -0
- package/dist/export/utils/getImageExportFrames.d.ts +14 -0
- package/dist/export/utils/getImageExportFrames.test.d.ts +1 -0
- package/dist/export-browser.js +6 -0
- package/dist/export-browser.js.map +1 -0
- package/dist/export-browser.mjs +2231 -0
- package/dist/export-browser.mjs.map +1 -0
- package/dist/export.js +74 -72
- package/dist/export.js.map +1 -1
- package/dist/export.mjs +5443 -4333
- package/dist/export.mjs.map +1 -1
- package/dist/objects/Image.d.ts +2 -1
- package/dist/presenter.js +5 -5
- package/dist/presenter.js.map +1 -1
- package/dist/presenter.mjs +1820 -1794
- package/dist/presenter.mjs.map +1 -1
- package/dist/renderer/browser-canvas/types/BrowserCanvasObjectRenderer.d.ts +8 -1
- package/dist/renderer/browser-canvas/utils/text/getTextLayout.d.ts +4 -11
- package/dist/renderer/browser-canvas/utils/text/getTextUnitMeasurements.d.ts +9 -0
- package/dist/utils/presentation/getImagePathUrlById.d.ts +2 -0
- package/dist/utils/presentation/getObjectChildren.d.ts +1 -1
- package/package.json +23 -3
package/dist/3d.mjs
ADDED
|
@@ -0,0 +1,1055 @@
|
|
|
1
|
+
const W = {
|
|
2
|
+
IMAGE: "Image",
|
|
3
|
+
SLIDE_OBJECT: "SlideObject"
|
|
4
|
+
};
|
|
5
|
+
function y(e) {
|
|
6
|
+
return {
|
|
7
|
+
description: null,
|
|
8
|
+
objectType: W.SLIDE_OBJECT,
|
|
9
|
+
opacity: 1,
|
|
10
|
+
...e
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function h(e, t = 0, r = 0, n = 1) {
|
|
14
|
+
if (typeof e == "string") {
|
|
15
|
+
const a = e.replace("#", ""), o = parseInt(a, 16);
|
|
16
|
+
return isNaN(o) ? (console.warn("Invalid hex color format:", e), $) : a.length === 6 ? {
|
|
17
|
+
red: o >> 16 & 255,
|
|
18
|
+
green: o >> 8 & 255,
|
|
19
|
+
blue: o & 255,
|
|
20
|
+
alpha: 1
|
|
21
|
+
} : a.length === 8 ? {
|
|
22
|
+
red: o >> 24 & 255,
|
|
23
|
+
green: o >> 16 & 255,
|
|
24
|
+
blue: o >> 8 & 255,
|
|
25
|
+
alpha: (o & 255) / 255
|
|
26
|
+
} : (console.warn("Invalid hex color format:", e), $);
|
|
27
|
+
} else if (typeof e == "number")
|
|
28
|
+
return {
|
|
29
|
+
red: e,
|
|
30
|
+
green: t ?? 0,
|
|
31
|
+
blue: r ?? 0,
|
|
32
|
+
alpha: n ?? 1
|
|
33
|
+
};
|
|
34
|
+
return {
|
|
35
|
+
red: 0,
|
|
36
|
+
green: 0,
|
|
37
|
+
blue: 0,
|
|
38
|
+
alpha: 1,
|
|
39
|
+
...e
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
h.BLACK = h(0, 0, 0);
|
|
43
|
+
h.BLUE = h(0, 0, 255);
|
|
44
|
+
h.GREEN = h(0, 255, 0);
|
|
45
|
+
h.RED = h(255, 0, 0);
|
|
46
|
+
h.TRANSPARENT = h(0, 0, 0, 0);
|
|
47
|
+
h.WHITE = h(255, 255, 255);
|
|
48
|
+
const $ = { red: 0, green: 0, blue: 0, alpha: 1 }, u = {
|
|
49
|
+
x: 0,
|
|
50
|
+
y: 0,
|
|
51
|
+
z: 0,
|
|
52
|
+
rotationX: 0,
|
|
53
|
+
rotationY: 0,
|
|
54
|
+
rotationZ: 0,
|
|
55
|
+
scale: 1,
|
|
56
|
+
scaleX: 1,
|
|
57
|
+
scaleY: 1,
|
|
58
|
+
scaleZ: 1,
|
|
59
|
+
color: h.WHITE,
|
|
60
|
+
wireframe: !1
|
|
61
|
+
}, s = {
|
|
62
|
+
BOX: "ThreeBox",
|
|
63
|
+
MODEL: "ThreeModel",
|
|
64
|
+
MODEL_MATERIAL: "ThreeModelMaterial",
|
|
65
|
+
MODEL_NODE: "ThreeModelNode",
|
|
66
|
+
PRESENTER_GROUP: "ThreePresenterGroup",
|
|
67
|
+
SCENE: "ThreeScene",
|
|
68
|
+
SPHERE: "ThreeSphere"
|
|
69
|
+
};
|
|
70
|
+
function Ve(e = null) {
|
|
71
|
+
return y({
|
|
72
|
+
objectType: s.BOX,
|
|
73
|
+
...u,
|
|
74
|
+
width: 1,
|
|
75
|
+
height: 1,
|
|
76
|
+
depth: 1,
|
|
77
|
+
...e
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
const S = {
|
|
81
|
+
ORTHOGRAPHIC: "Orthographic",
|
|
82
|
+
PERSPECTIVE: "Perspective"
|
|
83
|
+
};
|
|
84
|
+
function Je(e = null) {
|
|
85
|
+
return y({
|
|
86
|
+
objectType: s.MODEL,
|
|
87
|
+
...u,
|
|
88
|
+
src: "",
|
|
89
|
+
materialColor: null,
|
|
90
|
+
nodes: [],
|
|
91
|
+
materials: [],
|
|
92
|
+
debugNames: !1,
|
|
93
|
+
...e
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
function qe(e = null) {
|
|
97
|
+
return y({
|
|
98
|
+
objectType: s.MODEL_MATERIAL,
|
|
99
|
+
name: null,
|
|
100
|
+
presenterId: null,
|
|
101
|
+
materialColor: null,
|
|
102
|
+
wireframe: !1,
|
|
103
|
+
...e
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
function ze(e = null) {
|
|
107
|
+
return y({
|
|
108
|
+
objectType: s.MODEL_NODE,
|
|
109
|
+
name: null,
|
|
110
|
+
path: null,
|
|
111
|
+
presenterId: null,
|
|
112
|
+
x: u.x,
|
|
113
|
+
y: u.y,
|
|
114
|
+
z: u.z,
|
|
115
|
+
rotationX: u.rotationX,
|
|
116
|
+
rotationY: u.rotationY,
|
|
117
|
+
rotationZ: u.rotationZ,
|
|
118
|
+
scale: u.scale,
|
|
119
|
+
scaleX: u.scaleX,
|
|
120
|
+
scaleY: u.scaleY,
|
|
121
|
+
scaleZ: u.scaleZ,
|
|
122
|
+
materialColor: null,
|
|
123
|
+
wireframe: u.wireframe,
|
|
124
|
+
...e
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
function Qe(e, t = null) {
|
|
128
|
+
return y({
|
|
129
|
+
objectType: s.PRESENTER_GROUP,
|
|
130
|
+
...u,
|
|
131
|
+
objects: e,
|
|
132
|
+
width: 1,
|
|
133
|
+
height: 1,
|
|
134
|
+
textureWidth: null,
|
|
135
|
+
textureHeight: null,
|
|
136
|
+
doubleSided: !0,
|
|
137
|
+
...t
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
const m = {
|
|
141
|
+
TOP_LEFT: "TopLeft",
|
|
142
|
+
TOP: "Top",
|
|
143
|
+
TOP_RIGHT: "TopRight",
|
|
144
|
+
LEFT: "Left",
|
|
145
|
+
CENTER: "Center",
|
|
146
|
+
RIGHT: "Right",
|
|
147
|
+
BOTTOM_LEFT: "BottomLeft",
|
|
148
|
+
BOTTOM: "Bottom",
|
|
149
|
+
BOTTOM_RIGHT: "BottomRight"
|
|
150
|
+
}, K = m.TOP_LEFT;
|
|
151
|
+
function je(e, t = null) {
|
|
152
|
+
return y({
|
|
153
|
+
objectType: s.SCENE,
|
|
154
|
+
anchor: K,
|
|
155
|
+
x: 0,
|
|
156
|
+
y: 0,
|
|
157
|
+
width: 100,
|
|
158
|
+
height: 100,
|
|
159
|
+
meshes: e,
|
|
160
|
+
fallbackImageId: null,
|
|
161
|
+
fallbackImagePath: null,
|
|
162
|
+
fallbackCornerRadius: 0,
|
|
163
|
+
fallbackSmooth: !0,
|
|
164
|
+
cameraType: S.PERSPECTIVE,
|
|
165
|
+
cameraX: 0,
|
|
166
|
+
cameraY: 0,
|
|
167
|
+
cameraZ: 5,
|
|
168
|
+
cameraFov: 50,
|
|
169
|
+
cameraOrthographicHeight: null,
|
|
170
|
+
cameraNear: 0.1,
|
|
171
|
+
cameraFar: 2e3,
|
|
172
|
+
targetX: 0,
|
|
173
|
+
targetY: 0,
|
|
174
|
+
targetZ: 0,
|
|
175
|
+
backgroundColor: null,
|
|
176
|
+
ambientLightColor: h.WHITE,
|
|
177
|
+
ambientLightIntensity: 1,
|
|
178
|
+
directionalLightColor: h.WHITE,
|
|
179
|
+
directionalLightIntensity: 2,
|
|
180
|
+
directionalLightX: 3,
|
|
181
|
+
directionalLightY: 4,
|
|
182
|
+
directionalLightZ: 5,
|
|
183
|
+
...t
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
function et(e = null) {
|
|
187
|
+
return y({
|
|
188
|
+
objectType: s.SPHERE,
|
|
189
|
+
...u,
|
|
190
|
+
radius: 1,
|
|
191
|
+
widthSegments: 32,
|
|
192
|
+
heightSegments: 16,
|
|
193
|
+
...e
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
const I = {
|
|
197
|
+
Browser: "browser",
|
|
198
|
+
Node: "node"
|
|
199
|
+
};
|
|
200
|
+
function p(e = null) {
|
|
201
|
+
return {
|
|
202
|
+
x: 0,
|
|
203
|
+
y: 0,
|
|
204
|
+
...e
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
const ie = p();
|
|
208
|
+
function N(e = null) {
|
|
209
|
+
return {
|
|
210
|
+
height: 0,
|
|
211
|
+
width: 0,
|
|
212
|
+
...e
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
const le = N({ width: 0, height: 0 });
|
|
216
|
+
function E(e, t = null) {
|
|
217
|
+
return e.alpha * (t ?? 1);
|
|
218
|
+
}
|
|
219
|
+
function g(e = null) {
|
|
220
|
+
return {
|
|
221
|
+
origin: ie,
|
|
222
|
+
size: le,
|
|
223
|
+
...e
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
g();
|
|
227
|
+
function D(e, t) {
|
|
228
|
+
throw new Error("Unexpected value: " + e);
|
|
229
|
+
}
|
|
230
|
+
function F(e, t, r) {
|
|
231
|
+
const { x: n, y: a } = e, { width: o, height: i } = r;
|
|
232
|
+
switch (t) {
|
|
233
|
+
case m.TOP_LEFT:
|
|
234
|
+
return g({
|
|
235
|
+
origin: p({ x: n, y: a }),
|
|
236
|
+
size: r
|
|
237
|
+
});
|
|
238
|
+
case m.TOP:
|
|
239
|
+
return g({
|
|
240
|
+
origin: p({ x: n - o / 2, y: a }),
|
|
241
|
+
size: r
|
|
242
|
+
});
|
|
243
|
+
case m.TOP_RIGHT:
|
|
244
|
+
return g({
|
|
245
|
+
origin: p({ x: n - o, y: a }),
|
|
246
|
+
size: r
|
|
247
|
+
});
|
|
248
|
+
case m.LEFT:
|
|
249
|
+
return g({
|
|
250
|
+
origin: p({ x: n, y: a - i / 2 }),
|
|
251
|
+
size: r
|
|
252
|
+
});
|
|
253
|
+
case m.CENTER:
|
|
254
|
+
return g({
|
|
255
|
+
origin: p({ x: n - o / 2, y: a - i / 2 }),
|
|
256
|
+
size: r
|
|
257
|
+
});
|
|
258
|
+
case m.RIGHT:
|
|
259
|
+
return g({
|
|
260
|
+
origin: p({ x: n - o, y: a - i / 2 }),
|
|
261
|
+
size: r
|
|
262
|
+
});
|
|
263
|
+
case m.BOTTOM_LEFT:
|
|
264
|
+
return g({
|
|
265
|
+
origin: p({ x: n, y: a - i }),
|
|
266
|
+
size: r
|
|
267
|
+
});
|
|
268
|
+
case m.BOTTOM:
|
|
269
|
+
return g({
|
|
270
|
+
origin: p({ x: n - o / 2, y: a - i }),
|
|
271
|
+
size: r
|
|
272
|
+
});
|
|
273
|
+
case m.BOTTOM_RIGHT:
|
|
274
|
+
return g({
|
|
275
|
+
origin: p({ x: n - o, y: a - i }),
|
|
276
|
+
size: r
|
|
277
|
+
});
|
|
278
|
+
default:
|
|
279
|
+
D(t);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
function M(e) {
|
|
283
|
+
return (e.red << 16) + (e.green << 8) + e.blue;
|
|
284
|
+
}
|
|
285
|
+
async function V() {
|
|
286
|
+
try {
|
|
287
|
+
const [e, t] = await Promise.all([
|
|
288
|
+
import("three"),
|
|
289
|
+
import("three/examples/jsm/loaders/GLTFLoader.js")
|
|
290
|
+
]);
|
|
291
|
+
return { THREE: e, GLTFLoader: t.GLTFLoader };
|
|
292
|
+
} catch (e) {
|
|
293
|
+
throw new Error(
|
|
294
|
+
'Presenter 3D rendering requires the "three" package. Install it with: npm install three',
|
|
295
|
+
{ cause: e }
|
|
296
|
+
);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
function ce(e) {
|
|
300
|
+
const t = [], r = e;
|
|
301
|
+
for (const n of ["objects", "meshes", "nodes", "materials"]) {
|
|
302
|
+
const a = r[n];
|
|
303
|
+
Array.isArray(a) && t.push(...se(a));
|
|
304
|
+
}
|
|
305
|
+
return t;
|
|
306
|
+
}
|
|
307
|
+
function se(e) {
|
|
308
|
+
return e.filter(
|
|
309
|
+
(t) => typeof t == "object" && t !== null && "objectType" in t
|
|
310
|
+
);
|
|
311
|
+
}
|
|
312
|
+
function J(e) {
|
|
313
|
+
const t = [];
|
|
314
|
+
function r(n, a) {
|
|
315
|
+
const o = n === e && n.name === "" ? a : [...a, n.name];
|
|
316
|
+
(n !== e || n.name !== "") && t.push({ object: n, path: o });
|
|
317
|
+
for (const i of n.children)
|
|
318
|
+
r(i, o);
|
|
319
|
+
}
|
|
320
|
+
return r(e, []), t;
|
|
321
|
+
}
|
|
322
|
+
function q(e) {
|
|
323
|
+
return typeof e == "string" ? e.split("/").filter((t) => t !== "") : e;
|
|
324
|
+
}
|
|
325
|
+
function A(e) {
|
|
326
|
+
return e.join("/");
|
|
327
|
+
}
|
|
328
|
+
function ue(e) {
|
|
329
|
+
return "path" in e && e.path !== null ? `path "${A(q(e.path))}"` : e.presenterId !== null ? `presenterId "${e.presenterId}"` : e.name !== null ? `name "${e.name}"` : "empty target";
|
|
330
|
+
}
|
|
331
|
+
function he(e, t) {
|
|
332
|
+
const r = q(t);
|
|
333
|
+
if (r.length > e.length)
|
|
334
|
+
return !1;
|
|
335
|
+
const n = e.length - r.length;
|
|
336
|
+
return r.every((a, o) => e[n + o] === a);
|
|
337
|
+
}
|
|
338
|
+
function B(e) {
|
|
339
|
+
var r, n;
|
|
340
|
+
const t = ((r = e.userData) == null ? void 0 : r.presenterId) ?? ((n = e.userData) == null ? void 0 : n.presenterID);
|
|
341
|
+
return typeof t == "string" ? t : null;
|
|
342
|
+
}
|
|
343
|
+
function z(e, t) {
|
|
344
|
+
const r = /* @__PURE__ */ new Map(), n = J(t).map(({ object: a, path: o }) => {
|
|
345
|
+
const i = X(a) ? Array.isArray(a.material) ? a.material : [a.material] : [], c = i.map((l) => l.name);
|
|
346
|
+
for (const l of i) {
|
|
347
|
+
const d = r.get(l), f = A(o);
|
|
348
|
+
d === void 0 ? r.set(l, {
|
|
349
|
+
name: l.name,
|
|
350
|
+
presenterId: B(l),
|
|
351
|
+
meshPaths: [f]
|
|
352
|
+
}) : r.set(l, {
|
|
353
|
+
...d,
|
|
354
|
+
meshPaths: [...d.meshPaths, f]
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
return {
|
|
358
|
+
name: a.name,
|
|
359
|
+
path: o,
|
|
360
|
+
pathString: A(o),
|
|
361
|
+
type: a.type,
|
|
362
|
+
isMesh: X(a),
|
|
363
|
+
isBone: de(a),
|
|
364
|
+
presenterId: B(a),
|
|
365
|
+
materialNames: c
|
|
366
|
+
};
|
|
367
|
+
});
|
|
368
|
+
return {
|
|
369
|
+
src: e,
|
|
370
|
+
nodes: n,
|
|
371
|
+
materials: [...r.values()]
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
function Q(e) {
|
|
375
|
+
var n;
|
|
376
|
+
const t = `ThreeModel ${e.src}`;
|
|
377
|
+
(console.groupCollapsed ?? console.group).call(console, t), console.table(
|
|
378
|
+
e.nodes.map((a) => ({
|
|
379
|
+
path: a.pathString,
|
|
380
|
+
name: a.name,
|
|
381
|
+
type: a.type,
|
|
382
|
+
presenterId: a.presenterId,
|
|
383
|
+
materials: a.materialNames.join(", ")
|
|
384
|
+
}))
|
|
385
|
+
), console.table(
|
|
386
|
+
e.materials.map((a) => ({
|
|
387
|
+
name: a.name,
|
|
388
|
+
presenterId: a.presenterId,
|
|
389
|
+
meshes: a.meshPaths.join(", ")
|
|
390
|
+
}))
|
|
391
|
+
), (n = console.groupEnd) == null || n.call(console);
|
|
392
|
+
}
|
|
393
|
+
function X(e) {
|
|
394
|
+
return "isMesh" in e && e.isMesh === !0;
|
|
395
|
+
}
|
|
396
|
+
function de(e) {
|
|
397
|
+
return "isBone" in e && e.isBone === !0;
|
|
398
|
+
}
|
|
399
|
+
const x = /* @__PURE__ */ new Map(), Y = /* @__PURE__ */ new Set();
|
|
400
|
+
async function fe(e, t) {
|
|
401
|
+
const r = /* @__PURE__ */ new Map();
|
|
402
|
+
for (const n of t.slides)
|
|
403
|
+
for (const a of n.objects)
|
|
404
|
+
ee(a, r);
|
|
405
|
+
await Promise.all(
|
|
406
|
+
[...r.values()].map(async (n) => {
|
|
407
|
+
try {
|
|
408
|
+
await j(e, n.src), n.debugNames && pe(n.src);
|
|
409
|
+
} catch (a) {
|
|
410
|
+
throw new Error(`Failed to load 3D model: ${n.src}`, { cause: a });
|
|
411
|
+
}
|
|
412
|
+
})
|
|
413
|
+
);
|
|
414
|
+
}
|
|
415
|
+
function _(e) {
|
|
416
|
+
const t = x.get(e);
|
|
417
|
+
return (t == null ? void 0 : t.status) === "loaded" ? t.scene : null;
|
|
418
|
+
}
|
|
419
|
+
function j(e, t) {
|
|
420
|
+
return me(e, t);
|
|
421
|
+
}
|
|
422
|
+
function ee(e, t) {
|
|
423
|
+
if (e.objectType === s.MODEL) {
|
|
424
|
+
const r = e;
|
|
425
|
+
if (r.src !== "") {
|
|
426
|
+
const n = t.get(r.src);
|
|
427
|
+
t.set(r.src, {
|
|
428
|
+
src: r.src,
|
|
429
|
+
debugNames: r.debugNames || (n == null ? void 0 : n.debugNames) === !0
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
for (const r of ce(e))
|
|
434
|
+
ee(r, t);
|
|
435
|
+
}
|
|
436
|
+
function pe(e) {
|
|
437
|
+
if (Y.has(e))
|
|
438
|
+
return;
|
|
439
|
+
const t = _(e);
|
|
440
|
+
t !== null && (Y.add(e), Q(z(e, t)));
|
|
441
|
+
}
|
|
442
|
+
function me(e, t) {
|
|
443
|
+
const r = x.get(t);
|
|
444
|
+
if ((r == null ? void 0 : r.status) === "loaded")
|
|
445
|
+
return Promise.resolve();
|
|
446
|
+
if ((r == null ? void 0 : r.status) === "loading")
|
|
447
|
+
return r.promise;
|
|
448
|
+
const n = new Promise((a, o) => {
|
|
449
|
+
e.load(
|
|
450
|
+
t,
|
|
451
|
+
(i) => {
|
|
452
|
+
x.set(t, { status: "loaded", scene: i.scene }), a();
|
|
453
|
+
},
|
|
454
|
+
void 0,
|
|
455
|
+
(i) => {
|
|
456
|
+
x.delete(t), o(i);
|
|
457
|
+
}
|
|
458
|
+
);
|
|
459
|
+
});
|
|
460
|
+
return x.set(t, { status: "loading", promise: n }), n;
|
|
461
|
+
}
|
|
462
|
+
const k = /* @__PURE__ */ new WeakMap(), Z = /* @__PURE__ */ new Set();
|
|
463
|
+
async function tt(e) {
|
|
464
|
+
const t = await V(), r = new t.GLTFLoader();
|
|
465
|
+
return await fe(r, e), {
|
|
466
|
+
[s.SCENE]: ye(
|
|
467
|
+
t
|
|
468
|
+
)
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
function ge(e) {
|
|
472
|
+
var t;
|
|
473
|
+
return ((t = k.get(e)) == null ? void 0 : t.renderer.domElement) ?? null;
|
|
474
|
+
}
|
|
475
|
+
function ye({ THREE: e }) {
|
|
476
|
+
return (t) => {
|
|
477
|
+
const { ctx: r, object: n, opacity: a, originalObject: o, getCurrentObject: i } = t;
|
|
478
|
+
if (r.type !== I.Browser)
|
|
479
|
+
return;
|
|
480
|
+
const c = a * n.opacity;
|
|
481
|
+
if (c === 0 || n.width <= 0 || n.height <= 0)
|
|
482
|
+
return;
|
|
483
|
+
const l = we(e, n, o);
|
|
484
|
+
l.renderer.setPixelRatio(window.devicePixelRatio || 1), l.renderer.setSize(n.width, n.height, !1), xe(l.scene), Me(e, l, n);
|
|
485
|
+
const d = o.objectType === s.SCENE ? o : n;
|
|
486
|
+
for (const P of d.meshes) {
|
|
487
|
+
const C = i(P);
|
|
488
|
+
if (C === void 0 || C.opacity === 0)
|
|
489
|
+
continue;
|
|
490
|
+
const O = Se(e, C, P, t);
|
|
491
|
+
O !== null && (_e(O, C), l.scene.add(O));
|
|
492
|
+
}
|
|
493
|
+
Te(e, l, n), l.camera.position.set(n.cameraX, n.cameraY, n.cameraZ), l.target.set(n.targetX, n.targetY, n.targetZ), l.camera.lookAt(l.target), l.camera.updateProjectionMatrix(), l.renderer.render(l.scene, l.camera);
|
|
494
|
+
const f = F(
|
|
495
|
+
p({ x: n.x, y: n.y }),
|
|
496
|
+
n.anchor,
|
|
497
|
+
N({ width: n.width, height: n.height })
|
|
498
|
+
);
|
|
499
|
+
r.context.save(), r.context.globalAlpha = c, r.context.drawImage(
|
|
500
|
+
l.renderer.domElement,
|
|
501
|
+
f.origin.x,
|
|
502
|
+
f.origin.y,
|
|
503
|
+
f.size.width,
|
|
504
|
+
f.size.height
|
|
505
|
+
), r.context.restore();
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
function we(e, t, r) {
|
|
509
|
+
const n = r.objectType === s.SCENE ? r : t, a = k.get(n);
|
|
510
|
+
if (a !== void 0)
|
|
511
|
+
return a;
|
|
512
|
+
const o = document.createElement("canvas"), c = {
|
|
513
|
+
renderer: new e.WebGLRenderer({
|
|
514
|
+
alpha: !0,
|
|
515
|
+
antialias: !0,
|
|
516
|
+
canvas: o,
|
|
517
|
+
preserveDrawingBuffer: !0
|
|
518
|
+
}),
|
|
519
|
+
scene: new e.Scene(),
|
|
520
|
+
camera: te(e, t),
|
|
521
|
+
cameraType: t.cameraType,
|
|
522
|
+
target: new e.Vector3()
|
|
523
|
+
};
|
|
524
|
+
return k.set(n, c), c;
|
|
525
|
+
}
|
|
526
|
+
function Te(e, t, r) {
|
|
527
|
+
switch (t.cameraType !== r.cameraType && (t.camera = te(e, r), t.cameraType = r.cameraType), r.cameraType) {
|
|
528
|
+
case S.PERSPECTIVE: {
|
|
529
|
+
const n = t.camera;
|
|
530
|
+
n.aspect = r.width / r.height, n.fov = r.cameraFov, n.near = r.cameraNear, n.far = r.cameraFar;
|
|
531
|
+
break;
|
|
532
|
+
}
|
|
533
|
+
case S.ORTHOGRAPHIC: {
|
|
534
|
+
const n = t.camera, a = re(r), o = a * (r.width / r.height);
|
|
535
|
+
n.left = -o / 2, n.right = o / 2, n.top = a / 2, n.bottom = -a / 2, n.near = r.cameraNear, n.far = r.cameraFar;
|
|
536
|
+
break;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
function te(e, t) {
|
|
541
|
+
switch (t.cameraType) {
|
|
542
|
+
case S.PERSPECTIVE:
|
|
543
|
+
return new e.PerspectiveCamera(
|
|
544
|
+
t.cameraFov,
|
|
545
|
+
t.width / t.height,
|
|
546
|
+
t.cameraNear,
|
|
547
|
+
t.cameraFar
|
|
548
|
+
);
|
|
549
|
+
case S.ORTHOGRAPHIC:
|
|
550
|
+
return Ie(e, t);
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
function Ie(e, t) {
|
|
554
|
+
const r = re(t), n = r * (t.width / t.height);
|
|
555
|
+
return new e.OrthographicCamera(
|
|
556
|
+
-n / 2,
|
|
557
|
+
n / 2,
|
|
558
|
+
r / 2,
|
|
559
|
+
-r / 2,
|
|
560
|
+
t.cameraNear,
|
|
561
|
+
t.cameraFar
|
|
562
|
+
);
|
|
563
|
+
}
|
|
564
|
+
function re(e) {
|
|
565
|
+
if (e.cameraOrthographicHeight !== null && e.cameraOrthographicHeight > 0)
|
|
566
|
+
return e.cameraOrthographicHeight;
|
|
567
|
+
const t = Math.hypot(
|
|
568
|
+
e.cameraX - e.targetX,
|
|
569
|
+
e.cameraY - e.targetY,
|
|
570
|
+
e.cameraZ - e.targetZ
|
|
571
|
+
);
|
|
572
|
+
return t === 0 ? e.height : 2 * t * Math.tan(w(e.cameraFov) / 2);
|
|
573
|
+
}
|
|
574
|
+
function Me(e, t, r) {
|
|
575
|
+
r.backgroundColor === null ? t.renderer.setClearColor(0, 0) : t.renderer.setClearColor(
|
|
576
|
+
M(r.backgroundColor),
|
|
577
|
+
E(r.backgroundColor)
|
|
578
|
+
);
|
|
579
|
+
const n = new e.AmbientLight(
|
|
580
|
+
M(r.ambientLightColor),
|
|
581
|
+
r.ambientLightIntensity
|
|
582
|
+
);
|
|
583
|
+
t.scene.add(n);
|
|
584
|
+
const a = new e.DirectionalLight(
|
|
585
|
+
M(r.directionalLightColor),
|
|
586
|
+
r.directionalLightIntensity
|
|
587
|
+
);
|
|
588
|
+
a.position.set(
|
|
589
|
+
r.directionalLightX,
|
|
590
|
+
r.directionalLightY,
|
|
591
|
+
r.directionalLightZ
|
|
592
|
+
), t.scene.add(a);
|
|
593
|
+
}
|
|
594
|
+
function xe(e) {
|
|
595
|
+
for (; e.children.length > 0; ) {
|
|
596
|
+
const t = e.children[0];
|
|
597
|
+
t !== void 0 && (be(t), e.remove(t));
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
function Se(e, t, r, n) {
|
|
601
|
+
switch (t.objectType) {
|
|
602
|
+
case s.BOX:
|
|
603
|
+
return Ee(e, t);
|
|
604
|
+
case s.SPHERE:
|
|
605
|
+
return Pe(e, t);
|
|
606
|
+
case s.MODEL:
|
|
607
|
+
return Le(
|
|
608
|
+
e,
|
|
609
|
+
t,
|
|
610
|
+
r,
|
|
611
|
+
n.getCurrentObject
|
|
612
|
+
);
|
|
613
|
+
case s.PRESENTER_GROUP:
|
|
614
|
+
return Ce(e, t, n);
|
|
615
|
+
default:
|
|
616
|
+
return null;
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
function Ee(e, t) {
|
|
620
|
+
const r = new e.BoxGeometry(t.width, t.height, t.depth);
|
|
621
|
+
return T(r), new e.Mesh(r, ne(e, t));
|
|
622
|
+
}
|
|
623
|
+
function Pe(e, t) {
|
|
624
|
+
const r = new e.SphereGeometry(
|
|
625
|
+
t.radius,
|
|
626
|
+
t.widthSegments,
|
|
627
|
+
t.heightSegments
|
|
628
|
+
);
|
|
629
|
+
return T(r), new e.Mesh(r, ne(e, t));
|
|
630
|
+
}
|
|
631
|
+
function Ce(e, t, r) {
|
|
632
|
+
const n = t.textureWidth ?? r.slideSize.width, a = t.textureHeight ?? r.slideSize.height;
|
|
633
|
+
if (t.width <= 0 || t.height <= 0 || n <= 0 || a <= 0)
|
|
634
|
+
return null;
|
|
635
|
+
const o = document.createElement("canvas");
|
|
636
|
+
o.width = Math.ceil(n), o.height = Math.ceil(a);
|
|
637
|
+
const i = o.getContext("2d");
|
|
638
|
+
if (i === null)
|
|
639
|
+
return null;
|
|
640
|
+
i.clearRect(0, 0, o.width, o.height);
|
|
641
|
+
const c = {
|
|
642
|
+
type: I.Browser,
|
|
643
|
+
context: i
|
|
644
|
+
};
|
|
645
|
+
for (const P of t.objects)
|
|
646
|
+
r.renderObject(P, 1, c);
|
|
647
|
+
const l = new e.CanvasTexture(o);
|
|
648
|
+
l.colorSpace = e.SRGBColorSpace, T(l);
|
|
649
|
+
const d = new e.PlaneGeometry(t.width, t.height);
|
|
650
|
+
T(d);
|
|
651
|
+
const f = new e.MeshBasicMaterial({
|
|
652
|
+
color: M(t.color),
|
|
653
|
+
map: l,
|
|
654
|
+
opacity: t.opacity * E(t.color),
|
|
655
|
+
side: t.doubleSided ? e.DoubleSide : e.FrontSide,
|
|
656
|
+
transparent: !0,
|
|
657
|
+
wireframe: t.wireframe
|
|
658
|
+
});
|
|
659
|
+
return T(f), new e.Mesh(d, f);
|
|
660
|
+
}
|
|
661
|
+
function Le(e, t, r, n) {
|
|
662
|
+
if (t.src === "")
|
|
663
|
+
return null;
|
|
664
|
+
const a = _(t.src);
|
|
665
|
+
if (a === null)
|
|
666
|
+
return console.warn(`3D model was not preloaded: ${t.src}`), null;
|
|
667
|
+
const o = a.clone(!0);
|
|
668
|
+
return Be(o, t), ve(o, t, r, n), Ne(o, t, r, n), o;
|
|
669
|
+
}
|
|
670
|
+
function ne(e, t) {
|
|
671
|
+
const r = new e.MeshStandardMaterial({
|
|
672
|
+
color: M(t.color),
|
|
673
|
+
opacity: t.opacity * E(t.color),
|
|
674
|
+
transparent: t.opacity < 1 || E(t.color) < 1,
|
|
675
|
+
wireframe: t.wireframe
|
|
676
|
+
});
|
|
677
|
+
return T(r), r;
|
|
678
|
+
}
|
|
679
|
+
function Be(e, t) {
|
|
680
|
+
G(t) && e.traverse((r) => {
|
|
681
|
+
R(r) && b(r, t, () => !0);
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
function ve(e, t, r, n) {
|
|
685
|
+
for (const a of r.materials) {
|
|
686
|
+
const o = n(a) ?? a;
|
|
687
|
+
if (!G(o))
|
|
688
|
+
continue;
|
|
689
|
+
let i = 0;
|
|
690
|
+
e.traverse((c) => {
|
|
691
|
+
R(c) && b(c, o, (l) => {
|
|
692
|
+
const d = Ae(l, o);
|
|
693
|
+
return d && i++, d;
|
|
694
|
+
});
|
|
695
|
+
}), ae(t.src, "material", o, i);
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
function Ne(e, t, r, n) {
|
|
699
|
+
const a = J(e);
|
|
700
|
+
for (const o of r.nodes) {
|
|
701
|
+
const i = n(o) ?? o, c = a.filter((l) => De(l, i));
|
|
702
|
+
ae(t.src, "node", i, c.length);
|
|
703
|
+
for (const l of c)
|
|
704
|
+
Re(l.object, i), G(i) && Oe(l.object, i);
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
function Re(e, t) {
|
|
708
|
+
e.position.set(
|
|
709
|
+
e.position.x + t.x,
|
|
710
|
+
e.position.y + t.y,
|
|
711
|
+
e.position.z + t.z
|
|
712
|
+
), e.rotation.set(
|
|
713
|
+
e.rotation.x + w(t.rotationX),
|
|
714
|
+
e.rotation.y + w(t.rotationY),
|
|
715
|
+
e.rotation.z + w(t.rotationZ)
|
|
716
|
+
), e.scale.set(
|
|
717
|
+
e.scale.x * t.scale * t.scaleX,
|
|
718
|
+
e.scale.y * t.scale * t.scaleY,
|
|
719
|
+
e.scale.z * t.scale * t.scaleZ
|
|
720
|
+
);
|
|
721
|
+
}
|
|
722
|
+
function Oe(e, t) {
|
|
723
|
+
e.traverse((r) => {
|
|
724
|
+
R(r) && b(r, t, () => !0);
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
function De(e, t) {
|
|
728
|
+
return t.path !== null ? he(e.path, t.path) : t.presenterId !== null ? B(e.object) === t.presenterId : t.name !== null ? e.object.name === t.name : !1;
|
|
729
|
+
}
|
|
730
|
+
function Ae(e, t) {
|
|
731
|
+
return t.presenterId !== null ? B(e) === t.presenterId : t.name !== null ? e.name === t.name : !1;
|
|
732
|
+
}
|
|
733
|
+
function ae(e, t, r, n) {
|
|
734
|
+
if (n === 1 || t === "material" && n > 1)
|
|
735
|
+
return;
|
|
736
|
+
const a = ue(r), o = `${e}:${t}:${a}:${n}`;
|
|
737
|
+
if (Z.has(o))
|
|
738
|
+
return;
|
|
739
|
+
Z.add(o);
|
|
740
|
+
const i = n === 0 ? `ThreeModel ${e} did not find ${t} target ${a}.` : `ThreeModel ${e} found ${n} ${t} targets for ${a}. Use a path or presenterId to make the target unique.`;
|
|
741
|
+
console.warn(i);
|
|
742
|
+
}
|
|
743
|
+
function b(e, t, r) {
|
|
744
|
+
const n = Array.isArray(e.material) ? e.material : [e.material];
|
|
745
|
+
let a = !1;
|
|
746
|
+
const o = n.map((i) => {
|
|
747
|
+
if (!r(i))
|
|
748
|
+
return i;
|
|
749
|
+
a = !0;
|
|
750
|
+
const c = ke(i);
|
|
751
|
+
return Fe(c, t), c;
|
|
752
|
+
});
|
|
753
|
+
if (a)
|
|
754
|
+
if (Array.isArray(e.material))
|
|
755
|
+
e.material = o;
|
|
756
|
+
else {
|
|
757
|
+
const i = o[0];
|
|
758
|
+
i !== void 0 && (e.material = i);
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
function ke(e) {
|
|
762
|
+
if (v(e))
|
|
763
|
+
return e;
|
|
764
|
+
const t = e.clone();
|
|
765
|
+
return T(t), t;
|
|
766
|
+
}
|
|
767
|
+
function Fe(e, t) {
|
|
768
|
+
t.materialColor !== null && e.color !== void 0 && e.color.setHex(M(t.materialColor));
|
|
769
|
+
const r = e.opacity * t.opacity * (t.materialColor !== null ? E(t.materialColor) : 1);
|
|
770
|
+
r !== e.opacity && (e.opacity = r, e.transparent = !0), t.wireframe && (e.wireframe = !0);
|
|
771
|
+
}
|
|
772
|
+
function G(e) {
|
|
773
|
+
return e.materialColor !== null || e.opacity !== 1 || e.wireframe;
|
|
774
|
+
}
|
|
775
|
+
function _e(e, t) {
|
|
776
|
+
e.position.set(t.x, t.y, t.z), e.rotation.set(
|
|
777
|
+
w(t.rotationX),
|
|
778
|
+
w(t.rotationY),
|
|
779
|
+
w(t.rotationZ)
|
|
780
|
+
), e.scale.set(t.scale * t.scaleX, t.scale * t.scaleY, t.scale * t.scaleZ);
|
|
781
|
+
}
|
|
782
|
+
function w(e) {
|
|
783
|
+
return e * Math.PI / 180;
|
|
784
|
+
}
|
|
785
|
+
function be(e) {
|
|
786
|
+
e.traverse((t) => {
|
|
787
|
+
if (!R(t))
|
|
788
|
+
return;
|
|
789
|
+
v(t.geometry) && t.geometry.dispose();
|
|
790
|
+
const r = Array.isArray(t.material) ? t.material : [t.material];
|
|
791
|
+
for (const n of r)
|
|
792
|
+
Ge(n), v(n) && n.dispose();
|
|
793
|
+
});
|
|
794
|
+
}
|
|
795
|
+
function R(e) {
|
|
796
|
+
return "isMesh" in e && e.isMesh === !0;
|
|
797
|
+
}
|
|
798
|
+
function Ge(e) {
|
|
799
|
+
const t = e;
|
|
800
|
+
t.map !== void 0 && t.map !== null && v(t.map) && t.map.dispose();
|
|
801
|
+
}
|
|
802
|
+
function T(e) {
|
|
803
|
+
e.userData.presenterRendererOwned = !0;
|
|
804
|
+
}
|
|
805
|
+
function v(e) {
|
|
806
|
+
var t;
|
|
807
|
+
return ((t = e.userData) == null ? void 0 : t.presenterRendererOwned) === !0;
|
|
808
|
+
}
|
|
809
|
+
function oe(e = null) {
|
|
810
|
+
return y({
|
|
811
|
+
objectType: W.IMAGE,
|
|
812
|
+
anchor: K,
|
|
813
|
+
cornerRadius: 0,
|
|
814
|
+
height: 100,
|
|
815
|
+
imageId: null,
|
|
816
|
+
imagePath: null,
|
|
817
|
+
smooth: !0,
|
|
818
|
+
width: 100,
|
|
819
|
+
x: 0,
|
|
820
|
+
y: 0,
|
|
821
|
+
...e
|
|
822
|
+
});
|
|
823
|
+
}
|
|
824
|
+
function $e(e, t, r, n, a = 0) {
|
|
825
|
+
const o = n();
|
|
826
|
+
o.path.moveTo(e.x + r, e.y), o.path.lineTo(e.x + t.width - r, e.y), o.path.arcTo(
|
|
827
|
+
e.x + t.width,
|
|
828
|
+
e.y,
|
|
829
|
+
e.x + t.width,
|
|
830
|
+
e.y + r,
|
|
831
|
+
r
|
|
832
|
+
), o.path.lineTo(e.x + t.width, e.y + t.height - r), o.path.arcTo(
|
|
833
|
+
e.x + t.width,
|
|
834
|
+
e.y + t.height,
|
|
835
|
+
e.x + t.width - r,
|
|
836
|
+
e.y + t.height,
|
|
837
|
+
r
|
|
838
|
+
), o.path.lineTo(e.x + r, e.y + t.height), o.path.arcTo(
|
|
839
|
+
e.x,
|
|
840
|
+
e.y + t.height,
|
|
841
|
+
e.x,
|
|
842
|
+
e.y + t.height - r,
|
|
843
|
+
r
|
|
844
|
+
), o.path.lineTo(e.x, e.y + r), o.path.arcTo(e.x, e.y, e.x + r, e.y, r), a > 0 && o.path.lineTo(e.x + r + a, e.y);
|
|
845
|
+
const i = 2 * (t.width + t.height - 4 * r) + 2 * Math.PI * r + a;
|
|
846
|
+
return { path: o, length: i };
|
|
847
|
+
}
|
|
848
|
+
const H = {
|
|
849
|
+
Browser: "browser",
|
|
850
|
+
Node: "node"
|
|
851
|
+
}, U = {
|
|
852
|
+
Browser: "browser",
|
|
853
|
+
Node: "node"
|
|
854
|
+
}, Xe = ({
|
|
855
|
+
ctx: e,
|
|
856
|
+
imageById: t,
|
|
857
|
+
object: r,
|
|
858
|
+
opacity: n,
|
|
859
|
+
createPath2D: a
|
|
860
|
+
}) => {
|
|
861
|
+
const o = F(
|
|
862
|
+
p({ x: r.x, y: r.y }),
|
|
863
|
+
r.anchor,
|
|
864
|
+
N({ width: r.width, height: r.height })
|
|
865
|
+
), i = r.imageId != null && r.imageId.length > 0 ? r.imageId : r.imagePath;
|
|
866
|
+
if (i == null)
|
|
867
|
+
return;
|
|
868
|
+
const c = t[i];
|
|
869
|
+
if (c !== void 0) {
|
|
870
|
+
if (e.context.save(), r.cornerRadius > 0) {
|
|
871
|
+
const l = $e(
|
|
872
|
+
o.origin,
|
|
873
|
+
o.size,
|
|
874
|
+
r.cornerRadius,
|
|
875
|
+
a
|
|
876
|
+
);
|
|
877
|
+
switch (e.type) {
|
|
878
|
+
case I.Browser:
|
|
879
|
+
l.path.type === U.Browser ? e.context.clip(l.path.path) : console.warn("Attempted to use Node Path2D in Browser Canvas context");
|
|
880
|
+
break;
|
|
881
|
+
case I.Node:
|
|
882
|
+
l.path.type === U.Node ? e.context.clip(l.path.path) : console.warn("Attempted to use Browser Path2D in Node Canvas context");
|
|
883
|
+
break;
|
|
884
|
+
default:
|
|
885
|
+
D(e);
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
switch (e.context.globalAlpha = n * r.opacity, e.context.imageSmoothingEnabled = r.smooth, e.type) {
|
|
889
|
+
case I.Browser:
|
|
890
|
+
c.type === H.Browser ? e.context.drawImage(
|
|
891
|
+
c.image,
|
|
892
|
+
o.origin.x,
|
|
893
|
+
o.origin.y,
|
|
894
|
+
o.size.width,
|
|
895
|
+
o.size.height
|
|
896
|
+
) : console.warn("Attempted to use Node Image in Browser Canvas context");
|
|
897
|
+
break;
|
|
898
|
+
case I.Node:
|
|
899
|
+
c.type === H.Node ? e.context.drawImage(
|
|
900
|
+
c.image,
|
|
901
|
+
o.origin.x,
|
|
902
|
+
o.origin.y,
|
|
903
|
+
o.size.width,
|
|
904
|
+
o.size.height
|
|
905
|
+
) : console.warn("Attempted to use Browser Image in Node Canvas context");
|
|
906
|
+
break;
|
|
907
|
+
default:
|
|
908
|
+
D(e);
|
|
909
|
+
}
|
|
910
|
+
e.context.restore();
|
|
911
|
+
}
|
|
912
|
+
}, Ye = (e) => {
|
|
913
|
+
const { object: t } = e;
|
|
914
|
+
t.fallbackImageId == null && t.fallbackImagePath == null || Xe({
|
|
915
|
+
...e,
|
|
916
|
+
object: oe({
|
|
917
|
+
anchor: t.anchor,
|
|
918
|
+
cornerRadius: t.fallbackCornerRadius,
|
|
919
|
+
description: t.description,
|
|
920
|
+
height: t.height,
|
|
921
|
+
imageId: t.fallbackImageId,
|
|
922
|
+
imagePath: t.fallbackImagePath,
|
|
923
|
+
opacity: t.opacity,
|
|
924
|
+
smooth: t.fallbackSmooth,
|
|
925
|
+
width: t.width,
|
|
926
|
+
x: t.x,
|
|
927
|
+
y: t.y
|
|
928
|
+
})
|
|
929
|
+
});
|
|
930
|
+
};
|
|
931
|
+
function Ze(e, t, r, n) {
|
|
932
|
+
return F(
|
|
933
|
+
{
|
|
934
|
+
x: e.x * n.scale + n.translateX,
|
|
935
|
+
y: e.y * n.scale + n.translateY
|
|
936
|
+
},
|
|
937
|
+
t,
|
|
938
|
+
{
|
|
939
|
+
width: r.width * n.scale,
|
|
940
|
+
height: r.height * n.scale
|
|
941
|
+
}
|
|
942
|
+
);
|
|
943
|
+
}
|
|
944
|
+
function L(e, t) {
|
|
945
|
+
return e / t;
|
|
946
|
+
}
|
|
947
|
+
const He = ({
|
|
948
|
+
imagePathById: e,
|
|
949
|
+
slide: t,
|
|
950
|
+
object: r,
|
|
951
|
+
opacity: n,
|
|
952
|
+
pixelsPerInch: a,
|
|
953
|
+
transform: o
|
|
954
|
+
}) => {
|
|
955
|
+
const i = r.opacity * n;
|
|
956
|
+
if (i === 0)
|
|
957
|
+
return;
|
|
958
|
+
const c = r.imageId != null && r.imageId.length > 0 ? r.imageId : r.imagePath;
|
|
959
|
+
if (c == null)
|
|
960
|
+
return;
|
|
961
|
+
const l = e[c];
|
|
962
|
+
if (l === void 0)
|
|
963
|
+
return;
|
|
964
|
+
const { origin: d, size: f } = Ze(
|
|
965
|
+
p({ x: r.x, y: r.y }),
|
|
966
|
+
r.anchor,
|
|
967
|
+
N({ width: r.width, height: r.height }),
|
|
968
|
+
o
|
|
969
|
+
);
|
|
970
|
+
t.addImage({
|
|
971
|
+
path: l,
|
|
972
|
+
x: L(d.x, a),
|
|
973
|
+
y: L(d.y, a),
|
|
974
|
+
w: L(f.width, a),
|
|
975
|
+
h: L(f.height, a),
|
|
976
|
+
transparency: (1 - i) * 100
|
|
977
|
+
});
|
|
978
|
+
}, Ue = (e) => {
|
|
979
|
+
const { object: t } = e;
|
|
980
|
+
t.fallbackImageId == null && t.fallbackImagePath == null || He({
|
|
981
|
+
...e,
|
|
982
|
+
object: oe({
|
|
983
|
+
anchor: t.anchor,
|
|
984
|
+
cornerRadius: t.fallbackCornerRadius,
|
|
985
|
+
description: t.description,
|
|
986
|
+
height: t.height,
|
|
987
|
+
imageId: t.fallbackImageId,
|
|
988
|
+
imagePath: t.fallbackImagePath,
|
|
989
|
+
opacity: t.opacity,
|
|
990
|
+
smooth: t.fallbackSmooth,
|
|
991
|
+
width: t.width,
|
|
992
|
+
x: t.x,
|
|
993
|
+
y: t.y
|
|
994
|
+
})
|
|
995
|
+
});
|
|
996
|
+
}, rt = {
|
|
997
|
+
[s.SCENE]: Ye
|
|
998
|
+
}, nt = {
|
|
999
|
+
[s.SCENE]: Ue
|
|
1000
|
+
};
|
|
1001
|
+
async function We(e) {
|
|
1002
|
+
const t = await V(), r = new t.GLTFLoader();
|
|
1003
|
+
await j(r, e);
|
|
1004
|
+
const n = _(e);
|
|
1005
|
+
if (n === null)
|
|
1006
|
+
throw new Error(`3D model was not loaded: ${e}`);
|
|
1007
|
+
return z(e, n);
|
|
1008
|
+
}
|
|
1009
|
+
async function at(e) {
|
|
1010
|
+
const t = await We(e);
|
|
1011
|
+
return Q(t), t;
|
|
1012
|
+
}
|
|
1013
|
+
function ot({ scenes: e }) {
|
|
1014
|
+
typeof window > "u" || (window.presenterCaptureThreeScene = (t, r = {}) => {
|
|
1015
|
+
const n = e[t];
|
|
1016
|
+
if (n === void 0)
|
|
1017
|
+
return console.warn(`No Presenter 3D scene registered with name "${t}".`), null;
|
|
1018
|
+
const a = ge(n);
|
|
1019
|
+
if (a === null)
|
|
1020
|
+
return console.warn(`Presenter 3D scene "${t}" has not been rendered yet.`), null;
|
|
1021
|
+
const o = r.imageType ?? "image/png", i = a.toDataURL(o, r.quality), c = document.createElement("a");
|
|
1022
|
+
return c.href = i, c.download = r.filename ?? `${t}.${Ke(o)}`, c.click(), null;
|
|
1023
|
+
});
|
|
1024
|
+
}
|
|
1025
|
+
function Ke(e) {
|
|
1026
|
+
switch (e) {
|
|
1027
|
+
case "image/jpeg":
|
|
1028
|
+
return "jpg";
|
|
1029
|
+
case "image/webp":
|
|
1030
|
+
return "webp";
|
|
1031
|
+
default:
|
|
1032
|
+
return "png";
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
export {
|
|
1036
|
+
rt as THREE_FALLBACK_OBJECT_RENDERERS,
|
|
1037
|
+
nt as THREE_POWERPOINT_FALLBACK_OBJECT_RENDERERS,
|
|
1038
|
+
Ve as ThreeBox,
|
|
1039
|
+
S as ThreeCameraType,
|
|
1040
|
+
Je as ThreeModel,
|
|
1041
|
+
qe as ThreeModelMaterial,
|
|
1042
|
+
ze as ThreeModelNode,
|
|
1043
|
+
s as ThreeObjectType,
|
|
1044
|
+
Qe as ThreePresenterGroup,
|
|
1045
|
+
je as ThreeScene,
|
|
1046
|
+
et as ThreeSphere,
|
|
1047
|
+
ge as getRenderedThreeSceneCanvas,
|
|
1048
|
+
tt as getThreeObjectRenderers,
|
|
1049
|
+
We as inspectThreeModel,
|
|
1050
|
+
ot as installThreeSceneCaptureApi,
|
|
1051
|
+
at as logThreeModelParts,
|
|
1052
|
+
Ye as renderThreeSceneFallback,
|
|
1053
|
+
Ue as renderThreeScenePowerPointFallback
|
|
1054
|
+
};
|
|
1055
|
+
//# sourceMappingURL=3d.mjs.map
|