pptx-angular-viewer 4.24.2 → 4.25.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 +60 -0
- package/README.md +9 -9
- package/ng-package.json +25 -0
- package/package.json +45 -20
- package/scripts/finalize-dist.mjs +24 -0
- package/scripts/inline-shared.mjs +43 -0
- package/tsconfig.lib.json +13 -0
- package/vitest-setup.ts +12 -0
- package/fesm2022/pptx-angular-viewer-bar-chart-3d-hit-test-B6eCwecE.mjs +0 -9855
- package/fesm2022/pptx-angular-viewer-bar-chart-3d-hit-test-B6eCwecE.mjs.map +0 -1
- package/fesm2022/pptx-angular-viewer-chart-3d-view-scene-IqColhvd.mjs +0 -1594
- package/fesm2022/pptx-angular-viewer-chart-3d-view-scene-IqColhvd.mjs.map +0 -1
- package/fesm2022/pptx-angular-viewer-chat-history-idb-7dzD77Ju.mjs +0 -73
- package/fesm2022/pptx-angular-viewer-chat-history-idb-7dzD77Ju.mjs.map +0 -1
- package/fesm2022/pptx-angular-viewer-chat-history-store-Ckeu-olx.mjs +0 -121
- package/fesm2022/pptx-angular-viewer-chat-history-store-Ckeu-olx.mjs.map +0 -1
- package/fesm2022/pptx-angular-viewer-view-overflow-BBD8nZlq.mjs +0 -1418
- package/fesm2022/pptx-angular-viewer-view-overflow-BBD8nZlq.mjs.map +0 -1
- package/fesm2022/pptx-angular-viewer-view-scene-htTUkvvA.mjs +0 -836
- package/fesm2022/pptx-angular-viewer-view-scene-htTUkvvA.mjs.map +0 -1
- package/fesm2022/pptx-angular-viewer.mjs +0 -169787
- package/fesm2022/pptx-angular-viewer.mjs.map +0 -1
- package/i18n/de.cjs +0 -4165
- package/i18n/de.d.cts +0 -3
- package/i18n/de.d.mts +0 -3
- package/i18n/de.mjs +0 -4138
- package/i18n/es.cjs +0 -4165
- package/i18n/es.d.cts +0 -3
- package/i18n/es.d.mts +0 -3
- package/i18n/es.mjs +0 -4138
- package/i18n/fr.cjs +0 -4165
- package/i18n/fr.d.cts +0 -3
- package/i18n/fr.d.mts +0 -3
- package/i18n/fr.mjs +0 -4138
- package/i18n/zh-CN.cjs +0 -4198
- package/i18n/zh-CN.d.cts +0 -3
- package/i18n/zh-CN.d.mts +0 -3
- package/i18n/zh-CN.mjs +0 -4171
- package/pptx-angular-viewer.css +0 -2
- package/types/pptx-angular-viewer.d.ts +0 -59990
- package/types/pptx-angular-viewer.d.ts.map +0 -1
|
@@ -1,1418 +0,0 @@
|
|
|
1
|
-
const DIRECTION_ANGLE = {
|
|
2
|
-
t: 0,
|
|
3
|
-
tr: 45,
|
|
4
|
-
r: 90,
|
|
5
|
-
br: 135,
|
|
6
|
-
b: 180,
|
|
7
|
-
bl: 225,
|
|
8
|
-
l: 270,
|
|
9
|
-
tl: 315
|
|
10
|
-
};
|
|
11
|
-
const CARDINAL_VECTORS = {
|
|
12
|
-
0: {
|
|
13
|
-
dx: 0,
|
|
14
|
-
dy: -1
|
|
15
|
-
},
|
|
16
|
-
90: {
|
|
17
|
-
dx: 1,
|
|
18
|
-
dy: 0
|
|
19
|
-
},
|
|
20
|
-
180: {
|
|
21
|
-
dx: 0,
|
|
22
|
-
dy: 1
|
|
23
|
-
},
|
|
24
|
-
270: {
|
|
25
|
-
dx: -1,
|
|
26
|
-
dy: 0
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
function getBevelHighlightDirection(lightRigDirection) {
|
|
30
|
-
if (!lightRigDirection) return {
|
|
31
|
-
dx: -1,
|
|
32
|
-
dy: -1
|
|
33
|
-
};
|
|
34
|
-
const angle = DIRECTION_ANGLE[lightRigDirection];
|
|
35
|
-
if (angle === void 0) return {
|
|
36
|
-
dx: -1,
|
|
37
|
-
dy: -1
|
|
38
|
-
};
|
|
39
|
-
const bucket = Math.floor(angle / 90) * 90;
|
|
40
|
-
return CARDINAL_VECTORS[bucket] ?? {
|
|
41
|
-
dx: -1,
|
|
42
|
-
dy: -1
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
function isBevelProfileInverted(bevelType) {
|
|
46
|
-
return bevelType === "softRound";
|
|
47
|
-
}
|
|
48
|
-
const BEVEL_PROFILE_HEIGHT_MAP = {
|
|
49
|
-
circle: {
|
|
50
|
-
blurFactor: .35,
|
|
51
|
-
surfaceScaleFactor: .65,
|
|
52
|
-
measuredUniform: false
|
|
53
|
-
},
|
|
54
|
-
convex: {
|
|
55
|
-
blurFactor: .18,
|
|
56
|
-
morphologyFactor: .4,
|
|
57
|
-
surfaceScaleFactor: .2,
|
|
58
|
-
measuredUniform: false
|
|
59
|
-
},
|
|
60
|
-
softRound: {
|
|
61
|
-
blurFactor: .25,
|
|
62
|
-
morphologyFactor: .4,
|
|
63
|
-
surfaceScaleFactor: .65,
|
|
64
|
-
measuredUniform: false
|
|
65
|
-
},
|
|
66
|
-
relaxedInset: {
|
|
67
|
-
blurFactor: .35,
|
|
68
|
-
morphologyFactor: .5,
|
|
69
|
-
surfaceScaleFactor: 1.5,
|
|
70
|
-
measuredUniform: false,
|
|
71
|
-
heightTransferTable: [
|
|
72
|
-
.671,
|
|
73
|
-
.958,
|
|
74
|
-
1,
|
|
75
|
-
.975,
|
|
76
|
-
0,
|
|
77
|
-
.32,
|
|
78
|
-
.839,
|
|
79
|
-
.924,
|
|
80
|
-
.924,
|
|
81
|
-
.924
|
|
82
|
-
]
|
|
83
|
-
},
|
|
84
|
-
divot: {
|
|
85
|
-
blurFactor: .18,
|
|
86
|
-
surfaceScaleFactor: .5,
|
|
87
|
-
measuredUniform: false
|
|
88
|
-
},
|
|
89
|
-
angle: {
|
|
90
|
-
blurFactor: .35,
|
|
91
|
-
morphologyFactor: .4,
|
|
92
|
-
surfaceScaleFactor: .35,
|
|
93
|
-
measuredUniform: false
|
|
94
|
-
},
|
|
95
|
-
cross: {
|
|
96
|
-
blurFactor: .12,
|
|
97
|
-
morphologyFactor: .18,
|
|
98
|
-
surfaceScaleFactor: .2,
|
|
99
|
-
measuredUniform: false
|
|
100
|
-
},
|
|
101
|
-
coolSlant: {
|
|
102
|
-
blurFactor: .25,
|
|
103
|
-
morphologyFactor: .06,
|
|
104
|
-
surfaceScaleFactor: .5,
|
|
105
|
-
measuredUniform: false
|
|
106
|
-
},
|
|
107
|
-
riblet: {
|
|
108
|
-
blurFactor: .25,
|
|
109
|
-
surfaceScaleFactor: .5,
|
|
110
|
-
measuredUniform: false
|
|
111
|
-
},
|
|
112
|
-
artDeco: {
|
|
113
|
-
blurFactor: .18,
|
|
114
|
-
morphologyFactor: .32,
|
|
115
|
-
surfaceScaleFactor: .35,
|
|
116
|
-
measuredUniform: false
|
|
117
|
-
},
|
|
118
|
-
slope: {
|
|
119
|
-
blurFactor: .55,
|
|
120
|
-
morphologyFactor: .5,
|
|
121
|
-
surfaceScaleFactor: 1.5,
|
|
122
|
-
measuredUniform: true,
|
|
123
|
-
heightTransferTable: [
|
|
124
|
-
.519,
|
|
125
|
-
1,
|
|
126
|
-
.967,
|
|
127
|
-
.96,
|
|
128
|
-
0,
|
|
129
|
-
.426,
|
|
130
|
-
.1,
|
|
131
|
-
.96,
|
|
132
|
-
.96,
|
|
133
|
-
.96
|
|
134
|
-
]
|
|
135
|
-
},
|
|
136
|
-
hardEdge: {
|
|
137
|
-
blurFactor: .55,
|
|
138
|
-
morphologyFactor: .5,
|
|
139
|
-
surfaceScaleFactor: 1.5,
|
|
140
|
-
measuredUniform: true,
|
|
141
|
-
heightTransferTable: [
|
|
142
|
-
.279,
|
|
143
|
-
1,
|
|
144
|
-
.938,
|
|
145
|
-
.938,
|
|
146
|
-
0,
|
|
147
|
-
.04,
|
|
148
|
-
.793,
|
|
149
|
-
.938,
|
|
150
|
-
.938,
|
|
151
|
-
.938
|
|
152
|
-
]
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
const DEFAULT_HEIGHT_MAP = {
|
|
156
|
-
blurFactor: .4,
|
|
157
|
-
surfaceScaleFactor: .8,
|
|
158
|
-
measuredUniform: false
|
|
159
|
-
};
|
|
160
|
-
function getBevelProfileHeightMap(bevelType) {
|
|
161
|
-
return BEVEL_PROFILE_HEIGHT_MAP[bevelType] ?? DEFAULT_HEIGHT_MAP;
|
|
162
|
-
}
|
|
163
|
-
const white = "#ffffff";
|
|
164
|
-
const MATERIAL_LIGHTING = {
|
|
165
|
-
matte: {
|
|
166
|
-
diffuseConstant: .9,
|
|
167
|
-
specularConstant: .02,
|
|
168
|
-
specularExponent: 4,
|
|
169
|
-
lightingColor: white,
|
|
170
|
-
surfaceScaleMultiplier: 1
|
|
171
|
-
},
|
|
172
|
-
warmMatte: {
|
|
173
|
-
diffuseConstant: .9,
|
|
174
|
-
specularConstant: .03,
|
|
175
|
-
specularExponent: 4,
|
|
176
|
-
lightingColor: "#fff4e6",
|
|
177
|
-
surfaceScaleMultiplier: 1
|
|
178
|
-
},
|
|
179
|
-
powder: {
|
|
180
|
-
diffuseConstant: .85,
|
|
181
|
-
specularConstant: .02,
|
|
182
|
-
specularExponent: 4,
|
|
183
|
-
lightingColor: white,
|
|
184
|
-
surfaceScaleMultiplier: 1
|
|
185
|
-
},
|
|
186
|
-
translucentPowder: {
|
|
187
|
-
diffuseConstant: .8,
|
|
188
|
-
specularConstant: .08,
|
|
189
|
-
specularExponent: 6,
|
|
190
|
-
lightingColor: white,
|
|
191
|
-
surfaceScaleMultiplier: 1
|
|
192
|
-
},
|
|
193
|
-
plastic: {
|
|
194
|
-
diffuseConstant: .85,
|
|
195
|
-
specularConstant: .35,
|
|
196
|
-
specularExponent: 12,
|
|
197
|
-
lightingColor: white,
|
|
198
|
-
surfaceScaleMultiplier: 1
|
|
199
|
-
},
|
|
200
|
-
clear: {
|
|
201
|
-
diffuseConstant: .7,
|
|
202
|
-
specularConstant: .45,
|
|
203
|
-
specularExponent: 16,
|
|
204
|
-
lightingColor: white,
|
|
205
|
-
surfaceScaleMultiplier: 1
|
|
206
|
-
},
|
|
207
|
-
softEdge: {
|
|
208
|
-
diffuseConstant: .85,
|
|
209
|
-
specularConstant: .15,
|
|
210
|
-
specularExponent: 8,
|
|
211
|
-
lightingColor: white,
|
|
212
|
-
surfaceScaleMultiplier: 1
|
|
213
|
-
},
|
|
214
|
-
dkEdge: {
|
|
215
|
-
diffuseConstant: .75,
|
|
216
|
-
specularConstant: .2,
|
|
217
|
-
specularExponent: 14,
|
|
218
|
-
lightingColor: "#f0f0f0",
|
|
219
|
-
surfaceScaleMultiplier: 1
|
|
220
|
-
},
|
|
221
|
-
softmetal: {
|
|
222
|
-
diffuseConstant: .65,
|
|
223
|
-
specularConstant: .6,
|
|
224
|
-
specularExponent: 16,
|
|
225
|
-
lightingColor: white,
|
|
226
|
-
surfaceScaleMultiplier: 1
|
|
227
|
-
},
|
|
228
|
-
metal: {
|
|
229
|
-
diffuseConstant: .75,
|
|
230
|
-
specularConstant: .5,
|
|
231
|
-
specularExponent: 16,
|
|
232
|
-
lightingColor: white,
|
|
233
|
-
surfaceScaleMultiplier: .35,
|
|
234
|
-
specularElevationCapDeg: 45
|
|
235
|
-
},
|
|
236
|
-
flat: {
|
|
237
|
-
diffuseConstant: .9,
|
|
238
|
-
specularConstant: 0,
|
|
239
|
-
specularExponent: 1,
|
|
240
|
-
lightingColor: white,
|
|
241
|
-
surfaceScaleMultiplier: 1
|
|
242
|
-
},
|
|
243
|
-
legacyMatte: {
|
|
244
|
-
diffuseConstant: .88,
|
|
245
|
-
specularConstant: .02,
|
|
246
|
-
specularExponent: 4,
|
|
247
|
-
lightingColor: white,
|
|
248
|
-
surfaceScaleMultiplier: 1
|
|
249
|
-
},
|
|
250
|
-
legacyPlastic: {
|
|
251
|
-
diffuseConstant: .82,
|
|
252
|
-
specularConstant: .3,
|
|
253
|
-
specularExponent: 10,
|
|
254
|
-
lightingColor: white,
|
|
255
|
-
surfaceScaleMultiplier: 1
|
|
256
|
-
},
|
|
257
|
-
legacyMetal: {
|
|
258
|
-
diffuseConstant: .7,
|
|
259
|
-
specularConstant: .8,
|
|
260
|
-
specularExponent: 22,
|
|
261
|
-
lightingColor: white,
|
|
262
|
-
surfaceScaleMultiplier: .45
|
|
263
|
-
},
|
|
264
|
-
legacyWireframe: {
|
|
265
|
-
diffuseConstant: .9,
|
|
266
|
-
specularConstant: .05,
|
|
267
|
-
specularExponent: 6,
|
|
268
|
-
lightingColor: white,
|
|
269
|
-
surfaceScaleMultiplier: 1
|
|
270
|
-
}
|
|
271
|
-
};
|
|
272
|
-
const DEFAULT_MATERIAL = "warmMatte";
|
|
273
|
-
function getMaterialLighting(material) {
|
|
274
|
-
return MATERIAL_LIGHTING[material ?? DEFAULT_MATERIAL] ?? MATERIAL_LIGHTING[DEFAULT_MATERIAL];
|
|
275
|
-
}
|
|
276
|
-
const LIGHT_RIG_LIGHTING = {
|
|
277
|
-
flat: {
|
|
278
|
-
elevationDeg: 90,
|
|
279
|
-
specularSharpness: .3
|
|
280
|
-
},
|
|
281
|
-
legacyFlat1: {
|
|
282
|
-
elevationDeg: 90,
|
|
283
|
-
specularSharpness: .3
|
|
284
|
-
},
|
|
285
|
-
legacyFlat2: {
|
|
286
|
-
elevationDeg: 77,
|
|
287
|
-
specularSharpness: .3
|
|
288
|
-
},
|
|
289
|
-
legacyFlat3: {
|
|
290
|
-
elevationDeg: 90,
|
|
291
|
-
specularSharpness: .3
|
|
292
|
-
},
|
|
293
|
-
legacyFlat4: {
|
|
294
|
-
elevationDeg: 77,
|
|
295
|
-
specularSharpness: .3,
|
|
296
|
-
invertedDirection: true
|
|
297
|
-
},
|
|
298
|
-
harsh: {
|
|
299
|
-
elevationDeg: 89,
|
|
300
|
-
specularSharpness: 1.6,
|
|
301
|
-
invertedDirection: true
|
|
302
|
-
},
|
|
303
|
-
contrasting: {
|
|
304
|
-
elevationDeg: 90,
|
|
305
|
-
specularSharpness: 1.5
|
|
306
|
-
},
|
|
307
|
-
legacyHarsh1: {
|
|
308
|
-
elevationDeg: 90,
|
|
309
|
-
specularSharpness: 1.5
|
|
310
|
-
},
|
|
311
|
-
legacyHarsh2: {
|
|
312
|
-
elevationDeg: 73,
|
|
313
|
-
specularSharpness: 1.4
|
|
314
|
-
},
|
|
315
|
-
legacyHarsh3: {
|
|
316
|
-
elevationDeg: 90,
|
|
317
|
-
specularSharpness: 1.5
|
|
318
|
-
},
|
|
319
|
-
legacyHarsh4: {
|
|
320
|
-
elevationDeg: 73,
|
|
321
|
-
specularSharpness: 1.4,
|
|
322
|
-
invertedDirection: true
|
|
323
|
-
},
|
|
324
|
-
soft: {
|
|
325
|
-
elevationDeg: 77,
|
|
326
|
-
specularSharpness: .6
|
|
327
|
-
},
|
|
328
|
-
flood: {
|
|
329
|
-
elevationDeg: 85,
|
|
330
|
-
specularSharpness: .7
|
|
331
|
-
},
|
|
332
|
-
glow: {
|
|
333
|
-
elevationDeg: 90,
|
|
334
|
-
specularSharpness: .5
|
|
335
|
-
},
|
|
336
|
-
brightRoom: {
|
|
337
|
-
elevationDeg: 90,
|
|
338
|
-
specularSharpness: .65
|
|
339
|
-
},
|
|
340
|
-
morning: {
|
|
341
|
-
elevationDeg: 54,
|
|
342
|
-
specularSharpness: .75,
|
|
343
|
-
invertedDirection: true
|
|
344
|
-
},
|
|
345
|
-
sunrise: {
|
|
346
|
-
elevationDeg: 59,
|
|
347
|
-
specularSharpness: .8,
|
|
348
|
-
invertedDirection: true
|
|
349
|
-
},
|
|
350
|
-
sunset: {
|
|
351
|
-
elevationDeg: 64,
|
|
352
|
-
specularSharpness: .8,
|
|
353
|
-
invertedDirection: true
|
|
354
|
-
},
|
|
355
|
-
chilly: {
|
|
356
|
-
elevationDeg: 62,
|
|
357
|
-
specularSharpness: .6,
|
|
358
|
-
invertedDirection: true
|
|
359
|
-
},
|
|
360
|
-
freezing: {
|
|
361
|
-
elevationDeg: 62,
|
|
362
|
-
specularSharpness: .6,
|
|
363
|
-
invertedDirection: true
|
|
364
|
-
},
|
|
365
|
-
threePt: {
|
|
366
|
-
elevationDeg: 74,
|
|
367
|
-
specularSharpness: 1
|
|
368
|
-
},
|
|
369
|
-
balanced: {
|
|
370
|
-
elevationDeg: 88,
|
|
371
|
-
specularSharpness: .95,
|
|
372
|
-
invertedDirection: true
|
|
373
|
-
},
|
|
374
|
-
twoPt: {
|
|
375
|
-
elevationDeg: 79,
|
|
376
|
-
specularSharpness: 1,
|
|
377
|
-
invertedDirection: true
|
|
378
|
-
},
|
|
379
|
-
legacyNormal1: {
|
|
380
|
-
elevationDeg: 90,
|
|
381
|
-
specularSharpness: 1
|
|
382
|
-
},
|
|
383
|
-
legacyNormal2: {
|
|
384
|
-
elevationDeg: 75,
|
|
385
|
-
specularSharpness: 1
|
|
386
|
-
},
|
|
387
|
-
legacyNormal3: {
|
|
388
|
-
elevationDeg: 90,
|
|
389
|
-
specularSharpness: 1
|
|
390
|
-
},
|
|
391
|
-
legacyNormal4: {
|
|
392
|
-
elevationDeg: 75,
|
|
393
|
-
specularSharpness: 1,
|
|
394
|
-
invertedDirection: true
|
|
395
|
-
}
|
|
396
|
-
};
|
|
397
|
-
const DEFAULT_LIGHT_RIG = {
|
|
398
|
-
elevationDeg: 45,
|
|
399
|
-
specularSharpness: 1
|
|
400
|
-
};
|
|
401
|
-
function getLightRigLighting(rigType) {
|
|
402
|
-
if (!rigType) return DEFAULT_LIGHT_RIG;
|
|
403
|
-
return LIGHT_RIG_LIGHTING[rigType] ?? DEFAULT_LIGHT_RIG;
|
|
404
|
-
}
|
|
405
|
-
const EMU_PER_PX = 9525;
|
|
406
|
-
const CAMERA_PRESET_MAP = {
|
|
407
|
-
orthographicFront: {
|
|
408
|
-
rotateX: 0,
|
|
409
|
-
rotateY: 0,
|
|
410
|
-
rotateZ: 0
|
|
411
|
-
},
|
|
412
|
-
perspectiveFront: {
|
|
413
|
-
perspectiveRefPx: 1e3,
|
|
414
|
-
rotateX: 0,
|
|
415
|
-
rotateY: 0,
|
|
416
|
-
rotateZ: 0
|
|
417
|
-
},
|
|
418
|
-
perspectiveAbove: {
|
|
419
|
-
perspectiveRefPx: 1e3,
|
|
420
|
-
rotateX: 20,
|
|
421
|
-
rotateY: 0,
|
|
422
|
-
rotateZ: 0
|
|
423
|
-
},
|
|
424
|
-
perspectiveBelow: {
|
|
425
|
-
perspectiveRefPx: 1e3,
|
|
426
|
-
rotateX: -20,
|
|
427
|
-
rotateY: 0,
|
|
428
|
-
rotateZ: 0
|
|
429
|
-
},
|
|
430
|
-
perspectiveLeft: {
|
|
431
|
-
perspectiveRefPx: 1e3,
|
|
432
|
-
rotateX: 0,
|
|
433
|
-
rotateY: -20,
|
|
434
|
-
rotateZ: 0
|
|
435
|
-
},
|
|
436
|
-
perspectiveRight: {
|
|
437
|
-
perspectiveRefPx: 1e3,
|
|
438
|
-
rotateX: 0,
|
|
439
|
-
rotateY: 20,
|
|
440
|
-
rotateZ: 0
|
|
441
|
-
},
|
|
442
|
-
perspectiveAboveLeftFacing: {
|
|
443
|
-
perspectiveRefPx: 1e3,
|
|
444
|
-
rotateX: 20,
|
|
445
|
-
rotateY: -25,
|
|
446
|
-
rotateZ: 0
|
|
447
|
-
},
|
|
448
|
-
perspectiveAboveRightFacing: {
|
|
449
|
-
perspectiveRefPx: 1e3,
|
|
450
|
-
rotateX: 20,
|
|
451
|
-
rotateY: 25,
|
|
452
|
-
rotateZ: 0
|
|
453
|
-
},
|
|
454
|
-
perspectiveContrastingLeftFacing: {
|
|
455
|
-
perspectiveRefPx: 800,
|
|
456
|
-
rotateX: 15,
|
|
457
|
-
rotateY: -30,
|
|
458
|
-
rotateZ: 0,
|
|
459
|
-
perspectiveOriginXPct: 93,
|
|
460
|
-
perspectiveOriginYPct: 0
|
|
461
|
-
},
|
|
462
|
-
perspectiveContrastingRightFacing: {
|
|
463
|
-
perspectiveRefPx: 800,
|
|
464
|
-
rotateX: 15,
|
|
465
|
-
rotateY: 30,
|
|
466
|
-
rotateZ: 0,
|
|
467
|
-
perspectiveOriginXPct: 7,
|
|
468
|
-
perspectiveOriginYPct: 0
|
|
469
|
-
},
|
|
470
|
-
perspectiveHeroicLeftFacing: {
|
|
471
|
-
perspectiveRefPx: 600,
|
|
472
|
-
rotateX: 10,
|
|
473
|
-
rotateY: -35,
|
|
474
|
-
rotateZ: 0
|
|
475
|
-
},
|
|
476
|
-
perspectiveHeroicRightFacing: {
|
|
477
|
-
perspectiveRefPx: 600,
|
|
478
|
-
rotateX: 10,
|
|
479
|
-
rotateY: 35,
|
|
480
|
-
rotateZ: 0
|
|
481
|
-
},
|
|
482
|
-
perspectiveHeroicExtremeLeftFacing: {
|
|
483
|
-
perspectiveRefPx: 500,
|
|
484
|
-
rotateX: 8,
|
|
485
|
-
rotateY: -45,
|
|
486
|
-
rotateZ: 0,
|
|
487
|
-
perspectiveOriginXPct: 32,
|
|
488
|
-
perspectiveOriginYPct: 42
|
|
489
|
-
},
|
|
490
|
-
perspectiveHeroicExtremeRightFacing: {
|
|
491
|
-
perspectiveRefPx: 500,
|
|
492
|
-
rotateX: 8,
|
|
493
|
-
rotateY: 45,
|
|
494
|
-
rotateZ: 0,
|
|
495
|
-
perspectiveOriginXPct: 68,
|
|
496
|
-
perspectiveOriginYPct: 42
|
|
497
|
-
},
|
|
498
|
-
perspectiveRelaxed: {
|
|
499
|
-
perspectiveRefPx: 1200,
|
|
500
|
-
rotateX: 10,
|
|
501
|
-
rotateY: 0,
|
|
502
|
-
rotateZ: 0
|
|
503
|
-
},
|
|
504
|
-
perspectiveRelaxedModerately: {
|
|
505
|
-
perspectiveRefPx: 1400,
|
|
506
|
-
rotateX: 5,
|
|
507
|
-
rotateY: 0,
|
|
508
|
-
rotateZ: 0
|
|
509
|
-
},
|
|
510
|
-
isometricLeftDown: {
|
|
511
|
-
rotateX: -35,
|
|
512
|
-
rotateY: 45,
|
|
513
|
-
rotateZ: 0
|
|
514
|
-
},
|
|
515
|
-
isometricRightUp: {
|
|
516
|
-
rotateX: -35,
|
|
517
|
-
rotateY: -45,
|
|
518
|
-
rotateZ: 0
|
|
519
|
-
},
|
|
520
|
-
isometricLeftUp: {
|
|
521
|
-
rotateX: 35,
|
|
522
|
-
rotateY: 45,
|
|
523
|
-
rotateZ: 0
|
|
524
|
-
},
|
|
525
|
-
isometricRightDown: {
|
|
526
|
-
rotateX: 35,
|
|
527
|
-
rotateY: -45,
|
|
528
|
-
rotateZ: 0
|
|
529
|
-
},
|
|
530
|
-
isometricTopUp: {
|
|
531
|
-
rotateX: -55,
|
|
532
|
-
rotateY: 0,
|
|
533
|
-
rotateZ: 45
|
|
534
|
-
},
|
|
535
|
-
isometricTopDown: {
|
|
536
|
-
rotateX: -55,
|
|
537
|
-
rotateY: 0,
|
|
538
|
-
rotateZ: -45
|
|
539
|
-
},
|
|
540
|
-
isometricBottomUp: {
|
|
541
|
-
rotateX: 55,
|
|
542
|
-
rotateY: 0,
|
|
543
|
-
rotateZ: 45
|
|
544
|
-
},
|
|
545
|
-
isometricBottomDown: {
|
|
546
|
-
rotateX: 55,
|
|
547
|
-
rotateY: 0,
|
|
548
|
-
rotateZ: -45
|
|
549
|
-
},
|
|
550
|
-
isometricOffAxis1Left: {
|
|
551
|
-
rotateX: -30,
|
|
552
|
-
rotateY: 30,
|
|
553
|
-
rotateZ: 0
|
|
554
|
-
},
|
|
555
|
-
isometricOffAxis1Right: {
|
|
556
|
-
rotateX: -30,
|
|
557
|
-
rotateY: -30,
|
|
558
|
-
rotateZ: 0
|
|
559
|
-
},
|
|
560
|
-
isometricOffAxis1Top: {
|
|
561
|
-
rotateX: -45,
|
|
562
|
-
rotateY: 0,
|
|
563
|
-
rotateZ: 30
|
|
564
|
-
},
|
|
565
|
-
isometricOffAxis2Left: {
|
|
566
|
-
rotateX: -30,
|
|
567
|
-
rotateY: 20,
|
|
568
|
-
rotateZ: 0
|
|
569
|
-
},
|
|
570
|
-
isometricOffAxis2Right: {
|
|
571
|
-
rotateX: -30,
|
|
572
|
-
rotateY: -20,
|
|
573
|
-
rotateZ: 0
|
|
574
|
-
},
|
|
575
|
-
isometricOffAxis2Top: {
|
|
576
|
-
rotateX: -45,
|
|
577
|
-
rotateY: 0,
|
|
578
|
-
rotateZ: -30
|
|
579
|
-
},
|
|
580
|
-
isometricOffAxis3Left: {
|
|
581
|
-
rotateX: -25,
|
|
582
|
-
rotateY: 35,
|
|
583
|
-
rotateZ: 0
|
|
584
|
-
},
|
|
585
|
-
isometricOffAxis3Right: {
|
|
586
|
-
rotateX: -25,
|
|
587
|
-
rotateY: -35,
|
|
588
|
-
rotateZ: 0
|
|
589
|
-
},
|
|
590
|
-
isometricOffAxis3Bottom: {
|
|
591
|
-
rotateX: 45,
|
|
592
|
-
rotateY: 0,
|
|
593
|
-
rotateZ: 30
|
|
594
|
-
},
|
|
595
|
-
isometricOffAxis4Left: {
|
|
596
|
-
rotateX: -25,
|
|
597
|
-
rotateY: 25,
|
|
598
|
-
rotateZ: 0
|
|
599
|
-
},
|
|
600
|
-
isometricOffAxis4Right: {
|
|
601
|
-
rotateX: -25,
|
|
602
|
-
rotateY: -25,
|
|
603
|
-
rotateZ: 0
|
|
604
|
-
},
|
|
605
|
-
isometricOffAxis4Bottom: {
|
|
606
|
-
rotateX: 45,
|
|
607
|
-
rotateY: 0,
|
|
608
|
-
rotateZ: -30
|
|
609
|
-
},
|
|
610
|
-
obliqueTopLeft: {
|
|
611
|
-
perspectiveRefPx: 900,
|
|
612
|
-
rotateX: -20,
|
|
613
|
-
rotateY: 20,
|
|
614
|
-
rotateZ: 0
|
|
615
|
-
},
|
|
616
|
-
obliqueTop: {
|
|
617
|
-
perspectiveRefPx: 900,
|
|
618
|
-
rotateX: -25,
|
|
619
|
-
rotateY: 0,
|
|
620
|
-
rotateZ: 0
|
|
621
|
-
},
|
|
622
|
-
obliqueTopRight: {
|
|
623
|
-
perspectiveRefPx: 900,
|
|
624
|
-
rotateX: -20,
|
|
625
|
-
rotateY: -20,
|
|
626
|
-
rotateZ: 0
|
|
627
|
-
},
|
|
628
|
-
obliqueLeft: {
|
|
629
|
-
perspectiveRefPx: 900,
|
|
630
|
-
rotateX: 0,
|
|
631
|
-
rotateY: 25,
|
|
632
|
-
rotateZ: 0
|
|
633
|
-
},
|
|
634
|
-
obliqueRight: {
|
|
635
|
-
perspectiveRefPx: 900,
|
|
636
|
-
rotateX: 0,
|
|
637
|
-
rotateY: -25,
|
|
638
|
-
rotateZ: 0
|
|
639
|
-
},
|
|
640
|
-
obliqueBottomLeft: {
|
|
641
|
-
perspectiveRefPx: 900,
|
|
642
|
-
rotateX: 20,
|
|
643
|
-
rotateY: 20,
|
|
644
|
-
rotateZ: 0
|
|
645
|
-
},
|
|
646
|
-
obliqueBottom: {
|
|
647
|
-
perspectiveRefPx: 900,
|
|
648
|
-
rotateX: 25,
|
|
649
|
-
rotateY: 0,
|
|
650
|
-
rotateZ: 0
|
|
651
|
-
},
|
|
652
|
-
obliqueBottomRight: {
|
|
653
|
-
perspectiveRefPx: 900,
|
|
654
|
-
rotateX: 20,
|
|
655
|
-
rotateY: -20,
|
|
656
|
-
rotateZ: 0
|
|
657
|
-
},
|
|
658
|
-
legacyObliqueTopLeft: {
|
|
659
|
-
perspectiveRefPx: 900,
|
|
660
|
-
rotateX: -20,
|
|
661
|
-
rotateY: 20,
|
|
662
|
-
rotateZ: 0
|
|
663
|
-
},
|
|
664
|
-
legacyObliqueTop: {
|
|
665
|
-
perspectiveRefPx: 900,
|
|
666
|
-
rotateX: -25,
|
|
667
|
-
rotateY: 0,
|
|
668
|
-
rotateZ: 0
|
|
669
|
-
},
|
|
670
|
-
legacyObliqueTopRight: {
|
|
671
|
-
perspectiveRefPx: 900,
|
|
672
|
-
rotateX: -20,
|
|
673
|
-
rotateY: -20,
|
|
674
|
-
rotateZ: 0
|
|
675
|
-
},
|
|
676
|
-
legacyObliqueLeft: {
|
|
677
|
-
perspectiveRefPx: 900,
|
|
678
|
-
rotateX: 0,
|
|
679
|
-
rotateY: 25,
|
|
680
|
-
rotateZ: 0
|
|
681
|
-
},
|
|
682
|
-
legacyObliqueFront: {
|
|
683
|
-
perspectiveRefPx: 900,
|
|
684
|
-
rotateX: 0,
|
|
685
|
-
rotateY: 0,
|
|
686
|
-
rotateZ: 0
|
|
687
|
-
},
|
|
688
|
-
legacyObliqueRight: {
|
|
689
|
-
perspectiveRefPx: 900,
|
|
690
|
-
rotateX: 0,
|
|
691
|
-
rotateY: -25,
|
|
692
|
-
rotateZ: 0
|
|
693
|
-
},
|
|
694
|
-
legacyObliqueBottomLeft: {
|
|
695
|
-
perspectiveRefPx: 900,
|
|
696
|
-
rotateX: 20,
|
|
697
|
-
rotateY: 20,
|
|
698
|
-
rotateZ: 0
|
|
699
|
-
},
|
|
700
|
-
legacyObliqueBottom: {
|
|
701
|
-
perspectiveRefPx: 900,
|
|
702
|
-
rotateX: 25,
|
|
703
|
-
rotateY: 0,
|
|
704
|
-
rotateZ: 0
|
|
705
|
-
},
|
|
706
|
-
legacyObliqueBottomRight: {
|
|
707
|
-
perspectiveRefPx: 900,
|
|
708
|
-
rotateX: 20,
|
|
709
|
-
rotateY: -20,
|
|
710
|
-
rotateZ: 0
|
|
711
|
-
},
|
|
712
|
-
legacyPerspectiveTopLeft: {
|
|
713
|
-
perspectiveRefPx: 700,
|
|
714
|
-
rotateX: -30,
|
|
715
|
-
rotateY: 30,
|
|
716
|
-
rotateZ: 0
|
|
717
|
-
},
|
|
718
|
-
legacyPerspectiveTop: {
|
|
719
|
-
perspectiveRefPx: 700,
|
|
720
|
-
rotateX: -35,
|
|
721
|
-
rotateY: 0,
|
|
722
|
-
rotateZ: 0
|
|
723
|
-
},
|
|
724
|
-
legacyPerspectiveTopRight: {
|
|
725
|
-
perspectiveRefPx: 700,
|
|
726
|
-
rotateX: -30,
|
|
727
|
-
rotateY: -30,
|
|
728
|
-
rotateZ: 0
|
|
729
|
-
},
|
|
730
|
-
legacyPerspectiveLeft: {
|
|
731
|
-
perspectiveRefPx: 700,
|
|
732
|
-
rotateX: 0,
|
|
733
|
-
rotateY: 35,
|
|
734
|
-
rotateZ: 0
|
|
735
|
-
},
|
|
736
|
-
legacyPerspectiveFront: {
|
|
737
|
-
perspectiveRefPx: 700,
|
|
738
|
-
rotateX: 0,
|
|
739
|
-
rotateY: 0,
|
|
740
|
-
rotateZ: 0
|
|
741
|
-
},
|
|
742
|
-
legacyPerspectiveRight: {
|
|
743
|
-
perspectiveRefPx: 700,
|
|
744
|
-
rotateX: 0,
|
|
745
|
-
rotateY: -35,
|
|
746
|
-
rotateZ: 0
|
|
747
|
-
},
|
|
748
|
-
legacyPerspectiveBottomLeft: {
|
|
749
|
-
perspectiveRefPx: 700,
|
|
750
|
-
rotateX: 30,
|
|
751
|
-
rotateY: 30,
|
|
752
|
-
rotateZ: 0
|
|
753
|
-
},
|
|
754
|
-
legacyPerspectiveBottom: {
|
|
755
|
-
perspectiveRefPx: 700,
|
|
756
|
-
rotateX: 35,
|
|
757
|
-
rotateY: 0,
|
|
758
|
-
rotateZ: 0
|
|
759
|
-
},
|
|
760
|
-
legacyPerspectiveBottomRight: {
|
|
761
|
-
perspectiveRefPx: 700,
|
|
762
|
-
rotateX: 30,
|
|
763
|
-
rotateY: -30,
|
|
764
|
-
rotateZ: 0
|
|
765
|
-
}
|
|
766
|
-
};
|
|
767
|
-
const DEFAULT_PERSPECTIVE_DISTANCE = 6;
|
|
768
|
-
const SCENE_CAMERA_PRESETS = {
|
|
769
|
-
orthographicFront: {
|
|
770
|
-
lat: 0,
|
|
771
|
-
lon: 0,
|
|
772
|
-
rev: 0
|
|
773
|
-
},
|
|
774
|
-
perspectiveFront: {
|
|
775
|
-
lat: 0,
|
|
776
|
-
lon: 0,
|
|
777
|
-
rev: 0,
|
|
778
|
-
distance: 160
|
|
779
|
-
},
|
|
780
|
-
perspectiveLeft: {
|
|
781
|
-
lat: 0,
|
|
782
|
-
lon: 20.4,
|
|
783
|
-
rev: 0,
|
|
784
|
-
distance: 8.3
|
|
785
|
-
},
|
|
786
|
-
perspectiveRight: {
|
|
787
|
-
lat: 0,
|
|
788
|
-
lon: -20.4,
|
|
789
|
-
rev: 0,
|
|
790
|
-
distance: 8.3
|
|
791
|
-
},
|
|
792
|
-
perspectiveRelaxed: {
|
|
793
|
-
lat: -50.8,
|
|
794
|
-
lon: .3,
|
|
795
|
-
rev: -.2,
|
|
796
|
-
distance: 7.8
|
|
797
|
-
},
|
|
798
|
-
perspectiveRelaxedModerately: {
|
|
799
|
-
lat: -35.1,
|
|
800
|
-
lon: 0,
|
|
801
|
-
rev: 0,
|
|
802
|
-
distance: 7.9
|
|
803
|
-
},
|
|
804
|
-
perspectiveHeroicExtremeRightFacing: {
|
|
805
|
-
lat: 8,
|
|
806
|
-
lon: -36.1,
|
|
807
|
-
rev: 2.1,
|
|
808
|
-
distance: 4.2
|
|
809
|
-
},
|
|
810
|
-
perspectiveHeroicExtremeLeftFacing: {
|
|
811
|
-
lat: 8,
|
|
812
|
-
lon: 36.1,
|
|
813
|
-
rev: -2.1,
|
|
814
|
-
distance: 4.2
|
|
815
|
-
},
|
|
816
|
-
isometricOffAxis2Left: {
|
|
817
|
-
lat: 18,
|
|
818
|
-
lon: 26,
|
|
819
|
-
rev: 0
|
|
820
|
-
},
|
|
821
|
-
isometricOffAxis2Right: {
|
|
822
|
-
lat: 18,
|
|
823
|
-
lon: -26,
|
|
824
|
-
rev: 0
|
|
825
|
-
}
|
|
826
|
-
};
|
|
827
|
-
const DEG_PER_UNIT$1 = 6e4;
|
|
828
|
-
function toDeg(value) {
|
|
829
|
-
return value ? value / DEG_PER_UNIT$1 : 0;
|
|
830
|
-
}
|
|
831
|
-
function normalizeZoom(value) {
|
|
832
|
-
if (!value || value <= 0) return 1;
|
|
833
|
-
return value > 10 ? value / 1e5 : value;
|
|
834
|
-
}
|
|
835
|
-
function presetPose(preset) {
|
|
836
|
-
const fitted = SCENE_CAMERA_PRESETS[preset];
|
|
837
|
-
if (fitted) return fitted;
|
|
838
|
-
const legacy = CAMERA_PRESET_MAP[preset];
|
|
839
|
-
const perspective = preset.startsWith("perspective");
|
|
840
|
-
return {
|
|
841
|
-
lat: legacy?.rotateX ?? 0,
|
|
842
|
-
lon: legacy?.rotateY ?? 0,
|
|
843
|
-
rev: legacy?.rotateZ ?? 0,
|
|
844
|
-
...perspective ? { distance: DEFAULT_PERSPECTIVE_DISTANCE } : {}
|
|
845
|
-
};
|
|
846
|
-
}
|
|
847
|
-
function resolveSmartArt3DCamera(scene) {
|
|
848
|
-
if (!scene) return;
|
|
849
|
-
const pose = presetPose(scene.cameraPreset ?? "orthographicFront");
|
|
850
|
-
const hasRot = scene.cameraRotX !== void 0 || scene.cameraRotY !== void 0 || scene.cameraRotZ !== void 0;
|
|
851
|
-
const latDeg = hasRot ? toDeg(scene.cameraRotX) : pose.lat;
|
|
852
|
-
const lonDeg = hasRot ? toDeg(scene.cameraRotY) : pose.lon;
|
|
853
|
-
const revDeg = hasRot ? toDeg(scene.cameraRotZ) : pose.rev;
|
|
854
|
-
const distance = pose.distance === void 0 ? void 0 : pose.distance * 192;
|
|
855
|
-
const zoom = normalizeZoom(scene.cameraZoom);
|
|
856
|
-
if (latDeg === 0 && lonDeg === 0 && revDeg === 0 && distance === void 0 && zoom === 1) return;
|
|
857
|
-
return {
|
|
858
|
-
projection: distance === void 0 ? "orthographic" : "perspective",
|
|
859
|
-
latDeg,
|
|
860
|
-
lonDeg,
|
|
861
|
-
revDeg,
|
|
862
|
-
distance: distance ?? 0,
|
|
863
|
-
zoom
|
|
864
|
-
};
|
|
865
|
-
}
|
|
866
|
-
function smartArt3DCameraMatrix(camera) {
|
|
867
|
-
const rad = Math.PI / 180;
|
|
868
|
-
const cl = Math.cos(camera.latDeg * rad);
|
|
869
|
-
const sl = Math.sin(camera.latDeg * rad);
|
|
870
|
-
const co = Math.cos(-camera.lonDeg * rad);
|
|
871
|
-
const so = Math.sin(-camera.lonDeg * rad);
|
|
872
|
-
const cr = Math.cos(camera.revDeg * rad);
|
|
873
|
-
const sr = Math.sin(camera.revDeg * rad);
|
|
874
|
-
const m = [
|
|
875
|
-
co,
|
|
876
|
-
0,
|
|
877
|
-
so,
|
|
878
|
-
sl * so,
|
|
879
|
-
cl,
|
|
880
|
-
-sl * co,
|
|
881
|
-
-cl * so,
|
|
882
|
-
sl,
|
|
883
|
-
cl * co
|
|
884
|
-
];
|
|
885
|
-
return [
|
|
886
|
-
cr * m[0] - sr * m[3],
|
|
887
|
-
cr * m[1] - sr * m[4],
|
|
888
|
-
cr * m[2] - sr * m[5],
|
|
889
|
-
sr * m[0] + cr * m[3],
|
|
890
|
-
sr * m[1] + cr * m[4],
|
|
891
|
-
sr * m[2] + cr * m[5],
|
|
892
|
-
m[6],
|
|
893
|
-
m[7],
|
|
894
|
-
m[8]
|
|
895
|
-
];
|
|
896
|
-
}
|
|
897
|
-
function smartArt3DEyeInDiagram(camera) {
|
|
898
|
-
if (camera.projection !== "perspective") return;
|
|
899
|
-
const m = smartArt3DCameraMatrix(camera);
|
|
900
|
-
return {
|
|
901
|
-
x: m[6] * camera.distance,
|
|
902
|
-
y: m[7] * camera.distance,
|
|
903
|
-
z: m[8] * camera.distance
|
|
904
|
-
};
|
|
905
|
-
}
|
|
906
|
-
function hasSmartArtShape3D(shape3d) {
|
|
907
|
-
if (!shape3d) return false;
|
|
908
|
-
return (shape3d.extrusionHeight ?? 0) > 0 || (shape3d.contourWidth ?? 0) > 0 || (shape3d.bevelTopWidth ?? 0) > 0 || (shape3d.bevelTopHeight ?? 0) > 0 || shape3d.bevelTopType !== void 0 || (shape3d.bevelBottomWidth ?? 0) > 0 || shape3d.bevelBottomType !== void 0;
|
|
909
|
-
}
|
|
910
|
-
function resolveSmartArt3DStylePath(shapes) {
|
|
911
|
-
if (shapes.some((shape) => shape.scene3d !== void 0)) return "bevel";
|
|
912
|
-
if (shapes.some((shape) => hasSmartArtShape3D(shape.shape3d))) return "scene";
|
|
913
|
-
return "flat";
|
|
914
|
-
}
|
|
915
|
-
const DEFAULT_BEVEL_EMU = 76200;
|
|
916
|
-
const MAX_BEVEL_FRACTION = .9;
|
|
917
|
-
function resolveBevel(type, widthEmu, heightEmu, maxWidth) {
|
|
918
|
-
if (type === void 0 && widthEmu === void 0 && heightEmu === void 0) return;
|
|
919
|
-
if (type === "none") return;
|
|
920
|
-
const width = Math.min((widthEmu ?? DEFAULT_BEVEL_EMU) / EMU_PER_PX, maxWidth);
|
|
921
|
-
const height = (heightEmu ?? DEFAULT_BEVEL_EMU) / EMU_PER_PX;
|
|
922
|
-
if (width <= 0 || height <= 0) return;
|
|
923
|
-
return {
|
|
924
|
-
width,
|
|
925
|
-
height,
|
|
926
|
-
profile: type ?? "circle"
|
|
927
|
-
};
|
|
928
|
-
}
|
|
929
|
-
function resolveSmartArt3DSolid(shape3d, halfExtent) {
|
|
930
|
-
if (!shape3d || !hasSmartArtShape3D(shape3d)) return;
|
|
931
|
-
const maxWidth = Math.max(0, halfExtent * MAX_BEVEL_FRACTION);
|
|
932
|
-
const bevelTop = resolveBevel(shape3d.bevelTopType, shape3d.bevelTopWidth, shape3d.bevelTopHeight, maxWidth);
|
|
933
|
-
const bevelBottom = resolveBevel(shape3d.bevelBottomType, shape3d.bevelBottomWidth, shape3d.bevelBottomHeight, maxWidth);
|
|
934
|
-
return {
|
|
935
|
-
...bevelTop ? { bevelTop } : {},
|
|
936
|
-
...bevelBottom ? { bevelBottom } : {},
|
|
937
|
-
extrusion: Math.max(0, (shape3d.extrusionHeight ?? 0) / EMU_PER_PX),
|
|
938
|
-
...shape3d.extrusionColor ? { extrusionColor: shape3d.extrusionColor } : {},
|
|
939
|
-
contourWidth: Math.max(0, (shape3d.contourWidth ?? 0) / EMU_PER_PX),
|
|
940
|
-
...shape3d.contourColor ? { contourColor: shape3d.contourColor } : {},
|
|
941
|
-
material: shape3d.presetMaterial ?? "warmMatte"
|
|
942
|
-
};
|
|
943
|
-
}
|
|
944
|
-
const DEFAULT_HIGHLIGHT = [{
|
|
945
|
-
azimuthDeg: 0,
|
|
946
|
-
elevationDeg: 60,
|
|
947
|
-
intensity: 1,
|
|
948
|
-
sharpness: 1
|
|
949
|
-
}];
|
|
950
|
-
const SMARTART_RIG_SPECULAR_LIGHTS = { threePt: [{
|
|
951
|
-
azimuthDeg: 64,
|
|
952
|
-
elevationDeg: 44,
|
|
953
|
-
intensity: 4.6,
|
|
954
|
-
sharpness: 3
|
|
955
|
-
}] };
|
|
956
|
-
function smartArt3DRigSpecularLights(rig, perspective) {
|
|
957
|
-
return (perspective && rig ? SMARTART_RIG_SPECULAR_LIGHTS[rig] : void 0) ?? DEFAULT_HIGHLIGHT;
|
|
958
|
-
}
|
|
959
|
-
const SMARTART_RIG_SCENE_KEY_LIGHTS = {
|
|
960
|
-
flat: {
|
|
961
|
-
azimuthDeg: 0,
|
|
962
|
-
elevationDeg: 40
|
|
963
|
-
},
|
|
964
|
-
threePt: {
|
|
965
|
-
azimuthDeg: 0,
|
|
966
|
-
elevationDeg: 90
|
|
967
|
-
},
|
|
968
|
-
morning: {
|
|
969
|
-
azimuthDeg: 0,
|
|
970
|
-
elevationDeg: 60
|
|
971
|
-
},
|
|
972
|
-
soft: {
|
|
973
|
-
azimuthDeg: 0,
|
|
974
|
-
elevationDeg: 80
|
|
975
|
-
}
|
|
976
|
-
};
|
|
977
|
-
function smartArt3DRigKeyLight(rig, sceneCamera) {
|
|
978
|
-
return sceneCamera && rig ? SMARTART_RIG_SCENE_KEY_LIGHTS[rig] : void 0;
|
|
979
|
-
}
|
|
980
|
-
const KEY_ELEVATION_DEG = 5;
|
|
981
|
-
const AMBIENT = .5;
|
|
982
|
-
const SPECULAR_GAIN = .6;
|
|
983
|
-
const VIEW = {
|
|
984
|
-
x: 0,
|
|
985
|
-
y: 0,
|
|
986
|
-
z: 1
|
|
987
|
-
};
|
|
988
|
-
const RIG_REFERENCE_GREY = 127;
|
|
989
|
-
const RIG_FACE_READING = {
|
|
990
|
-
morning: [
|
|
991
|
-
112,
|
|
992
|
-
108,
|
|
993
|
-
98
|
|
994
|
-
],
|
|
995
|
-
soft: [
|
|
996
|
-
121,
|
|
997
|
-
121,
|
|
998
|
-
121
|
|
999
|
-
]
|
|
1000
|
-
};
|
|
1001
|
-
function srgbChannelToLinear(c) {
|
|
1002
|
-
return c <= .04045 ? c / 12.92 : ((c + .055) / 1.055) ** 2.4;
|
|
1003
|
-
}
|
|
1004
|
-
function rigTint(rig) {
|
|
1005
|
-
const reading = rig ? RIG_FACE_READING[rig] : void 0;
|
|
1006
|
-
if (!reading) return [
|
|
1007
|
-
1,
|
|
1008
|
-
1,
|
|
1009
|
-
1
|
|
1010
|
-
];
|
|
1011
|
-
const reference = srgbChannelToLinear(RIG_REFERENCE_GREY / 255);
|
|
1012
|
-
return reading.map((c) => srgbChannelToLinear(c / 255) / reference);
|
|
1013
|
-
}
|
|
1014
|
-
function dot(a, b) {
|
|
1015
|
-
return a.x * b.x + a.y * b.y + a.z * b.z;
|
|
1016
|
-
}
|
|
1017
|
-
function normalize(v) {
|
|
1018
|
-
const len = Math.hypot(v.x, v.y, v.z) || 1;
|
|
1019
|
-
return {
|
|
1020
|
-
x: v.x / len,
|
|
1021
|
-
y: v.y / len,
|
|
1022
|
-
z: v.z / len
|
|
1023
|
-
};
|
|
1024
|
-
}
|
|
1025
|
-
function resolveSmartArt3DLightModel(lighting, material, perspective = false, sceneCamera = perspective) {
|
|
1026
|
-
const snap = getBevelHighlightDirection(lighting?.direction ?? "t");
|
|
1027
|
-
const rev = (lighting?.revDeg ?? 0) * Math.PI / 180;
|
|
1028
|
-
const ax = snap.dx;
|
|
1029
|
-
const ay = -snap.dy;
|
|
1030
|
-
const az = Math.hypot(ax, ay) || 1;
|
|
1031
|
-
const azX = (ax * Math.cos(rev) - ay * Math.sin(rev)) / az;
|
|
1032
|
-
const azY = (ax * Math.sin(rev) + ay * Math.cos(rev)) / az;
|
|
1033
|
-
const toward = (elevationDeg, azimuthDeg = 0) => {
|
|
1034
|
-
const elevation = elevationDeg * Math.PI / 180;
|
|
1035
|
-
const turn = azimuthDeg * Math.PI / 180;
|
|
1036
|
-
const dx = azX * Math.cos(turn) - azY * Math.sin(turn);
|
|
1037
|
-
const dy = azX * Math.sin(turn) + azY * Math.cos(turn);
|
|
1038
|
-
return normalize({
|
|
1039
|
-
x: dx * Math.cos(elevation),
|
|
1040
|
-
y: dy * Math.cos(elevation),
|
|
1041
|
-
z: Math.sin(elevation)
|
|
1042
|
-
});
|
|
1043
|
-
};
|
|
1044
|
-
const response = getMaterialLighting(material);
|
|
1045
|
-
const specular = response.specularConstant * SPECULAR_GAIN;
|
|
1046
|
-
const key = smartArt3DRigKeyLight(lighting?.rig, sceneCamera);
|
|
1047
|
-
return {
|
|
1048
|
-
light: key ? toward(key.elevationDeg, key.azimuthDeg) : toward(KEY_ELEVATION_DEG),
|
|
1049
|
-
highlights: smartArt3DRigSpecularLights(lighting?.rig, perspective).map((rigLight) => ({
|
|
1050
|
-
direction: toward(rigLight.elevationDeg, rigLight.azimuthDeg),
|
|
1051
|
-
weight: specular * rigLight.intensity,
|
|
1052
|
-
exponent: response.specularExponent * rigLight.sharpness
|
|
1053
|
-
})),
|
|
1054
|
-
ambient: AMBIENT,
|
|
1055
|
-
diffuse: response.diffuseConstant,
|
|
1056
|
-
tint: rigTint(lighting?.rig)
|
|
1057
|
-
};
|
|
1058
|
-
}
|
|
1059
|
-
function shadeSmartArt3DNormal(normal, model, eye) {
|
|
1060
|
-
const lambert = (n) => model.ambient + model.diffuse * Math.max(0, dot(n, model.light));
|
|
1061
|
-
const mul = lambert(normal) / lambert(VIEW);
|
|
1062
|
-
const view = eye ?? VIEW;
|
|
1063
|
-
let add = 0;
|
|
1064
|
-
for (const highlight of model.highlights) {
|
|
1065
|
-
const half = normalize({
|
|
1066
|
-
x: highlight.direction.x + view.x,
|
|
1067
|
-
y: highlight.direction.y + view.y,
|
|
1068
|
-
z: highlight.direction.z + view.z
|
|
1069
|
-
});
|
|
1070
|
-
const peak = (n) => Math.max(0, dot(n, half)) ** highlight.exponent;
|
|
1071
|
-
add += highlight.weight * Math.max(0, peak(normal) - (eye ? 0 : peak(VIEW)));
|
|
1072
|
-
}
|
|
1073
|
-
return {
|
|
1074
|
-
mul,
|
|
1075
|
-
add
|
|
1076
|
-
};
|
|
1077
|
-
}
|
|
1078
|
-
function srgbToLinear(c) {
|
|
1079
|
-
return c <= .04045 ? c / 12.92 : ((c + .055) / 1.055) ** 2.4;
|
|
1080
|
-
}
|
|
1081
|
-
function hexToRgb(hex) {
|
|
1082
|
-
const match = /^#?([0-9a-f]{6})$/iu.exec(hex.trim());
|
|
1083
|
-
if (!match) return [
|
|
1084
|
-
0,
|
|
1085
|
-
0,
|
|
1086
|
-
0
|
|
1087
|
-
];
|
|
1088
|
-
const n = Number.parseInt(match[1], 16);
|
|
1089
|
-
return [
|
|
1090
|
-
(n >> 16 & 255) / 255,
|
|
1091
|
-
(n >> 8 & 255) / 255,
|
|
1092
|
-
(n & 255) / 255
|
|
1093
|
-
];
|
|
1094
|
-
}
|
|
1095
|
-
function normalizeVec(v) {
|
|
1096
|
-
const len = Math.hypot(v.x, v.y, v.z) || 1;
|
|
1097
|
-
return {
|
|
1098
|
-
x: v.x / len,
|
|
1099
|
-
y: v.y / len,
|
|
1100
|
-
z: v.z / len
|
|
1101
|
-
};
|
|
1102
|
-
}
|
|
1103
|
-
const MIN_LINEAR = 1e-4;
|
|
1104
|
-
function shadeSmartArt3DVertices(positions, normals, baseAt, model, eye) {
|
|
1105
|
-
const out = new Float32Array(positions.length);
|
|
1106
|
-
for (let i = 0; i < positions.length; i += 3) {
|
|
1107
|
-
const { mul, add } = shadeSmartArt3DNormal({
|
|
1108
|
-
x: normals[i],
|
|
1109
|
-
y: normals[i + 1],
|
|
1110
|
-
z: normals[i + 2]
|
|
1111
|
-
}, model, eye ? normalizeVec({
|
|
1112
|
-
x: eye.x - positions[i],
|
|
1113
|
-
y: eye.y - positions[i + 1],
|
|
1114
|
-
z: eye.z - positions[i + 2]
|
|
1115
|
-
}) : void 0);
|
|
1116
|
-
const base = baseAt({
|
|
1117
|
-
x: positions[i],
|
|
1118
|
-
y: positions[i + 1]
|
|
1119
|
-
});
|
|
1120
|
-
for (let c = 0; c < 3; c++) {
|
|
1121
|
-
const target = Math.min(1, Math.max(0, base[c] * mul + add));
|
|
1122
|
-
const linBase = Math.max(MIN_LINEAR, srgbToLinear(base[c]));
|
|
1123
|
-
out[i + c] = srgbToLinear(target) / linBase * model.tint[c];
|
|
1124
|
-
}
|
|
1125
|
-
}
|
|
1126
|
-
return out;
|
|
1127
|
-
}
|
|
1128
|
-
const DEG_PER_UNIT = 6e4;
|
|
1129
|
-
function percent(value, fallback) {
|
|
1130
|
-
const parsed = value === void 0 ? NaN : Number.parseFloat(value);
|
|
1131
|
-
return Number.isFinite(parsed) ? parsed / 100 : fallback;
|
|
1132
|
-
}
|
|
1133
|
-
function buildSmartArt3DGradient(rendered, toLocal) {
|
|
1134
|
-
const gradient = rendered.gradient;
|
|
1135
|
-
if (!gradient || gradient.stops.length === 0) return;
|
|
1136
|
-
const at = (fx, fy) => toLocal({
|
|
1137
|
-
x: rendered.x + fx * rendered.width,
|
|
1138
|
-
y: rendered.y + fy * rendered.height
|
|
1139
|
-
});
|
|
1140
|
-
const stops = gradient.stops.map((stop) => ({
|
|
1141
|
-
offset: Math.max(0, Math.min(1, percent(stop.offset, 0))),
|
|
1142
|
-
color: stop.color
|
|
1143
|
-
}));
|
|
1144
|
-
if (gradient.kind === "radial") {
|
|
1145
|
-
const cx = percent(gradient.cx, .5);
|
|
1146
|
-
const cy = percent(gradient.cy, .5);
|
|
1147
|
-
const r = percent(gradient.r, .5);
|
|
1148
|
-
return {
|
|
1149
|
-
kind: "radial",
|
|
1150
|
-
from: at(cx, cy),
|
|
1151
|
-
to: at(cx + r, cy),
|
|
1152
|
-
stops
|
|
1153
|
-
};
|
|
1154
|
-
}
|
|
1155
|
-
return {
|
|
1156
|
-
kind: "linear",
|
|
1157
|
-
from: at(percent(gradient.x1, 0), percent(gradient.y1, 0)),
|
|
1158
|
-
to: at(percent(gradient.x2, 1), percent(gradient.y2, 0)),
|
|
1159
|
-
stops
|
|
1160
|
-
};
|
|
1161
|
-
}
|
|
1162
|
-
function smartArt3DGradientCoordinate(p, gradient) {
|
|
1163
|
-
const dx = gradient.to.x - gradient.from.x;
|
|
1164
|
-
const dy = gradient.to.y - gradient.from.y;
|
|
1165
|
-
const lengthSq = dx * dx + dy * dy;
|
|
1166
|
-
if (lengthSq <= 0) return 0;
|
|
1167
|
-
const u = gradient.kind === "radial" ? Math.hypot(p.x - gradient.from.x, p.y - gradient.from.y) / Math.sqrt(lengthSq) : ((p.x - gradient.from.x) * dx + (p.y - gradient.from.y) * dy) / lengthSq;
|
|
1168
|
-
return Math.max(0, Math.min(1, u));
|
|
1169
|
-
}
|
|
1170
|
-
function smartArt3DGradientColor(gradient, p) {
|
|
1171
|
-
const u = smartArt3DGradientCoordinate(p, gradient);
|
|
1172
|
-
const stops = gradient.stops;
|
|
1173
|
-
if (u <= stops[0].offset) return hexToRgb(stops[0].color);
|
|
1174
|
-
for (let i = 1; i < stops.length; i++) {
|
|
1175
|
-
const b = stops[i];
|
|
1176
|
-
if (u <= b.offset) {
|
|
1177
|
-
const a = stops[i - 1];
|
|
1178
|
-
const span = b.offset - a.offset;
|
|
1179
|
-
const f = span > 0 ? (u - a.offset) / span : 1;
|
|
1180
|
-
const ca = hexToRgb(a.color);
|
|
1181
|
-
const cb = hexToRgb(b.color);
|
|
1182
|
-
return [
|
|
1183
|
-
ca[0] + (cb[0] - ca[0]) * f,
|
|
1184
|
-
ca[1] + (cb[1] - ca[1]) * f,
|
|
1185
|
-
ca[2] + (cb[2] - ca[2]) * f
|
|
1186
|
-
];
|
|
1187
|
-
}
|
|
1188
|
-
}
|
|
1189
|
-
return hexToRgb(stops[stops.length - 1].color);
|
|
1190
|
-
}
|
|
1191
|
-
function decorateSmartArt3DMesh(mesh, shape, rendered, toLocal) {
|
|
1192
|
-
mesh.flat = false;
|
|
1193
|
-
const solid = resolveSmartArt3DSolid(shape.shape3d, Math.min(rendered.width, rendered.height) / 2);
|
|
1194
|
-
if (solid) mesh.solid = solid;
|
|
1195
|
-
const textExtrusion = (shape.text3d?.extrusionHeight ?? 0) / EMU_PER_PX;
|
|
1196
|
-
if (mesh.textBlock && textExtrusion > 0) {
|
|
1197
|
-
mesh.textBlock.extrusion = textExtrusion;
|
|
1198
|
-
if (shape.text3d?.extrusionColor) mesh.textBlock.extrusionColor = shape.text3d.extrusionColor;
|
|
1199
|
-
}
|
|
1200
|
-
const gradient = buildSmartArt3DGradient(rendered, toLocal);
|
|
1201
|
-
if (gradient) mesh.gradient = gradient;
|
|
1202
|
-
}
|
|
1203
|
-
function resolveSmartArt3DSceneSetup(data, category) {
|
|
1204
|
-
if (category === "flat") return {};
|
|
1205
|
-
const diagramScene = data.quickStyle?.scene3d;
|
|
1206
|
-
const rigScene = category === "bevel" ? data.drawingShapes?.find((s) => s.scene3d?.lightRigType)?.scene3d ?? diagramScene : diagramScene;
|
|
1207
|
-
const lighting = {
|
|
1208
|
-
rig: rigScene?.lightRigType ?? "threePt",
|
|
1209
|
-
direction: rigScene?.lightRigDirection ?? "t",
|
|
1210
|
-
revDeg: (rigScene?.lightRigRotZ ?? 0) / DEG_PER_UNIT
|
|
1211
|
-
};
|
|
1212
|
-
const camera = category === "scene" ? resolveSmartArt3DCamera(diagramScene) : void 0;
|
|
1213
|
-
return {
|
|
1214
|
-
lighting,
|
|
1215
|
-
...camera ? { camera } : {}
|
|
1216
|
-
};
|
|
1217
|
-
}
|
|
1218
|
-
const MAX_VIEW_PIXELS = 4096;
|
|
1219
|
-
function createRenderer(three, state) {
|
|
1220
|
-
try {
|
|
1221
|
-
const renderer = new three.WebGLRenderer({
|
|
1222
|
-
antialias: true,
|
|
1223
|
-
alpha: true,
|
|
1224
|
-
premultipliedAlpha: true,
|
|
1225
|
-
powerPreference: "default"
|
|
1226
|
-
});
|
|
1227
|
-
renderer.setPixelRatio(1);
|
|
1228
|
-
renderer.outputColorSpace = three.SRGBColorSpace;
|
|
1229
|
-
renderer.autoClear = false;
|
|
1230
|
-
const canvas = renderer.domElement;
|
|
1231
|
-
canvas.addEventListener("webglcontextlost", (event) => {
|
|
1232
|
-
event.preventDefault();
|
|
1233
|
-
state.lost = true;
|
|
1234
|
-
});
|
|
1235
|
-
canvas.addEventListener("webglcontextrestored", () => {
|
|
1236
|
-
state.lost = false;
|
|
1237
|
-
for (const view of state.views) state.dirty.add(view);
|
|
1238
|
-
schedule(state);
|
|
1239
|
-
});
|
|
1240
|
-
return renderer;
|
|
1241
|
-
} catch {
|
|
1242
|
-
return null;
|
|
1243
|
-
}
|
|
1244
|
-
}
|
|
1245
|
-
function ensureBuffer(state, width, height) {
|
|
1246
|
-
const renderer = state.renderer;
|
|
1247
|
-
if (!renderer || width <= state.bufferWidth && height <= state.bufferHeight) return;
|
|
1248
|
-
state.bufferWidth = Math.min(MAX_VIEW_PIXELS, Math.max(state.bufferWidth, width));
|
|
1249
|
-
state.bufferHeight = Math.min(MAX_VIEW_PIXELS, Math.max(state.bufferHeight, height));
|
|
1250
|
-
renderer.setSize(state.bufferWidth, state.bufferHeight, false);
|
|
1251
|
-
}
|
|
1252
|
-
function drawView(state, view) {
|
|
1253
|
-
const renderer = state.renderer;
|
|
1254
|
-
if (!renderer) return;
|
|
1255
|
-
const size = view.pixelSize();
|
|
1256
|
-
const width = Math.max(1, Math.min(MAX_VIEW_PIXELS, Math.round(size.width)));
|
|
1257
|
-
const height = Math.max(1, Math.min(MAX_VIEW_PIXELS, Math.round(size.height)));
|
|
1258
|
-
ensureBuffer(state, width, height);
|
|
1259
|
-
const y = state.bufferHeight - height;
|
|
1260
|
-
renderer.setViewport(0, y, width, height);
|
|
1261
|
-
renderer.setScissor(0, y, width, height);
|
|
1262
|
-
renderer.setScissorTest(true);
|
|
1263
|
-
renderer.setClearColor(0, 0);
|
|
1264
|
-
renderer.clear(true, true, true);
|
|
1265
|
-
view.draw(renderer);
|
|
1266
|
-
const target = view.canvas;
|
|
1267
|
-
if (target.width !== width || target.height !== height) {
|
|
1268
|
-
target.width = width;
|
|
1269
|
-
target.height = height;
|
|
1270
|
-
}
|
|
1271
|
-
const ctx = target.getContext("2d");
|
|
1272
|
-
if (!ctx) return;
|
|
1273
|
-
ctx.clearRect(0, 0, width, height);
|
|
1274
|
-
ctx.drawImage(renderer.domElement, 0, 0, width, height, 0, 0, width, height);
|
|
1275
|
-
}
|
|
1276
|
-
function flush(state) {
|
|
1277
|
-
state.frame = 0;
|
|
1278
|
-
if (state.lost || !state.renderer) return;
|
|
1279
|
-
const pending = [...state.dirty];
|
|
1280
|
-
state.dirty.clear();
|
|
1281
|
-
for (const view of pending) {
|
|
1282
|
-
if (!state.views.has(view)) continue;
|
|
1283
|
-
if (!view.isVisible()) {
|
|
1284
|
-
state.dirty.add(view);
|
|
1285
|
-
continue;
|
|
1286
|
-
}
|
|
1287
|
-
try {
|
|
1288
|
-
drawView(state, view);
|
|
1289
|
-
} catch (error) {
|
|
1290
|
-
console.error("[pptx-three-view] scene render failed", error);
|
|
1291
|
-
continue;
|
|
1292
|
-
}
|
|
1293
|
-
if (view.isAnimating()) state.dirty.add(view);
|
|
1294
|
-
}
|
|
1295
|
-
if ([...state.dirty].some((v) => v.isVisible())) schedule(state);
|
|
1296
|
-
}
|
|
1297
|
-
function schedule(state) {
|
|
1298
|
-
if (state.frame !== 0 || typeof requestAnimationFrame === "undefined") return;
|
|
1299
|
-
state.frame = requestAnimationFrame(() => flush(state));
|
|
1300
|
-
}
|
|
1301
|
-
let sharedHost = null;
|
|
1302
|
-
function getThreeRendererHost(three) {
|
|
1303
|
-
if (sharedHost) return sharedHost;
|
|
1304
|
-
const state = {
|
|
1305
|
-
three,
|
|
1306
|
-
renderer: null,
|
|
1307
|
-
views: /* @__PURE__ */ new Set(),
|
|
1308
|
-
dirty: /* @__PURE__ */ new Set(),
|
|
1309
|
-
frame: 0,
|
|
1310
|
-
lost: false,
|
|
1311
|
-
bufferWidth: 0,
|
|
1312
|
-
bufferHeight: 0
|
|
1313
|
-
};
|
|
1314
|
-
state.renderer = createRenderer(three, state);
|
|
1315
|
-
const host = {
|
|
1316
|
-
available: state.renderer !== null,
|
|
1317
|
-
register(view) {
|
|
1318
|
-
state.views.add(view);
|
|
1319
|
-
state.dirty.add(view);
|
|
1320
|
-
schedule(state);
|
|
1321
|
-
},
|
|
1322
|
-
unregister(view) {
|
|
1323
|
-
state.views.delete(view);
|
|
1324
|
-
state.dirty.delete(view);
|
|
1325
|
-
},
|
|
1326
|
-
requestRender(view) {
|
|
1327
|
-
if (!state.views.has(view)) return;
|
|
1328
|
-
state.dirty.add(view);
|
|
1329
|
-
schedule(state);
|
|
1330
|
-
},
|
|
1331
|
-
flushNow() {
|
|
1332
|
-
if (state.frame !== 0 && typeof cancelAnimationFrame !== "undefined") cancelAnimationFrame(state.frame);
|
|
1333
|
-
flush(state);
|
|
1334
|
-
},
|
|
1335
|
-
drawNow(view) {
|
|
1336
|
-
if (state.lost || !state.renderer || !state.views.has(view)) return;
|
|
1337
|
-
state.dirty.delete(view);
|
|
1338
|
-
try {
|
|
1339
|
-
drawView(state, view);
|
|
1340
|
-
} catch (error) {
|
|
1341
|
-
console.error("[pptx-three-view] scene render failed", error);
|
|
1342
|
-
}
|
|
1343
|
-
}
|
|
1344
|
-
};
|
|
1345
|
-
sharedHost = host;
|
|
1346
|
-
return host;
|
|
1347
|
-
}
|
|
1348
|
-
const MAX_THREE_VIEW_OVERFLOW = .5;
|
|
1349
|
-
const OVERFLOW_MARGIN = .01;
|
|
1350
|
-
const NO_THREE_VIEW_OVERFLOW = {
|
|
1351
|
-
top: 0,
|
|
1352
|
-
right: 0,
|
|
1353
|
-
bottom: 0,
|
|
1354
|
-
left: 0
|
|
1355
|
-
};
|
|
1356
|
-
function side(reach) {
|
|
1357
|
-
if (!(reach > 0)) return 0;
|
|
1358
|
-
return Math.min(MAX_THREE_VIEW_OVERFLOW, reach + OVERFLOW_MARGIN);
|
|
1359
|
-
}
|
|
1360
|
-
function threeViewOverflowFromNdc(points) {
|
|
1361
|
-
if (points.length === 0) return NO_THREE_VIEW_OVERFLOW;
|
|
1362
|
-
let minX = Infinity;
|
|
1363
|
-
let maxX = -Infinity;
|
|
1364
|
-
let minY = Infinity;
|
|
1365
|
-
let maxY = -Infinity;
|
|
1366
|
-
for (const p of points) {
|
|
1367
|
-
if (!Number.isFinite(p.x) || !Number.isFinite(p.y)) continue;
|
|
1368
|
-
minX = Math.min(minX, p.x);
|
|
1369
|
-
maxX = Math.max(maxX, p.x);
|
|
1370
|
-
minY = Math.min(minY, p.y);
|
|
1371
|
-
maxY = Math.max(maxY, p.y);
|
|
1372
|
-
}
|
|
1373
|
-
if (minX > maxX) return NO_THREE_VIEW_OVERFLOW;
|
|
1374
|
-
return {
|
|
1375
|
-
top: side((maxY - 1) / 2),
|
|
1376
|
-
right: side((maxX - 1) / 2),
|
|
1377
|
-
bottom: side((-1 - minY) / 2),
|
|
1378
|
-
left: side((-1 - minX) / 2)
|
|
1379
|
-
};
|
|
1380
|
-
}
|
|
1381
|
-
function hasThreeViewOverflow(overflow) {
|
|
1382
|
-
return Boolean(overflow && (overflow.top > 0 || overflow.right > 0 || overflow.bottom > 0 || overflow.left > 0));
|
|
1383
|
-
}
|
|
1384
|
-
function threeViewOverflowChanged(a, b) {
|
|
1385
|
-
return a.top !== b.top || a.right !== b.right || a.bottom !== b.bottom || a.left !== b.left;
|
|
1386
|
-
}
|
|
1387
|
-
function overflowPixelSize(size, overflow) {
|
|
1388
|
-
const clamp = (px) => Math.max(1, Math.min(MAX_VIEW_PIXELS, Math.round(px)));
|
|
1389
|
-
return {
|
|
1390
|
-
width: clamp(size.pixelWidth * (1 + overflow.left + overflow.right)),
|
|
1391
|
-
height: clamp(size.pixelHeight * (1 + overflow.top + overflow.bottom))
|
|
1392
|
-
};
|
|
1393
|
-
}
|
|
1394
|
-
function overflowViewOffset(size, overflow) {
|
|
1395
|
-
const fullWidth = Math.max(1, size.pixelWidth);
|
|
1396
|
-
const fullHeight = Math.max(1, size.pixelHeight);
|
|
1397
|
-
return {
|
|
1398
|
-
fullWidth,
|
|
1399
|
-
fullHeight,
|
|
1400
|
-
x: -overflow.left * fullWidth,
|
|
1401
|
-
y: -overflow.top * fullHeight,
|
|
1402
|
-
width: fullWidth * (1 + overflow.left + overflow.right),
|
|
1403
|
-
height: fullHeight * (1 + overflow.top + overflow.bottom)
|
|
1404
|
-
};
|
|
1405
|
-
}
|
|
1406
|
-
function overflowCanvasCss(overflow) {
|
|
1407
|
-
if (!hasThreeViewOverflow(overflow)) return "";
|
|
1408
|
-
const pct = (v) => `${Number((v * 100).toFixed(4))}%`;
|
|
1409
|
-
return [
|
|
1410
|
-
`left:${pct(-overflow.left)}`,
|
|
1411
|
-
`top:${pct(-overflow.top)}`,
|
|
1412
|
-
`width:${pct(1 + overflow.left + overflow.right)}`,
|
|
1413
|
-
`height:${pct(1 + overflow.top + overflow.bottom)}`
|
|
1414
|
-
].join(";");
|
|
1415
|
-
}
|
|
1416
|
-
export { getMaterialLighting as C, isBevelProfileInverted as E, getLightRigLighting as S, getBevelHighlightDirection as T, resolveSmartArt3DStylePath as _, overflowViewOffset as a, CAMERA_PRESET_MAP as b, MAX_VIEW_PIXELS as c, resolveSmartArt3DSceneSetup as d, smartArt3DGradientColor as f, resolveSmartArt3DLightModel as g, shadeSmartArt3DVertices as h, overflowPixelSize as i, getThreeRendererHost as l, hexToRgb as m, hasThreeViewOverflow as n, threeViewOverflowChanged as o, smartArt3DGradientCoordinate as p, overflowCanvasCss as r, threeViewOverflowFromNdc as s, NO_THREE_VIEW_OVERFLOW as t, decorateSmartArt3DMesh as u, smartArt3DCameraMatrix as v, getBevelProfileHeightMap as w, EMU_PER_PX as x, smartArt3DEyeInDiagram as y };
|
|
1417
|
-
|
|
1418
|
-
//# sourceMappingURL=pptx-angular-viewer-view-overflow-BBD8nZlq.mjs.map
|