@colijnit/configurator 1.0.17 → 12.0.4
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/app/builder.d.ts +15 -4
- package/app/components/answers/answer/answer.component.d.ts +3 -3
- package/app/components/selections/selections.component.d.ts +5 -6
- package/app/services/configurator.service.d.ts +2 -5
- package/app/utils/object.utils.d.ts +7 -0
- package/bundles/colijnit-configurator.umd.js +1051 -568
- package/bundles/colijnit-configurator.umd.js.map +1 -1
- package/colijnit-configurator.d.ts +2 -3
- package/colijnit-configurator.metadata.json +1 -1
- package/esm2015/app/builder.js +126 -44
- package/esm2015/app/components/answers/answer/answer.component.js +29 -32
- package/esm2015/app/components/answers/answers.component.js +16 -21
- package/esm2015/app/components/answers/answers.module.js +20 -22
- package/esm2015/app/components/selections/selections.component.js +29 -34
- package/esm2015/app/components/selections/selections.module.js +17 -19
- package/esm2015/app/components/shared/loader/loader.component.js +10 -12
- package/esm2015/app/components/shared/shared.module.js +16 -18
- package/esm2015/app/directives/visibility-observer-master.directive.js +9 -10
- package/esm2015/app/directives/visibility-observer.directive.js +13 -15
- package/esm2015/app/services/configurator.service.js +4 -23
- package/esm2015/app/services/image-cache.service.js +10 -13
- package/esm2015/app/services/locator.service.js +6 -8
- package/esm2015/app/utils/object.utils.js +49 -0
- package/esm2015/colijnit-configurator.js +3 -4
- package/esm2015/helper/variation-helper.js +174 -41
- package/esm2015/model/material.js +1 -1
- package/esm2015/model/variation-settings.js +4 -1
- package/esm2015/model/variation.js +1 -1
- package/esm2015/public_api.js +1 -1
- package/esm2015/utils/asset.utils.js +64 -12
- package/esm2015/utils/file.utils.js +4 -1
- package/esm2015/utils/image.utils.js +1 -1
- package/esm2015/utils/object.utils.js +1 -1
- package/esm2015/utils/scene-utils.js +1 -1
- package/esm2015/utils/threed.utils.js +3 -3
- package/esm2015/utils/variation-utils.js +99 -29
- package/fesm2015/colijnit-configurator.js +705 -403
- package/fesm2015/colijnit-configurator.js.map +1 -1
- package/helper/variation-helper.d.ts +1 -1
- package/model/material.d.ts +16 -0
- package/model/variation-settings.d.ts +21 -0
- package/package.json +19 -26
- package/utils/asset.utils.d.ts +3 -0
- package/utils/threed.utils.d.ts +1 -1
- package/utils/variation-utils.d.ts +1 -0
- package/bundles/colijnit-configurator.umd.min.js +0 -17
- package/bundles/colijnit-configurator.umd.min.js.map +0 -1
- package/esm5/app/builder.js +0 -591
- package/esm5/app/components/answers/answer/answer.component.js +0 -64
- package/esm5/app/components/answers/answers.component.js +0 -27
- package/esm5/app/components/answers/answers.module.js +0 -32
- package/esm5/app/components/selections/selections.component.js +0 -104
- package/esm5/app/components/selections/selections.module.js +0 -26
- package/esm5/app/components/shared/loader/loader.component.js +0 -16
- package/esm5/app/components/shared/shared.module.js +0 -24
- package/esm5/app/directives/visibility-observer-master.directive.js +0 -64
- package/esm5/app/directives/visibility-observer.directive.js +0 -59
- package/esm5/app/services/configurator.service.js +0 -160
- package/esm5/app/services/image-cache.service.js +0 -69
- package/esm5/app/services/locator.service.js +0 -13
- package/esm5/colijnit-configurator.js +0 -11
- package/esm5/helper/variation-helper.js +0 -268
- package/esm5/model/material.js +0 -13
- package/esm5/model/variation-settings.js +0 -8
- package/esm5/model/variation.js +0 -7
- package/esm5/public_api.js +0 -7
- package/esm5/utils/asset.utils.js +0 -106
- package/esm5/utils/file.utils.js +0 -151
- package/esm5/utils/image.utils.js +0 -56
- package/esm5/utils/object.utils.js +0 -56
- package/esm5/utils/scene-utils.js +0 -98
- package/esm5/utils/threed.utils.js +0 -279
- package/esm5/utils/variation-utils.js +0 -327
- package/fesm5/colijnit-configurator.js +0 -2527
- package/fesm5/colijnit-configurator.js.map +0 -1
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import { __awaiter
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import { __awaiter } from 'tslib';
|
|
2
|
+
import * as THREE from 'three';
|
|
3
|
+
import { Mesh, sRGBEncoding } from 'three';
|
|
4
4
|
import { DecoNode } from '@colijnit/configuratorapi/build/model/deco-node';
|
|
5
5
|
import { BusinessObjectFactory } from '@colijnit/configuratorapi/build/service/business-object-factory';
|
|
6
6
|
import { Selection } from '@colijnit/configuratorapi/build/model/selection';
|
|
7
7
|
import { DecoNodeType } from '@colijnit/configuratorapi/build/enum/deco-node-type.enum';
|
|
8
8
|
import axios from 'axios';
|
|
9
9
|
import { DecoNodeKind } from '@colijnit/configuratorapi/build/enum/deco-node-kind.enum';
|
|
10
|
-
import
|
|
10
|
+
import { Subject, BehaviorSubject } from 'rxjs';
|
|
11
|
+
import JSZip from 'jszip';
|
|
11
12
|
import { Article } from '@colijnit/configuratorapi/build/model/article';
|
|
12
|
-
import { Injectable, Injector, ɵɵdefineInjectable, ɵɵinject, INJECTOR, EventEmitter, Input, Output, Component, Directive, ElementRef, NgModule } from '@angular/core';
|
|
13
13
|
import { Configurator } from '@colijnit/configuratorapi/build/configurator';
|
|
14
14
|
import { notNill } from '@colijnit/configuratorapi/build/utils/function/not-nill.function';
|
|
15
15
|
import { NodeType } from '@colijnit/configuratorapi/build/enum/node-type.enum';
|
|
16
16
|
import { isNill } from '@colijnit/configuratorapi/build/utils/function/is-nill.function';
|
|
17
|
-
import
|
|
17
|
+
import * as i0 from '@angular/core';
|
|
18
|
+
import { Injectable, EventEmitter, Component, Input, Output, Directive, ElementRef, NgModule } from '@angular/core';
|
|
18
19
|
import { CommonModule } from '@angular/common';
|
|
19
20
|
import { trigger, state, style, transition, animate } from '@angular/animations';
|
|
20
21
|
|
|
21
|
-
class ObjectUtils {
|
|
22
|
+
class ObjectUtils$1 {
|
|
22
23
|
static DisposeMaterial(material) {
|
|
23
24
|
if (!material) {
|
|
24
25
|
return;
|
|
@@ -64,7 +65,7 @@ class ObjectUtils {
|
|
|
64
65
|
});
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
|
-
ObjectUtils.materialProps = ['map', 'lightMap', 'bumpMap', 'normalMap', 'specularMap', 'envMap', 'aoMap', 'roughnessMap', 'metalnessMap'];
|
|
68
|
+
ObjectUtils$1.materialProps = ['map', 'lightMap', 'bumpMap', 'normalMap', 'specularMap', 'envMap', 'aoMap', 'roughnessMap', 'metalnessMap'];
|
|
68
69
|
|
|
69
70
|
// Static utility functions holder related to files.
|
|
70
71
|
// @dynamic
|
|
@@ -85,6 +86,9 @@ class FileUtils {
|
|
|
85
86
|
}
|
|
86
87
|
static FileExists(url, assetPath) {
|
|
87
88
|
return __awaiter(this, void 0, void 0, function* () {
|
|
89
|
+
if (!assetPath.endsWith('/')) {
|
|
90
|
+
assetPath = assetPath + '/';
|
|
91
|
+
}
|
|
88
92
|
const result = yield axios({
|
|
89
93
|
method: 'get',
|
|
90
94
|
url: `${assetPath}getFiles.php?assetUrl=${url}`,
|
|
@@ -209,10 +213,10 @@ class ThreedUtils {
|
|
|
209
213
|
}
|
|
210
214
|
clearCache() {
|
|
211
215
|
const objs = Array.from(this._objectCache.values());
|
|
212
|
-
objs.forEach(o => ObjectUtils.DisposeObject(o));
|
|
216
|
+
objs.forEach(o => ObjectUtils$1.DisposeObject(o));
|
|
213
217
|
this._objectCache.clear();
|
|
214
218
|
}
|
|
215
|
-
download3DSource(fileName) {
|
|
219
|
+
download3DSource(fileName, assetPath) {
|
|
216
220
|
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
217
221
|
fileName = fileName.replace('.unity3d', '');
|
|
218
222
|
let lookupFileName = fileName + (fileName.indexOf('.glb') < 0 ? '.glb' : '');
|
|
@@ -220,7 +224,7 @@ class ThreedUtils {
|
|
|
220
224
|
resolve(this._objectCache.get(lookupFileName));
|
|
221
225
|
return;
|
|
222
226
|
}
|
|
223
|
-
if (yield FileUtils.FileExists(lookupFileName,
|
|
227
|
+
if (yield FileUtils.FileExists(lookupFileName, assetPath)) {
|
|
224
228
|
this.loadGlbSource(lookupFileName).then((obj) => {
|
|
225
229
|
this._objectCache.set(lookupFileName, obj);
|
|
226
230
|
resolve(obj);
|
|
@@ -245,7 +249,7 @@ class ThreedUtils {
|
|
|
245
249
|
return Promise.resolve(this._objectCache.get(filePath));
|
|
246
250
|
}
|
|
247
251
|
const json = yield this._readJsonFile(filePath);
|
|
248
|
-
const loader = new ObjectLoader();
|
|
252
|
+
const loader = new THREE.ObjectLoader();
|
|
249
253
|
loader.crossOrigin = 'Anonymous';
|
|
250
254
|
return new Promise((resolve, reject) => {
|
|
251
255
|
try {
|
|
@@ -264,7 +268,7 @@ class ThreedUtils {
|
|
|
264
268
|
if (this._objectCache.has(filePath)) {
|
|
265
269
|
return Promise.resolve(this._objectCache.get(filePath));
|
|
266
270
|
}
|
|
267
|
-
const loader = new ObjectLoader();
|
|
271
|
+
const loader = new THREE.ObjectLoader();
|
|
268
272
|
loader.setCrossOrigin('Anonymous');
|
|
269
273
|
loader.setResourcePath('');
|
|
270
274
|
return new Promise((resolve, reject) => {
|
|
@@ -301,7 +305,7 @@ class ThreedUtils {
|
|
|
301
305
|
return __awaiter(this, void 0, void 0, function* () {
|
|
302
306
|
const obj = yield this.loadGlbModel(file, false);
|
|
303
307
|
if (obj) {
|
|
304
|
-
obj.children = obj.children.filter(c => !(c instanceof Camera));
|
|
308
|
+
obj.children = obj.children.filter(c => !(c instanceof THREE.Camera));
|
|
305
309
|
obj.children.sort((a, b) => a['name'] < b['name'] ? 1 : -1);
|
|
306
310
|
obj.children.forEach((c) => {
|
|
307
311
|
c.traverse((t) => {
|
|
@@ -309,7 +313,7 @@ class ThreedUtils {
|
|
|
309
313
|
});
|
|
310
314
|
c.visible = false;
|
|
311
315
|
});
|
|
312
|
-
if (obj.children.length === 1 && obj.children[0] instanceof Group) { // flatten children
|
|
316
|
+
if (obj.children.length === 1 && obj.children[0] instanceof THREE.Group) { // flatten children
|
|
313
317
|
const children = obj.children[0].children.slice();
|
|
314
318
|
obj.children.length = 0;
|
|
315
319
|
obj.children = children;
|
|
@@ -322,11 +326,11 @@ class ThreedUtils {
|
|
|
322
326
|
return __awaiter(this, void 0, void 0, function* () {
|
|
323
327
|
// url = this._includeBaseUrl(url);
|
|
324
328
|
return new Promise((resolve, reject) => {
|
|
325
|
-
const textureLoader = new TextureLoader();
|
|
329
|
+
const textureLoader = new THREE.TextureLoader();
|
|
326
330
|
// textureLoader.setBaseU(this._settingsService.settings.assetPath);
|
|
327
331
|
textureLoader.load(url, (texture) => {
|
|
328
|
-
texture.wrapT = RepeatWrapping;
|
|
329
|
-
texture.wrapS = RepeatWrapping;
|
|
332
|
+
texture.wrapT = THREE.RepeatWrapping;
|
|
333
|
+
texture.wrapS = THREE.RepeatWrapping;
|
|
330
334
|
texture.repeat.set(1, 1);
|
|
331
335
|
texture.needsUpdate = true;
|
|
332
336
|
return resolve(texture);
|
|
@@ -335,13 +339,13 @@ class ThreedUtils {
|
|
|
335
339
|
});
|
|
336
340
|
}
|
|
337
341
|
_cleanedUpObjects(object, cleanUp = true) {
|
|
338
|
-
let obj = new Object3D();
|
|
342
|
+
let obj = new THREE.Object3D();
|
|
339
343
|
object.children.forEach((c) => {
|
|
340
|
-
if (!(c instanceof Camera)) {
|
|
341
|
-
if (cleanUp && c instanceof Group || (c.children.length === 1 && c.children[0] instanceof Group)) {
|
|
344
|
+
if (!(c instanceof THREE.Camera)) {
|
|
345
|
+
if (cleanUp && c instanceof THREE.Group || (c.children.length === 1 && c.children[0] instanceof THREE.Group)) {
|
|
342
346
|
this._addGroupChildrenToObject(c, obj);
|
|
343
347
|
}
|
|
344
|
-
else if ((cleanUp && !(c instanceof Mesh)) || (!(c instanceof Mesh) && !c.name && c.children.length > 0)) {
|
|
348
|
+
else if ((cleanUp && !(c instanceof THREE.Mesh)) || (!(c instanceof THREE.Mesh) && !c.name && c.children.length > 0)) {
|
|
345
349
|
c.children.forEach((child) => {
|
|
346
350
|
child.translateY(c.position.y);
|
|
347
351
|
});
|
|
@@ -364,10 +368,10 @@ class ThreedUtils {
|
|
|
364
368
|
}
|
|
365
369
|
}
|
|
366
370
|
});
|
|
367
|
-
const boundingBox = new Box3().setFromObject(obj);
|
|
368
|
-
const bbCenterPivot = new Vector3();
|
|
371
|
+
const boundingBox = new THREE.Box3().setFromObject(obj);
|
|
372
|
+
const bbCenterPivot = new THREE.Vector3();
|
|
369
373
|
boundingBox.getCenter(bbCenterPivot);
|
|
370
|
-
const delta = new Vector3().add(bbCenterPivot).negate();
|
|
374
|
+
const delta = new THREE.Vector3().add(bbCenterPivot).negate();
|
|
371
375
|
obj.children.forEach((cc) => {
|
|
372
376
|
cc.position.add(delta);
|
|
373
377
|
});
|
|
@@ -375,7 +379,7 @@ class ThreedUtils {
|
|
|
375
379
|
}
|
|
376
380
|
_addGroupChildrenToObject(group, obj, cleanUp = true) {
|
|
377
381
|
group.children.forEach((gc) => {
|
|
378
|
-
if (cleanUp && gc instanceof Group) {
|
|
382
|
+
if (cleanUp && gc instanceof THREE.Group) {
|
|
379
383
|
this._addGroupChildrenToObject(gc, obj);
|
|
380
384
|
}
|
|
381
385
|
else {
|
|
@@ -389,7 +393,7 @@ class ThreedUtils {
|
|
|
389
393
|
_iterateChildren(children, callback) {
|
|
390
394
|
for (let i = 0; i < children.length; i++) {
|
|
391
395
|
const child = children[i];
|
|
392
|
-
if (child instanceof Mesh) {
|
|
396
|
+
if (child instanceof THREE.Mesh) {
|
|
393
397
|
callback(child);
|
|
394
398
|
}
|
|
395
399
|
else {
|
|
@@ -450,17 +454,17 @@ class SceneUtils {
|
|
|
450
454
|
}
|
|
451
455
|
static Convert3DPointToScreenPoint(point, camera, width, height) {
|
|
452
456
|
if (!point) {
|
|
453
|
-
return new Vector2();
|
|
457
|
+
return new THREE.Vector2();
|
|
454
458
|
}
|
|
455
459
|
const vector = point.clone().project(camera);
|
|
456
460
|
vector.x = (vector.x + 1) / 2 * width;
|
|
457
461
|
vector.y = -(vector.y - 1) / 2 * height;
|
|
458
|
-
return new Vector2(vector.x, vector.y);
|
|
462
|
+
return new THREE.Vector2(vector.x, vector.y);
|
|
459
463
|
}
|
|
460
464
|
static CanSelectorConnect(con1, con2) {
|
|
461
|
-
const con1Name = con1 instanceof Object3D ? con1.name : con1.connector;
|
|
462
|
-
const con2Name = con2 instanceof Object3D ? con2.name : con2.connector;
|
|
463
|
-
const sameParent = con1 instanceof Object3D && con2 instanceof Object3D ? con1.parent === con2.parent : false;
|
|
465
|
+
const con1Name = con1 instanceof THREE.Object3D ? con1.name : con1.connector;
|
|
466
|
+
const con2Name = con2 instanceof THREE.Object3D ? con2.name : con2.connector;
|
|
467
|
+
const sameParent = con1 instanceof THREE.Object3D && con2 instanceof THREE.Object3D ? con1.parent === con2.parent : false;
|
|
464
468
|
const parts1 = con1Name.toUpperCase().split('_'), parts2 = con2Name.toUpperCase().split('_');
|
|
465
469
|
if (parts1.length >= 3 && parts2.length >= 3 && !sameParent) {
|
|
466
470
|
const connectable = parts1[0] === 'C' && parts2[0] === 'C' &&
|
|
@@ -475,29 +479,29 @@ class SceneUtils {
|
|
|
475
479
|
}
|
|
476
480
|
con1['connectedTo'] = con2.parent.name;
|
|
477
481
|
con2['connectedTo'] = con1.parent.name;
|
|
478
|
-
const motherRotation = new Euler(0, 0, 0);
|
|
479
|
-
const motherPosition = new Vector3(0, 0, 0);
|
|
482
|
+
const motherRotation = new THREE.Euler(0, 0, 0);
|
|
483
|
+
const motherPosition = new THREE.Vector3(0, 0, 0);
|
|
480
484
|
scene.updateMatrixWorld(true);
|
|
481
485
|
motherRotation.copy(parent.rotation);
|
|
482
486
|
parent.getWorldPosition(motherPosition);
|
|
483
487
|
parent.rotation.set(0, 0, 0);
|
|
484
488
|
parent.position.set(0, 0, 0);
|
|
485
|
-
const con1Quat = new Quaternion();
|
|
489
|
+
const con1Quat = new THREE.Quaternion();
|
|
486
490
|
con1.getWorldQuaternion(con1Quat);
|
|
487
|
-
const con2Quat = new Quaternion();
|
|
491
|
+
const con2Quat = new THREE.Quaternion();
|
|
488
492
|
con2.getWorldQuaternion(con2Quat);
|
|
489
|
-
const con1QuatParent = new Quaternion();
|
|
493
|
+
const con1QuatParent = new THREE.Quaternion();
|
|
490
494
|
con1.parent.getWorldQuaternion(con1QuatParent);
|
|
491
|
-
const con2QuatParent = new Quaternion();
|
|
495
|
+
const con2QuatParent = new THREE.Quaternion();
|
|
492
496
|
con2.parent.getWorldQuaternion(con2QuatParent);
|
|
493
|
-
const rotation = new Quaternion().multiplyQuaternions(con1Quat.invert(), con2Quat).multiply(new Quaternion().multiplyQuaternions(con1QuatParent, con1QuatParent));
|
|
497
|
+
const rotation = new THREE.Quaternion().multiplyQuaternions(con1Quat.invert(), con2Quat).multiply(new THREE.Quaternion().multiplyQuaternions(con1QuatParent, con1QuatParent));
|
|
494
498
|
con2.parent.quaternion.copy(rotation);
|
|
495
499
|
// Update because the matrix has been tempered with
|
|
496
500
|
scene.updateMatrixWorld(true);
|
|
497
501
|
// Move the connectors towards eachother
|
|
498
|
-
const con1Pos = new Vector3();
|
|
502
|
+
const con1Pos = new THREE.Vector3();
|
|
499
503
|
con1.getWorldPosition(con1Pos);
|
|
500
|
-
const con2Pos = new Vector3();
|
|
504
|
+
const con2Pos = new THREE.Vector3();
|
|
501
505
|
con2.getWorldPosition(con2Pos);
|
|
502
506
|
const move = con1Pos.sub(con2Pos);
|
|
503
507
|
con2.parent.position.x += move.x;
|
|
@@ -516,7 +520,7 @@ class SceneUtils {
|
|
|
516
520
|
|
|
517
521
|
class Material {
|
|
518
522
|
constructor() {
|
|
519
|
-
this.specular = new Color(0.3, 0.3, 0.3);
|
|
523
|
+
this.specular = new THREE.Color(0.3, 0.3, 0.3);
|
|
520
524
|
this.shininess = 0;
|
|
521
525
|
this.repeatX = 4;
|
|
522
526
|
this.repeatY = 4;
|
|
@@ -533,15 +537,15 @@ class ImageUtils {
|
|
|
533
537
|
}
|
|
534
538
|
else {
|
|
535
539
|
if (!base64) {
|
|
536
|
-
resolve(new Texture());
|
|
540
|
+
resolve(new THREE.Texture());
|
|
537
541
|
}
|
|
538
542
|
else {
|
|
539
|
-
const loader = new TextureLoader();
|
|
543
|
+
const loader = new THREE.TextureLoader();
|
|
540
544
|
loader.load(base64, (texture) => {
|
|
541
545
|
texture.anisotropy = 16;
|
|
542
|
-
texture.wrapS = RepeatWrapping;
|
|
543
|
-
texture.wrapT = RepeatWrapping;
|
|
544
|
-
texture.repeat = new Vector2(material ? material.repeatX : 1, material ? material.repeatY : 1);
|
|
546
|
+
texture.wrapS = THREE.RepeatWrapping;
|
|
547
|
+
texture.wrapT = THREE.RepeatWrapping;
|
|
548
|
+
texture.repeat = new THREE.Vector2(material ? material.repeatX : 1, material ? material.repeatY : 1);
|
|
545
549
|
texture.needsUpdate = true;
|
|
546
550
|
ImageUtils.textures.set(id, texture);
|
|
547
551
|
resolve(texture);
|
|
@@ -599,17 +603,39 @@ class AssetUtils {
|
|
|
599
603
|
// material.normal.repeat.set(1, 1);
|
|
600
604
|
// material.normal.flipY = false;
|
|
601
605
|
}
|
|
602
|
-
if (asset.
|
|
603
|
-
material.ao = yield ImageUtils.CreateTextureFromBase64(asset.id + '
|
|
604
|
-
material.
|
|
606
|
+
if (asset.orm) {
|
|
607
|
+
material.ao = yield ImageUtils.CreateTextureFromBase64(asset.id + '_orm', asset.orm, material);
|
|
608
|
+
material.roughness = material.ao;
|
|
609
|
+
material.metalness = material.ao;
|
|
610
|
+
material.aoFilename = asset.ormFilename;
|
|
611
|
+
material.roughnessFilename = asset.ormFilename;
|
|
612
|
+
material.metalnessFilename = asset.ormFilename;
|
|
613
|
+
}
|
|
614
|
+
else {
|
|
615
|
+
if (asset.ao) {
|
|
616
|
+
material.ao = yield ImageUtils.CreateTextureFromBase64(asset.id + '_ao', asset.ao, material);
|
|
617
|
+
material.aoFilename = asset.aoFilename;
|
|
618
|
+
}
|
|
619
|
+
if (asset.metalness) {
|
|
620
|
+
material.metalness = yield ImageUtils.CreateTextureFromBase64(asset.id + '_metalness', asset.metalness, material);
|
|
621
|
+
material.metalnessFilename = asset.metalnessFilename;
|
|
622
|
+
}
|
|
623
|
+
if (asset.roughness) {
|
|
624
|
+
material.roughness = yield ImageUtils.CreateTextureFromBase64(asset.id + '_roughness', asset.roughness, material);
|
|
625
|
+
material.roughnessFilename = asset.roughnessFilename;
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
if (asset.displacement) {
|
|
629
|
+
material.displacement = yield ImageUtils.CreateTextureFromBase64(asset.id + '_displacement', asset.displacement, material);
|
|
630
|
+
material.displacementFilename = asset.displacementFilename;
|
|
605
631
|
}
|
|
606
|
-
if (asset.
|
|
607
|
-
material.
|
|
608
|
-
material.
|
|
632
|
+
if (asset.envMap) {
|
|
633
|
+
material.envMap = yield ImageUtils.CreateTextureFromBase64(asset.id + '_env', asset.envMap, material);
|
|
634
|
+
material.envMapFilename = asset.envMapFilename;
|
|
609
635
|
}
|
|
610
|
-
if (asset.
|
|
611
|
-
material.
|
|
612
|
-
material.
|
|
636
|
+
if (asset.emissive) {
|
|
637
|
+
material.emissive = yield ImageUtils.CreateTextureFromBase64(asset.id + '_emissive', asset.emissive, material);
|
|
638
|
+
material.emissiveFileName = asset.emissiveFilename;
|
|
613
639
|
}
|
|
614
640
|
return material;
|
|
615
641
|
});
|
|
@@ -622,16 +648,16 @@ class AssetUtils {
|
|
|
622
648
|
}
|
|
623
649
|
const level = parseFloat(settings['level']);
|
|
624
650
|
if (!isNaN(level)) {
|
|
625
|
-
material.specular = new Color(level, level, level);
|
|
651
|
+
material.specular = new THREE.Color(level, level, level);
|
|
626
652
|
}
|
|
627
653
|
const repeatObjectUsed = settings.hasOwnProperty('repeat');
|
|
628
654
|
const repeatx = repeatObjectUsed ? parseFloat(settings['repeat']['repeatx']) : parseFloat(settings['repeatx']);
|
|
629
655
|
if (!isNaN(repeatx)) {
|
|
630
|
-
material.repeatX =
|
|
656
|
+
material.repeatX = repeatx;
|
|
631
657
|
}
|
|
632
658
|
const repeaty = repeatObjectUsed ? parseFloat(settings['repeat']['repeaty']) : parseFloat(settings['repeaty']);
|
|
633
659
|
if (!isNaN(repeaty)) {
|
|
634
|
-
material.repeatY =
|
|
660
|
+
material.repeatY = repeaty;
|
|
635
661
|
}
|
|
636
662
|
const metalness = parseFloat(settings['metalness']);
|
|
637
663
|
if (!isNaN(metalness)) {
|
|
@@ -641,6 +667,36 @@ class AssetUtils {
|
|
|
641
667
|
if (!isNaN(roughness)) {
|
|
642
668
|
material.roughnessValue = Math.min(1, roughness);
|
|
643
669
|
}
|
|
670
|
+
if (settings.hasOwnProperty('side')) {
|
|
671
|
+
material.side = settings.side;
|
|
672
|
+
}
|
|
673
|
+
if (settings.hasOwnProperty('sheenColor')) {
|
|
674
|
+
material.sheenColor = settings.sheenColor;
|
|
675
|
+
}
|
|
676
|
+
if (settings.hasOwnProperty('opacity')) {
|
|
677
|
+
material.opacity = settings.opacity;
|
|
678
|
+
}
|
|
679
|
+
if (settings.hasOwnProperty('transparent')) {
|
|
680
|
+
material.transparent = settings.transparent;
|
|
681
|
+
}
|
|
682
|
+
if (settings.hasOwnProperty('envMap')) {
|
|
683
|
+
material.envMap = settings.envMap;
|
|
684
|
+
}
|
|
685
|
+
if (settings.hasOwnProperty('envMapIntensity')) {
|
|
686
|
+
material.envMapIntensity = settings.envMapIntensity;
|
|
687
|
+
}
|
|
688
|
+
if (settings.hasOwnProperty('reflectivity')) {
|
|
689
|
+
material.reflectivity = settings.reflectivity;
|
|
690
|
+
}
|
|
691
|
+
if (settings.hasOwnProperty('displacementValue')) {
|
|
692
|
+
material.displacementValue = settings.displacementValue;
|
|
693
|
+
}
|
|
694
|
+
if (settings.hasOwnProperty('transparency')) {
|
|
695
|
+
material.transparency = settings.transparency;
|
|
696
|
+
}
|
|
697
|
+
if (settings.hasOwnProperty('transmission')) {
|
|
698
|
+
material.transmission = settings.transmission;
|
|
699
|
+
}
|
|
644
700
|
}
|
|
645
701
|
}
|
|
646
702
|
|
|
@@ -650,11 +706,16 @@ class Variation {
|
|
|
650
706
|
class VariationSettings {
|
|
651
707
|
constructor() {
|
|
652
708
|
this.settings = {};
|
|
709
|
+
this.loading = false;
|
|
710
|
+
this.loaded = new Subject();
|
|
653
711
|
}
|
|
654
712
|
}
|
|
655
713
|
|
|
656
714
|
// @dynamic
|
|
657
715
|
class VariationUtils {
|
|
716
|
+
static ClearCache() {
|
|
717
|
+
this.MaterialCache.clear();
|
|
718
|
+
}
|
|
658
719
|
static LoadVariation(assetPath, fileName) {
|
|
659
720
|
return __awaiter(this, void 0, void 0, function* () {
|
|
660
721
|
if (!fileName) {
|
|
@@ -672,7 +733,14 @@ class VariationUtils {
|
|
|
672
733
|
console.error('downloadVariation not defined in window global');
|
|
673
734
|
return null;
|
|
674
735
|
}
|
|
675
|
-
|
|
736
|
+
let file;
|
|
737
|
+
if (this.MaterialCache.has(id)) {
|
|
738
|
+
file = this.MaterialCache.get(id);
|
|
739
|
+
}
|
|
740
|
+
else {
|
|
741
|
+
file = yield window.downloadVariation(`${assetPath.replace('https://cdn1.colijn-it.nl/', '')}variation/${fileName}`);
|
|
742
|
+
this.MaterialCache.set(id, file);
|
|
743
|
+
}
|
|
676
744
|
return yield VariationUtils.GetVariationSettingsFromFile(id, file);
|
|
677
745
|
}
|
|
678
746
|
catch (err) {
|
|
@@ -721,15 +789,17 @@ class VariationUtils {
|
|
|
721
789
|
const variationSettings = new VariationSettings();
|
|
722
790
|
let index;
|
|
723
791
|
variationSettings.id = id;
|
|
724
|
-
if (zipContent
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
792
|
+
if (zipContent) {
|
|
793
|
+
if (zipContent.files['index.json']) {
|
|
794
|
+
const indexFile = yield zipContent.files['index.json'].async('string');
|
|
795
|
+
index = JSON.parse(indexFile);
|
|
796
|
+
}
|
|
797
|
+
if (index) {
|
|
798
|
+
yield VariationUtils.CreateSettingsBasedOnIndex(index, variationSettings, zipContent);
|
|
799
|
+
}
|
|
800
|
+
else {
|
|
801
|
+
yield VariationUtils.CreateSettingsBasedOnFileName(variationSettings, zipContent);
|
|
802
|
+
}
|
|
733
803
|
}
|
|
734
804
|
return variationSettings;
|
|
735
805
|
});
|
|
@@ -740,34 +810,68 @@ class VariationUtils {
|
|
|
740
810
|
variationSettings.normal = yield VariationUtils.LoadFileContentFromZip(zipContent.files[index.normalFile], index.normalFile);
|
|
741
811
|
variationSettings.normalFilename = index.normalFile;
|
|
742
812
|
}
|
|
743
|
-
if (index.aoFile) {
|
|
744
|
-
variationSettings.ao = yield VariationUtils.LoadFileContentFromZip(zipContent.files[index.aoFile], index.aoFile);
|
|
745
|
-
variationSettings.aoFilename = index.aoFile;
|
|
746
|
-
}
|
|
747
|
-
if (index.metalnessFile) {
|
|
748
|
-
variationSettings.metalness = yield VariationUtils.LoadFileContentFromZip(zipContent.files[index.metalnessFile], index.metalnessFile);
|
|
749
|
-
variationSettings.metalnessFilename = index.metalnessFile;
|
|
750
|
-
}
|
|
751
|
-
if (index.roughnessFile) {
|
|
752
|
-
variationSettings.roughness = yield VariationUtils.LoadFileContentFromZip(zipContent.files[index.roughnessFile], index.roughnessFile);
|
|
753
|
-
variationSettings.roughnessFilename = index.roughnessFile;
|
|
754
|
-
}
|
|
755
813
|
if (index.diffuseFile) {
|
|
756
814
|
variationSettings.texture = yield VariationUtils.LoadFileContentFromZip(zipContent.files[index.diffuseFile], index.diffuseFile);
|
|
757
815
|
variationSettings.textureFilename = index.diffuseFile;
|
|
758
816
|
}
|
|
817
|
+
if (index.ormFile) {
|
|
818
|
+
variationSettings.orm = yield VariationUtils.LoadFileContentFromZip(zipContent.files[index.ormFile], index.ormFile);
|
|
819
|
+
variationSettings.ormFilename = index.ormFile;
|
|
820
|
+
}
|
|
821
|
+
else {
|
|
822
|
+
if (index.aoFile) {
|
|
823
|
+
variationSettings.ao = yield VariationUtils.LoadFileContentFromZip(zipContent.files[index.aoFile], index.aoFile);
|
|
824
|
+
variationSettings.aoFilename = index.aoFile;
|
|
825
|
+
}
|
|
826
|
+
if (index.metalnessFile) {
|
|
827
|
+
variationSettings.metalness = yield VariationUtils.LoadFileContentFromZip(zipContent.files[index.metalnessFile], index.metalnessFile);
|
|
828
|
+
variationSettings.metalnessFilename = index.metalnessFile;
|
|
829
|
+
}
|
|
830
|
+
if (index.roughnessFile) {
|
|
831
|
+
variationSettings.roughness = yield VariationUtils.LoadFileContentFromZip(zipContent.files[index.roughnessFile], index.roughnessFile);
|
|
832
|
+
variationSettings.roughnessFilename = index.roughnessFile;
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
if (index.displacementFile) {
|
|
836
|
+
variationSettings.displacement = yield VariationUtils.LoadFileContentFromZip(zipContent.files[index.displacementFile], index.displacementFile);
|
|
837
|
+
variationSettings.displacementFilename = index.displacementFile;
|
|
838
|
+
}
|
|
839
|
+
if (index.emissiveFile) {
|
|
840
|
+
variationSettings.emissive = yield VariationUtils.LoadFileContentFromZip(zipContent.files[index.emissiveFile], index.emissiveFile);
|
|
841
|
+
variationSettings.emissiveFilename = index.emissiveFile;
|
|
842
|
+
}
|
|
843
|
+
if (index.envMapFile) {
|
|
844
|
+
variationSettings.envMap = yield VariationUtils.LoadFileContentFromZip(zipContent.files[index.envMapFile], index.envMapFile);
|
|
845
|
+
variationSettings.envMapFilename = index.envMapFile;
|
|
846
|
+
}
|
|
759
847
|
variationSettings.settings =
|
|
760
848
|
(yield VariationUtils.LoadFileContentFromZip(zipContent.files['repeat.json'], 'repeat.json', false)) || {};
|
|
761
849
|
Object.assign(variationSettings.settings, index.repeat);
|
|
762
850
|
variationSettings.settings.metalness = index.metalness;
|
|
763
851
|
variationSettings.settings.roughness = index.roughness;
|
|
852
|
+
if (index.sheenColor) {
|
|
853
|
+
variationSettings.settings.sheenColor = new THREE.Color(index.sheenColor.r, index.sheenColor.g, index.sheenColor.b);
|
|
854
|
+
}
|
|
855
|
+
variationSettings.settings.envMap = index.envMap;
|
|
856
|
+
variationSettings.settings.envMapIntensity = index.envMapIntensity;
|
|
857
|
+
variationSettings.settings.transparent = index.transparent;
|
|
858
|
+
variationSettings.settings.opacity = index.opacity;
|
|
859
|
+
if (index.emissiveValue) {
|
|
860
|
+
variationSettings.settings.emissiveValue = new THREE.Color(index.emissiveValue.r, index.emissiveValue.g, index.emissiveValue.b);
|
|
861
|
+
}
|
|
862
|
+
variationSettings.settings.emissiveIntensity = index.emissiveIntensity;
|
|
863
|
+
variationSettings.settings.reflectivity = index.reflectivity;
|
|
864
|
+
variationSettings.settings.displacementValue = index.displacementValue;
|
|
865
|
+
variationSettings.settings.side = index.side;
|
|
866
|
+
variationSettings.settings.transparency = index.transparency;
|
|
867
|
+
variationSettings.settings.transmission = index.transmission;
|
|
764
868
|
});
|
|
765
869
|
}
|
|
766
870
|
static CreateSettingsBasedOnFileName(variationSettings, zipContent) {
|
|
767
871
|
return __awaiter(this, void 0, void 0, function* () {
|
|
768
872
|
const allLoaded = [];
|
|
769
873
|
for (const fileName in zipContent.files) {
|
|
770
|
-
if (zipContent.files
|
|
874
|
+
if (zipContent.files.hasOwnProperty(fileName)) {
|
|
771
875
|
const file = yield zipContent.files[fileName];
|
|
772
876
|
if (file.name.toLowerCase().indexOf('normal') > -1 && this.FileIsImage(file.name)) {
|
|
773
877
|
allLoaded.push(zipContent.files[fileName].async('base64').then((normalFile) => {
|
|
@@ -799,6 +903,24 @@ class VariationUtils {
|
|
|
799
903
|
variationSettings.textureFilename = fileName;
|
|
800
904
|
}));
|
|
801
905
|
}
|
|
906
|
+
else if (file.name.toLowerCase().indexOf('displacement') > -1 && this.FileIsImage(file.name)) {
|
|
907
|
+
allLoaded.push(zipContent.files[fileName].async('base64').then((displacementFile) => {
|
|
908
|
+
variationSettings.displacement = `data:image/${this.GetBase64FileType(file.name)};base64,${displacementFile}`;
|
|
909
|
+
variationSettings.displacementFilename = fileName;
|
|
910
|
+
}));
|
|
911
|
+
}
|
|
912
|
+
else if (file.name.toLowerCase().indexOf('emissive') > -1 && this.FileIsImage(file.name)) {
|
|
913
|
+
allLoaded.push(zipContent.files[fileName].async('base64').then((emissiveFile) => {
|
|
914
|
+
variationSettings.emissive = `data:image/${this.GetBase64FileType(file.name)};base64,${emissiveFile}`;
|
|
915
|
+
variationSettings.emissiveFilename = fileName;
|
|
916
|
+
}));
|
|
917
|
+
}
|
|
918
|
+
else if (file.name.toLowerCase().indexOf('envMap') > -1 && this.FileIsImage(file.name)) {
|
|
919
|
+
allLoaded.push(zipContent.files[fileName].async('base64').then((envMapFile) => {
|
|
920
|
+
variationSettings.envMap = `data:image/${this.GetBase64FileType(file.name)};base64,${envMapFile}`;
|
|
921
|
+
variationSettings.envMapFilename = fileName;
|
|
922
|
+
}));
|
|
923
|
+
}
|
|
802
924
|
else if (file.name.indexOf('.jp') > -1) {
|
|
803
925
|
allLoaded.push(zipContent.files[fileName].async('base64').then((textureFile) => {
|
|
804
926
|
variationSettings.texture = 'data:image/jpeg;base64,' + textureFile;
|
|
@@ -809,7 +931,7 @@ class VariationUtils {
|
|
|
809
931
|
allLoaded.push(zipContent.files[fileName].async('string').then((settingsFile) => {
|
|
810
932
|
const settingsFileObj = JSON.parse(settingsFile);
|
|
811
933
|
for (const key in settingsFileObj) {
|
|
812
|
-
if (settingsFileObj
|
|
934
|
+
if (settingsFileObj.hasOwnProperty(key)) {
|
|
813
935
|
variationSettings.settings[key] = settingsFileObj[key];
|
|
814
936
|
}
|
|
815
937
|
}
|
|
@@ -866,9 +988,13 @@ class VariationUtils {
|
|
|
866
988
|
// Get the content
|
|
867
989
|
static GetZipContent(file) {
|
|
868
990
|
return __awaiter(this, void 0, void 0, function* () {
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
991
|
+
try {
|
|
992
|
+
const jszip = new JSZip();
|
|
993
|
+
return yield jszip.loadAsync(file);
|
|
994
|
+
}
|
|
995
|
+
catch (e) {
|
|
996
|
+
return null;
|
|
997
|
+
}
|
|
872
998
|
});
|
|
873
999
|
}
|
|
874
1000
|
}
|
|
@@ -879,19 +1005,33 @@ class VariationHelper {
|
|
|
879
1005
|
this._lastKnownVariations = new Map();
|
|
880
1006
|
}
|
|
881
1007
|
clearCache() {
|
|
882
|
-
const
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
1008
|
+
const variationMap = Array.from(this._lastKnownVariations.values());
|
|
1009
|
+
variationMap.forEach((variations) => {
|
|
1010
|
+
variations.forEach((variation) => {
|
|
1011
|
+
try {
|
|
1012
|
+
if (variation.material) {
|
|
1013
|
+
if (variation.material.texture) {
|
|
1014
|
+
variation.material.texture.dispose();
|
|
1015
|
+
}
|
|
1016
|
+
if (variation.material.normal) {
|
|
1017
|
+
variation.material.normal.dispose();
|
|
1018
|
+
}
|
|
1019
|
+
if (variation.material.metalness) {
|
|
1020
|
+
variation.material.metalness.dispose();
|
|
1021
|
+
}
|
|
1022
|
+
if (variation.material.roughness) {
|
|
1023
|
+
variation.material.roughness.dispose();
|
|
1024
|
+
}
|
|
1025
|
+
if (variation.material.ao) {
|
|
1026
|
+
variation.material.ao.dispose();
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
catch (e) {
|
|
1031
|
+
}
|
|
893
1032
|
});
|
|
894
|
-
}
|
|
1033
|
+
});
|
|
1034
|
+
VariationUtils.ClearCache();
|
|
895
1035
|
}
|
|
896
1036
|
loadPart(obj, parts, usePbr = false) {
|
|
897
1037
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -917,15 +1057,15 @@ class VariationHelper {
|
|
|
917
1057
|
}
|
|
918
1058
|
});
|
|
919
1059
|
}
|
|
920
|
-
loadVariation(
|
|
1060
|
+
loadVariation(obj, parts, usePbr = false) {
|
|
921
1061
|
return __awaiter(this, void 0, void 0, function* () {
|
|
922
1062
|
try {
|
|
923
1063
|
const len = parts.length;
|
|
924
1064
|
for (let i = 0; i < len; i++) {
|
|
925
1065
|
const variations = parts[i].variations;
|
|
926
1066
|
if (!variations || variations.length === 0) {
|
|
927
|
-
if (this._getLastKnownVariations(
|
|
928
|
-
parts[i].variations = this._getLastKnownVariations(
|
|
1067
|
+
if (this._getLastKnownVariations(parts[i].nodeId)) {
|
|
1068
|
+
parts[i].variations = this._getLastKnownVariations(parts[i].nodeId);
|
|
929
1069
|
this._applyVariations(obj, parts[i], usePbr);
|
|
930
1070
|
continue;
|
|
931
1071
|
}
|
|
@@ -945,7 +1085,7 @@ class VariationHelper {
|
|
|
945
1085
|
newVariation.material = yield AssetUtils.CreateMaterialFromAsset(variationSettings);
|
|
946
1086
|
lastKnownVariations.push(newVariation);
|
|
947
1087
|
}
|
|
948
|
-
this._setLastKnownVariations(
|
|
1088
|
+
this._setLastKnownVariations(parts[i].nodeId, lastKnownVariations);
|
|
949
1089
|
parts[i].variations = lastKnownVariations;
|
|
950
1090
|
this._applyVariations(obj, parts[i], usePbr);
|
|
951
1091
|
}
|
|
@@ -970,7 +1110,7 @@ class VariationHelper {
|
|
|
970
1110
|
const child = children[i];
|
|
971
1111
|
if (child !== null && child !== undefined) {
|
|
972
1112
|
child.traverse((mesh) => {
|
|
973
|
-
if (mesh instanceof Mesh && partMaterial) {
|
|
1113
|
+
if (mesh instanceof THREE.Mesh && partMaterial) {
|
|
974
1114
|
if (Array.isArray(mesh.material)) { // multimaterial support
|
|
975
1115
|
for (let j = 0, jlen = mesh.material.length; j < jlen; j++) {
|
|
976
1116
|
if (mesh.material[j].name.toLowerCase().indexOf('fixed_frame') !== -1) {
|
|
@@ -995,7 +1135,7 @@ class VariationHelper {
|
|
|
995
1135
|
const child = children[i];
|
|
996
1136
|
if (child !== null && child !== undefined) {
|
|
997
1137
|
child.traverse((mesh) => {
|
|
998
|
-
if (mesh instanceof Mesh && part.variations && part.variations.length > 0 && mesh.name.toLowerCase().indexOf('c_')) {
|
|
1138
|
+
if (mesh instanceof THREE.Mesh && part.variations && part.variations.length > 0 && mesh.name.toLowerCase().indexOf('c_')) {
|
|
999
1139
|
for (let j = 0; j < part.variations.length; j++) {
|
|
1000
1140
|
const variation = part.variations[j];
|
|
1001
1141
|
if (variation.material) {
|
|
@@ -1022,82 +1162,188 @@ class VariationHelper {
|
|
|
1022
1162
|
_setMeshMaterialFromVariation(name, variation, usePbr = false) {
|
|
1023
1163
|
if (variation.material.texture) {
|
|
1024
1164
|
variation.material.texture.needsUpdate = true;
|
|
1165
|
+
variation.material.texture.mapping = THREE.EquirectangularReflectionMapping;
|
|
1025
1166
|
}
|
|
1026
1167
|
if (!usePbr) {
|
|
1027
|
-
const
|
|
1168
|
+
const newMaterial = new THREE.MeshPhongMaterial({
|
|
1028
1169
|
name: name,
|
|
1029
1170
|
shininess: variation.material.shininess,
|
|
1030
1171
|
specular: variation.material.specular,
|
|
1031
1172
|
map: variation.material.texture,
|
|
1032
1173
|
normalMap: variation.material.normal
|
|
1033
1174
|
});
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
return
|
|
1175
|
+
newMaterial.color.setRGB(0.8, 0.8, 0.8);
|
|
1176
|
+
newMaterial.needsUpdate = true;
|
|
1177
|
+
return newMaterial;
|
|
1037
1178
|
}
|
|
1038
|
-
|
|
1179
|
+
if (variation.material.sheenColor || variation.material.reflectivity) {
|
|
1039
1180
|
const params = {
|
|
1040
|
-
// side:
|
|
1181
|
+
// side: material.side ? material.side : FrontSide,
|
|
1041
1182
|
name: name,
|
|
1042
1183
|
roughness: variation.material.roughnessValue ? variation.material.roughnessValue : 1,
|
|
1043
1184
|
metalness: variation.material.metalnessValue ? variation.material.metalnessValue : 0,
|
|
1185
|
+
envMapIntensity: variation.material.envMapIntensity ? variation.material.envMapIntensity : 0.01,
|
|
1186
|
+
clearcoatMap: variation.material.clearcoatMap ? variation.material.clearcoatMap : null,
|
|
1187
|
+
clearcoatRoughnessMap: variation.material.clearcoatRoughnessMap ? variation.material.clearcoatRoughnessMap : null,
|
|
1188
|
+
// wireframe: true,
|
|
1189
|
+
// opacity: 0.3,
|
|
1190
|
+
// transparent: true,
|
|
1044
1191
|
};
|
|
1192
|
+
if (variation.material.displacementValue) {
|
|
1193
|
+
params.displacementScale = variation.material.displacementValue;
|
|
1194
|
+
}
|
|
1195
|
+
if (variation.material.sheenColor) {
|
|
1196
|
+
params.sheen = variation.material.sheenColor;
|
|
1197
|
+
}
|
|
1198
|
+
if (variation.material.opacity) {
|
|
1199
|
+
params.opacity = variation.material.opacity;
|
|
1200
|
+
}
|
|
1201
|
+
if (variation.material.transparent) {
|
|
1202
|
+
params.transparent = variation.material.transparent;
|
|
1203
|
+
}
|
|
1204
|
+
if (variation.material.emissiveValue) {
|
|
1205
|
+
params.emissive = variation.material.emissiveValue;
|
|
1206
|
+
}
|
|
1207
|
+
if (variation.material.emissiveIntensityValue) {
|
|
1208
|
+
params.emissiveIntensity = variation.material.emissiveIntensityValue;
|
|
1209
|
+
}
|
|
1045
1210
|
if (variation.material.texture) {
|
|
1046
1211
|
params.map = variation.material.texture;
|
|
1212
|
+
params.map.needsUpdate = true;
|
|
1047
1213
|
}
|
|
1048
1214
|
if (variation.material.ao) {
|
|
1049
1215
|
params.aoMap = variation.material.ao;
|
|
1216
|
+
params.aoMap.needsUpdate = true;
|
|
1050
1217
|
}
|
|
1051
1218
|
if (variation.material.roughness) {
|
|
1052
1219
|
params.roughnessMap = variation.material.roughness;
|
|
1220
|
+
params.roughnessMap.needsUpdate = true;
|
|
1221
|
+
// variation.material.roughness.magFilter = NearestFilter;
|
|
1053
1222
|
}
|
|
1054
1223
|
if (variation.material.metalness) {
|
|
1055
1224
|
params.metalnessMap = variation.material.metalness;
|
|
1225
|
+
params.metalnessMap.needsUpdate = true;
|
|
1056
1226
|
}
|
|
1057
1227
|
if (variation.material.normal) {
|
|
1058
1228
|
params.normalMap = variation.material.normal;
|
|
1229
|
+
params.normalMap.needsUpdate = true;
|
|
1230
|
+
}
|
|
1231
|
+
if (variation.material.displacement) {
|
|
1232
|
+
params.displacementMap = variation.material.displacement;
|
|
1233
|
+
params.displacementMap.needsUpdate = true;
|
|
1234
|
+
}
|
|
1235
|
+
if (variation.material.emissive) {
|
|
1236
|
+
params.emissiveMap = variation.material.emissive;
|
|
1237
|
+
params.emissiveMap.needsUpdate = true;
|
|
1238
|
+
}
|
|
1239
|
+
if (variation.material.envMap) {
|
|
1240
|
+
if (variation.material.envMapIntensity != null || 0) {
|
|
1241
|
+
params.envMap = variation.material.envMap;
|
|
1242
|
+
params.envMap.needsUpdate = true;
|
|
1243
|
+
variation.material.envMap.mapping = THREE.EquirectangularReflectionMapping;
|
|
1244
|
+
variation.material.envMap.minFilter = THREE.NearestFilter;
|
|
1245
|
+
variation.material.envMap.magFilter = THREE.NearestFilter;
|
|
1246
|
+
}
|
|
1059
1247
|
}
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1248
|
+
if (variation.material.reflectivity) {
|
|
1249
|
+
params.reflectivity = variation.material.reflectivity;
|
|
1250
|
+
}
|
|
1251
|
+
if (variation.material.side) {
|
|
1252
|
+
params.side = variation.material.side;
|
|
1253
|
+
}
|
|
1254
|
+
const newMaterial = new THREE.MeshPhysicalMaterial(params);
|
|
1255
|
+
newMaterial.color.setRGB(1, 1, 1);
|
|
1256
|
+
newMaterial.needsUpdate = true;
|
|
1257
|
+
if (variation.material.transmission) {
|
|
1258
|
+
newMaterial.transmission = variation.material.transmission;
|
|
1259
|
+
}
|
|
1260
|
+
return newMaterial;
|
|
1070
1261
|
}
|
|
1071
1262
|
else {
|
|
1072
|
-
const
|
|
1073
|
-
|
|
1263
|
+
const params = {
|
|
1264
|
+
// side: material.side ? material.side : FrontSide,
|
|
1265
|
+
name: name,
|
|
1266
|
+
roughness: variation.material.roughnessValue ? variation.material.roughnessValue : 1,
|
|
1267
|
+
metalness: variation.material.metalnessValue ? variation.material.metalnessValue : 0,
|
|
1268
|
+
envMapIntensity: variation.material.envMapIntensity ? variation.material.envMapIntensity : 0.01
|
|
1269
|
+
// wireframe: true,
|
|
1270
|
+
// opacity: 0.3,
|
|
1271
|
+
// transparent: true,
|
|
1272
|
+
};
|
|
1273
|
+
if (variation.material.displacementValue) {
|
|
1274
|
+
params.displacementScale = variation.material.displacementValue;
|
|
1275
|
+
}
|
|
1276
|
+
if (variation.material.opacity) {
|
|
1277
|
+
params.opacity = variation.material.opacity;
|
|
1278
|
+
}
|
|
1279
|
+
if (variation.material.transparent) {
|
|
1280
|
+
params.transparent = variation.material.transparent;
|
|
1281
|
+
}
|
|
1282
|
+
if (variation.material.emissiveValue) {
|
|
1283
|
+
params.emissive = variation.material.emissiveValue;
|
|
1284
|
+
}
|
|
1285
|
+
if (variation.material.emissiveIntensityValue) {
|
|
1286
|
+
params.emissiveIntensity = variation.material.emissiveIntensityValue;
|
|
1287
|
+
}
|
|
1288
|
+
if (variation.material.texture) {
|
|
1289
|
+
params.map = variation.material.texture;
|
|
1290
|
+
params.map.needsUpdate = true;
|
|
1291
|
+
}
|
|
1292
|
+
if (variation.material.ao) {
|
|
1293
|
+
params.aoMap = variation.material.ao;
|
|
1294
|
+
params.aoMap.needsUpdate = true;
|
|
1295
|
+
}
|
|
1296
|
+
if (variation.material.roughness) {
|
|
1297
|
+
params.roughnessMap = variation.material.roughness;
|
|
1298
|
+
params.roughnessMap.needsUpdate = true;
|
|
1299
|
+
// variation.material.roughness.magFilter = NearestFilter;
|
|
1300
|
+
}
|
|
1301
|
+
if (variation.material.metalness) {
|
|
1302
|
+
params.metalnessMap = variation.material.metalness;
|
|
1303
|
+
params.metalnessMap.needsUpdate = true;
|
|
1304
|
+
}
|
|
1305
|
+
if (variation.material.normal) {
|
|
1306
|
+
params.normalMap = variation.material.normal;
|
|
1307
|
+
params.normalMap.needsUpdate = true;
|
|
1308
|
+
}
|
|
1309
|
+
if (variation.material.displacement) {
|
|
1310
|
+
params.displacementMap = variation.material.displacement;
|
|
1311
|
+
params.displacementMap.needsUpdate = true;
|
|
1312
|
+
}
|
|
1313
|
+
if (variation.material.emissive) {
|
|
1314
|
+
params.emissiveMap = variation.material.emissive;
|
|
1315
|
+
params.emissiveMap.needsUpdate = true;
|
|
1316
|
+
}
|
|
1317
|
+
if (variation.material.envMap) {
|
|
1318
|
+
if (variation.material.envMapIntensity != null || 0) {
|
|
1319
|
+
params.envMap = variation.material.envMap;
|
|
1320
|
+
params.envMap.needsUpdate = true;
|
|
1321
|
+
variation.material.envMap.mapping = THREE.EquirectangularReflectionMapping;
|
|
1322
|
+
variation.material.envMap.minFilter = THREE.NearestFilter;
|
|
1323
|
+
variation.material.envMap.magFilter = THREE.NearestFilter;
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
if (variation.material.side) {
|
|
1327
|
+
params.side = variation.material.side;
|
|
1328
|
+
}
|
|
1329
|
+
const newMaterial = new THREE.MeshStandardMaterial(params);
|
|
1330
|
+
newMaterial.color.setRGB(1, 1, 1);
|
|
1331
|
+
newMaterial.needsUpdate = true;
|
|
1332
|
+
return newMaterial;
|
|
1074
1333
|
}
|
|
1075
1334
|
}
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1335
|
+
_setLastKnownVariations(id, variation) {
|
|
1336
|
+
this._lastKnownVariations.set(id, variation);
|
|
1337
|
+
}
|
|
1338
|
+
_getLastKnownVariations(id) {
|
|
1339
|
+
if (this._lastKnownVariations.has(id)) {
|
|
1340
|
+
return this._lastKnownVariations.get(id);
|
|
1082
1341
|
}
|
|
1083
1342
|
return null;
|
|
1084
1343
|
}
|
|
1085
1344
|
}
|
|
1086
1345
|
|
|
1087
|
-
|
|
1088
|
-
};
|
|
1089
|
-
ServiceLocator.injector = undefined;
|
|
1090
|
-
ServiceLocator = __decorate([
|
|
1091
|
-
Injectable()
|
|
1092
|
-
], ServiceLocator);
|
|
1093
|
-
|
|
1094
|
-
let ConfiguratorService = class ConfiguratorService {
|
|
1095
|
-
constructor(_injector) {
|
|
1096
|
-
this._injector = _injector;
|
|
1097
|
-
if (!ServiceLocator.injector) {
|
|
1098
|
-
ServiceLocator.injector = _injector;
|
|
1099
|
-
}
|
|
1100
|
-
}
|
|
1346
|
+
class ConfiguratorService {
|
|
1101
1347
|
initApi(options) {
|
|
1102
1348
|
this._configuratorApi = new Configurator(options);
|
|
1103
1349
|
}
|
|
@@ -1165,20 +1411,61 @@ let ConfiguratorService = class ConfiguratorService {
|
|
|
1165
1411
|
return yield this._configuratorApi.selectAnswer(answer, showLoader);
|
|
1166
1412
|
});
|
|
1167
1413
|
}
|
|
1168
|
-
}
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
class ObjectUtils {
|
|
1417
|
+
static DisposeNode(node) {
|
|
1418
|
+
node.traverse((obj) => {
|
|
1419
|
+
if (obj instanceof Mesh) {
|
|
1420
|
+
if (obj.geometry) {
|
|
1421
|
+
obj.geometry.dispose();
|
|
1422
|
+
}
|
|
1423
|
+
ObjectUtils.DisposeMaterial(obj.material);
|
|
1424
|
+
}
|
|
1425
|
+
if (typeof obj.dispose === 'function') {
|
|
1426
|
+
// @ts-ignore
|
|
1427
|
+
obj.dispose();
|
|
1428
|
+
}
|
|
1429
|
+
});
|
|
1430
|
+
}
|
|
1431
|
+
static DisposeMaterial(material) {
|
|
1432
|
+
if (!material) {
|
|
1433
|
+
return;
|
|
1434
|
+
}
|
|
1435
|
+
if (Array.isArray(material)) {
|
|
1436
|
+
material.forEach(mtrl => {
|
|
1437
|
+
this.materialProps
|
|
1438
|
+
.filter(mapType => mtrl[mapType])
|
|
1439
|
+
.forEach(mapType => mtrl[mapType].dispose());
|
|
1440
|
+
mtrl.dispose(); // disposes any programs associated with the material
|
|
1441
|
+
});
|
|
1442
|
+
}
|
|
1443
|
+
else {
|
|
1444
|
+
this.materialProps
|
|
1445
|
+
.filter(mapType => material[mapType] && material[mapType].dispose)
|
|
1446
|
+
.forEach(mapType => material[mapType].dispose());
|
|
1447
|
+
if (material.dispose) {
|
|
1448
|
+
material.dispose(); // disposes any programs associated with the material
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
static DisposeObject(object) {
|
|
1453
|
+
if (!object) {
|
|
1454
|
+
return;
|
|
1455
|
+
}
|
|
1456
|
+
if (object.children.length) {
|
|
1457
|
+
object.children.forEach(child => this.DisposeObject(child));
|
|
1458
|
+
}
|
|
1459
|
+
this.DisposeNode(object);
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
ObjectUtils.materialProps = ['map', 'lightMap', 'bumpMap', 'normalMap', 'specularMap', 'envMap', 'aoMap', 'roughnessMap', 'metalnessMap'];
|
|
1178
1463
|
|
|
1179
|
-
|
|
1180
|
-
constructor(
|
|
1464
|
+
class Builder {
|
|
1465
|
+
constructor() {
|
|
1181
1466
|
this.selectionsReceived = new BehaviorSubject([]);
|
|
1467
|
+
this.articleLoaded = new BehaviorSubject(undefined);
|
|
1468
|
+
this.decosReceived = new BehaviorSubject([]);
|
|
1182
1469
|
this.answersReceived = new BehaviorSubject([]);
|
|
1183
1470
|
this.modelLoaded = new BehaviorSubject(null);
|
|
1184
1471
|
this._selections = [];
|
|
@@ -1188,23 +1475,21 @@ let Builder = class Builder {
|
|
|
1188
1475
|
this._placedAddables = [];
|
|
1189
1476
|
this._adjustables = [];
|
|
1190
1477
|
this._addables = [];
|
|
1478
|
+
this._imageCache = new Map();
|
|
1191
1479
|
this._articleCache = new Map();
|
|
1480
|
+
}
|
|
1481
|
+
init(scene, options) {
|
|
1192
1482
|
this._boFactory = new BusinessObjectFactory();
|
|
1193
1483
|
this._threedUtils = new ThreedUtils();
|
|
1194
1484
|
this._variationHelper = new VariationHelper();
|
|
1195
1485
|
if (!scene) {
|
|
1196
1486
|
throw 'No scene object provided!';
|
|
1197
1487
|
}
|
|
1198
|
-
|
|
1199
|
-
|
|
1488
|
+
this._configuratorService = new ConfiguratorService();
|
|
1489
|
+
// this._imageCacheService = new ImageCacheService();
|
|
1490
|
+
if (options) {
|
|
1491
|
+
this._configuratorService.initApi(options);
|
|
1200
1492
|
}
|
|
1201
|
-
if (useInAngular) {
|
|
1202
|
-
this._configuratorService = ServiceLocator.injector.get(ConfiguratorService);
|
|
1203
|
-
}
|
|
1204
|
-
else {
|
|
1205
|
-
this._configuratorService = new ConfiguratorService(undefined);
|
|
1206
|
-
}
|
|
1207
|
-
this._configuratorService.initApi(options);
|
|
1208
1493
|
this._scene = scene;
|
|
1209
1494
|
}
|
|
1210
1495
|
buildModel(sku, instanceId, goodId) {
|
|
@@ -1226,7 +1511,9 @@ let Builder = class Builder {
|
|
|
1226
1511
|
return;
|
|
1227
1512
|
}
|
|
1228
1513
|
this._linkSelectionsAndDecos();
|
|
1229
|
-
|
|
1514
|
+
const build = yield this._build();
|
|
1515
|
+
this._cleanUp();
|
|
1516
|
+
return build;
|
|
1230
1517
|
}
|
|
1231
1518
|
else {
|
|
1232
1519
|
throw 'GLB source not found!';
|
|
@@ -1237,6 +1524,30 @@ let Builder = class Builder {
|
|
|
1237
1524
|
}
|
|
1238
1525
|
});
|
|
1239
1526
|
}
|
|
1527
|
+
buildModelFromData(selections, decos, assetUrl, cdnUrl, schema) {
|
|
1528
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1529
|
+
if (!this._scene) {
|
|
1530
|
+
return;
|
|
1531
|
+
}
|
|
1532
|
+
try {
|
|
1533
|
+
yield this._downloadAsset(assetUrl, cdnUrl, schema);
|
|
1534
|
+
if (selections && selections.length > 1 && decos && decos.length > 0 && this._source) {
|
|
1535
|
+
this._selections = selections;
|
|
1536
|
+
this._decos = decos;
|
|
1537
|
+
this._linkSelectionsAndDecos();
|
|
1538
|
+
const build = yield this._build();
|
|
1539
|
+
this._cleanUp();
|
|
1540
|
+
return build;
|
|
1541
|
+
}
|
|
1542
|
+
else {
|
|
1543
|
+
throw 'Unsufficient data provided!';
|
|
1544
|
+
}
|
|
1545
|
+
}
|
|
1546
|
+
catch (e) {
|
|
1547
|
+
throw e;
|
|
1548
|
+
}
|
|
1549
|
+
});
|
|
1550
|
+
}
|
|
1240
1551
|
initNodeInstance(goodId) {
|
|
1241
1552
|
return this._configuratorService.initNodeInstance(goodId);
|
|
1242
1553
|
}
|
|
@@ -1263,6 +1574,53 @@ let Builder = class Builder {
|
|
|
1263
1574
|
this.modelLoaded.next(yield this.buildModel());
|
|
1264
1575
|
});
|
|
1265
1576
|
}
|
|
1577
|
+
getImageForSelectionOrAnswer(object) {
|
|
1578
|
+
const includeMimeType = true, thumb = true;
|
|
1579
|
+
return new Promise((resolve, reject) => {
|
|
1580
|
+
if (object && object.nodeId) {
|
|
1581
|
+
if (!this._imageCache.has(object.nodeId)) {
|
|
1582
|
+
return this._configuratorService.getSingleImage(object.nodeId, 4, includeMimeType, thumb, true)
|
|
1583
|
+
.then((responseData) => {
|
|
1584
|
+
const base64 = this._handleResponseData(includeMimeType, thumb, responseData);
|
|
1585
|
+
this._imageCache.set(object.nodeId, base64);
|
|
1586
|
+
resolve(base64);
|
|
1587
|
+
}).catch(() => {
|
|
1588
|
+
reject();
|
|
1589
|
+
});
|
|
1590
|
+
}
|
|
1591
|
+
else {
|
|
1592
|
+
resolve(this._imageCache.get(object.nodeId));
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
else {
|
|
1596
|
+
reject();
|
|
1597
|
+
}
|
|
1598
|
+
});
|
|
1599
|
+
}
|
|
1600
|
+
_cleanUp() {
|
|
1601
|
+
this._sku = undefined;
|
|
1602
|
+
this._goodId = undefined;
|
|
1603
|
+
this._instanceId = undefined;
|
|
1604
|
+
this._variationHelper.clearCache();
|
|
1605
|
+
}
|
|
1606
|
+
_handleResponseData(includeMimetype, thumb, responseData) {
|
|
1607
|
+
if (responseData && responseData.resultObject) {
|
|
1608
|
+
if (responseData.resultObject.filePath !== null && responseData.resultObject.filePath !== "") {
|
|
1609
|
+
return ImageUtils.getFixedImageFilepathUrl(responseData.resultObject.filePath);
|
|
1610
|
+
}
|
|
1611
|
+
else {
|
|
1612
|
+
if (includeMimetype) {
|
|
1613
|
+
return ImageUtils.getDocBodyWithMimeTypeDefinition(responseData.resultObject.fileName, thumb ? responseData.resultObject.thumbnailBody : responseData.resultObject.documentBody);
|
|
1614
|
+
}
|
|
1615
|
+
else {
|
|
1616
|
+
return thumb ? responseData.resultObject.thumbnailBody : responseData.resultObject.documentBody;
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
else {
|
|
1621
|
+
return '';
|
|
1622
|
+
}
|
|
1623
|
+
}
|
|
1266
1624
|
_setInstanceId(sku, instanceId, goodId) {
|
|
1267
1625
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1268
1626
|
if (!instanceId && !this._instanceId) {
|
|
@@ -1290,25 +1648,30 @@ let Builder = class Builder {
|
|
|
1290
1648
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1291
1649
|
const article = yield this._getArticle(sku, goodId);
|
|
1292
1650
|
if (article && article.assetUrl) {
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1651
|
+
yield this._downloadAsset(article.assetUrl, article.contentDeliveryUrl, article.distSchema);
|
|
1652
|
+
}
|
|
1653
|
+
});
|
|
1654
|
+
}
|
|
1655
|
+
_downloadAsset(assetUrl, cdnUrl, schema) {
|
|
1656
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1657
|
+
this._source = yield this._threedUtils.download3DSource(assetUrl, cdnUrl)
|
|
1658
|
+
.catch((error) => {
|
|
1659
|
+
throw error;
|
|
1660
|
+
});
|
|
1661
|
+
if (cdnUrl) {
|
|
1662
|
+
this._variationHelper.assetPath =
|
|
1663
|
+
cdnUrl +
|
|
1664
|
+
(cdnUrl.endsWith('/') ? '' : '/') +
|
|
1665
|
+
(schema ? schema : 'UP_DBA');
|
|
1303
1666
|
}
|
|
1304
1667
|
});
|
|
1305
1668
|
}
|
|
1306
|
-
_build(
|
|
1669
|
+
_build() {
|
|
1307
1670
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1308
1671
|
this._reset();
|
|
1309
1672
|
const adjustables = this._getAdjustables();
|
|
1310
1673
|
if (adjustables && adjustables.length > 0) {
|
|
1311
|
-
const obj = new Object3D();
|
|
1674
|
+
const obj = new THREE.Object3D();
|
|
1312
1675
|
obj.visible = false; // no need to render visualy
|
|
1313
1676
|
this._scene.add(obj);
|
|
1314
1677
|
let connected = false;
|
|
@@ -1331,8 +1694,10 @@ let Builder = class Builder {
|
|
|
1331
1694
|
}
|
|
1332
1695
|
this._placeAddables(obj);
|
|
1333
1696
|
this._updatePivot(obj);
|
|
1334
|
-
yield this._loadVariations(obj
|
|
1697
|
+
yield this._loadVariations(obj);
|
|
1698
|
+
// this._variationHelper.clearCache();
|
|
1335
1699
|
this._scene.remove(obj);
|
|
1700
|
+
ObjectUtils.DisposeObject(this._source);
|
|
1336
1701
|
return obj;
|
|
1337
1702
|
}
|
|
1338
1703
|
else {
|
|
@@ -1522,6 +1887,7 @@ let Builder = class Builder {
|
|
|
1522
1887
|
_getArticle(sku, goodId) {
|
|
1523
1888
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1524
1889
|
if (this._articleCache.has(sku)) {
|
|
1890
|
+
this.articleLoaded.next(this._articleCache.get(sku));
|
|
1525
1891
|
return this._articleCache.get(sku);
|
|
1526
1892
|
}
|
|
1527
1893
|
if (!goodId) {
|
|
@@ -1542,6 +1908,7 @@ let Builder = class Builder {
|
|
|
1542
1908
|
}
|
|
1543
1909
|
}
|
|
1544
1910
|
this._articleCache.set(sku, article);
|
|
1911
|
+
this.articleLoaded.next(article);
|
|
1545
1912
|
return article;
|
|
1546
1913
|
});
|
|
1547
1914
|
}
|
|
@@ -1566,6 +1933,7 @@ let Builder = class Builder {
|
|
|
1566
1933
|
const decosResponse = yield this._configuratorService.getDecos(false);
|
|
1567
1934
|
if (decosResponse.resultObjects && decosResponse.resultObjects.length > 0) {
|
|
1568
1935
|
this._decos = this._boFactory.makeBOArrayFromRawBackendDataArray(DecoNode, decosResponse.resultObjects);
|
|
1936
|
+
this.decosReceived.next(this._decos);
|
|
1569
1937
|
}
|
|
1570
1938
|
else {
|
|
1571
1939
|
throw 'No deconodes found!';
|
|
@@ -1595,11 +1963,12 @@ let Builder = class Builder {
|
|
|
1595
1963
|
return deco.type === DecoNodeType.Variation;
|
|
1596
1964
|
});
|
|
1597
1965
|
}
|
|
1598
|
-
_loadVariations(obj
|
|
1966
|
+
_loadVariations(obj) {
|
|
1599
1967
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1600
1968
|
yield this._variationHelper.loadPart(obj, this._adjustables, true);
|
|
1601
|
-
yield this._variationHelper.loadVariation(
|
|
1602
|
-
yield this._variationHelper.loadVariation(
|
|
1969
|
+
yield this._variationHelper.loadVariation(obj, this._adjustables, true);
|
|
1970
|
+
yield this._variationHelper.loadVariation(obj, this._addables, true);
|
|
1971
|
+
this._variationHelper.clearCache();
|
|
1603
1972
|
});
|
|
1604
1973
|
}
|
|
1605
1974
|
_getAdjustables() {
|
|
@@ -1609,10 +1978,10 @@ let Builder = class Builder {
|
|
|
1609
1978
|
});
|
|
1610
1979
|
}
|
|
1611
1980
|
_updatePivot(obj) {
|
|
1612
|
-
const boundingBox = new Box3().setFromObject(obj);
|
|
1613
|
-
const bbCenterPivot = new Vector3();
|
|
1981
|
+
const boundingBox = new THREE.Box3().setFromObject(obj);
|
|
1982
|
+
const bbCenterPivot = new THREE.Vector3();
|
|
1614
1983
|
boundingBox.getCenter(bbCenterPivot);
|
|
1615
|
-
const delta = new Vector3().sub(bbCenterPivot).setY(Math.abs(Math.min(boundingBox.min.y, 0)));
|
|
1984
|
+
const delta = new THREE.Vector3().sub(bbCenterPivot).setY(Math.abs(Math.min(boundingBox.min.y, 0)));
|
|
1616
1985
|
obj.children.forEach((child) => {
|
|
1617
1986
|
child.position.add(delta);
|
|
1618
1987
|
});
|
|
@@ -1625,35 +1994,25 @@ let Builder = class Builder {
|
|
|
1625
1994
|
this._addables.length = 0;
|
|
1626
1995
|
this._prepareTheSelections();
|
|
1627
1996
|
}
|
|
1628
|
-
}
|
|
1629
|
-
Builder
|
|
1630
|
-
|
|
1631
|
-
{ type:
|
|
1632
|
-
|
|
1997
|
+
}
|
|
1998
|
+
Builder.ɵprov = i0.ɵɵdefineInjectable({ factory: function Builder_Factory() { return new Builder(); }, token: Builder, providedIn: "root" });
|
|
1999
|
+
Builder.decorators = [
|
|
2000
|
+
{ type: Injectable, args: [{
|
|
2001
|
+
providedIn: "root"
|
|
2002
|
+
},] }
|
|
1633
2003
|
];
|
|
1634
|
-
Builder =
|
|
1635
|
-
Injectable()
|
|
1636
|
-
], Builder);
|
|
2004
|
+
Builder.ctorParameters = () => [];
|
|
1637
2005
|
|
|
1638
|
-
|
|
2006
|
+
class AnswersComponent {
|
|
1639
2007
|
constructor() {
|
|
1640
2008
|
this.answers = [];
|
|
1641
2009
|
this.answerClick = new EventEmitter();
|
|
1642
2010
|
}
|
|
1643
|
-
}
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
Input()
|
|
1649
|
-
], AnswersComponent.prototype, "selectionTitle", void 0);
|
|
1650
|
-
__decorate([
|
|
1651
|
-
Output()
|
|
1652
|
-
], AnswersComponent.prototype, "answerClick", void 0);
|
|
1653
|
-
AnswersComponent = __decorate([
|
|
1654
|
-
Component({
|
|
1655
|
-
selector: "answers",
|
|
1656
|
-
template: `
|
|
2011
|
+
}
|
|
2012
|
+
AnswersComponent.decorators = [
|
|
2013
|
+
{ type: Component, args: [{
|
|
2014
|
+
selector: "answers",
|
|
2015
|
+
template: `
|
|
1657
2016
|
<div class="ione-configurator">
|
|
1658
2017
|
<div class="rp-answers-slideout">
|
|
1659
2018
|
<h2 class="answers-title" [textContent]="selectionTitle"></h2>
|
|
@@ -1671,72 +2030,19 @@ AnswersComponent = __decorate([
|
|
|
1671
2030
|
</div>
|
|
1672
2031
|
</div>
|
|
1673
2032
|
`,
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
], AnswersComponent);
|
|
1677
|
-
|
|
1678
|
-
var ImageCacheService_1;
|
|
1679
|
-
let ImageCacheService = ImageCacheService_1 = class ImageCacheService {
|
|
1680
|
-
constructor(_configuratorService) {
|
|
1681
|
-
this._configuratorService = _configuratorService;
|
|
1682
|
-
// Map containing the retrieved images, @number = nodeId, @string = base64 string
|
|
1683
|
-
this._imageCache = new Map();
|
|
1684
|
-
}
|
|
1685
|
-
static _handleResponseData(includeMimetype, thumb, responseData) {
|
|
1686
|
-
if (responseData && responseData.resultObject) {
|
|
1687
|
-
if (responseData.resultObject.filePath !== null && responseData.resultObject.filePath !== "") {
|
|
1688
|
-
return ImageUtils.getFixedImageFilepathUrl(responseData.resultObject.filePath);
|
|
1689
|
-
}
|
|
1690
|
-
else {
|
|
1691
|
-
if (includeMimetype) {
|
|
1692
|
-
return ImageUtils.getDocBodyWithMimeTypeDefinition(responseData.resultObject.fileName, thumb ? responseData.resultObject.thumbnailBody : responseData.resultObject.documentBody);
|
|
1693
|
-
}
|
|
1694
|
-
else {
|
|
1695
|
-
return thumb ? responseData.resultObject.thumbnailBody : responseData.resultObject.documentBody;
|
|
1696
|
-
}
|
|
1697
|
-
}
|
|
1698
|
-
}
|
|
1699
|
-
else {
|
|
1700
|
-
return '';
|
|
1701
|
-
}
|
|
1702
|
-
}
|
|
1703
|
-
getImageForSelectionOrAnswer(object) {
|
|
1704
|
-
const includeMimeType = true, thumb = true;
|
|
1705
|
-
return new Promise((resolve, reject) => {
|
|
1706
|
-
if (object && object.nodeId) {
|
|
1707
|
-
if (!this._imageCache.has(object.nodeId)) {
|
|
1708
|
-
return this._configuratorService.getSingleImage(object.nodeId, 4, includeMimeType, thumb, true)
|
|
1709
|
-
.then((responseData) => {
|
|
1710
|
-
const base64 = ImageCacheService_1._handleResponseData(includeMimeType, thumb, responseData);
|
|
1711
|
-
this._imageCache.set(object.nodeId, base64);
|
|
1712
|
-
resolve(base64);
|
|
1713
|
-
}).catch(() => {
|
|
1714
|
-
reject();
|
|
1715
|
-
});
|
|
1716
|
-
}
|
|
1717
|
-
else {
|
|
1718
|
-
resolve(this._imageCache.get(object.nodeId));
|
|
1719
|
-
}
|
|
1720
|
-
}
|
|
1721
|
-
else {
|
|
1722
|
-
reject();
|
|
1723
|
-
}
|
|
1724
|
-
});
|
|
1725
|
-
}
|
|
1726
|
-
};
|
|
1727
|
-
ImageCacheService.ctorParameters = () => [
|
|
1728
|
-
{ type: ConfiguratorService }
|
|
2033
|
+
styles: [".ione-configurator .rp-answers-slideout{position:absolute;top:0;right:0;width:400px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}.ione-configurator .answers-title{margin-left:10px;color:#1a1a1a}.ione-configurator .answers-container{height:100vh;overflow-y:scroll}.ione-configurator .answer-content{position:relative;overflow:hidden;cursor:pointer;font-size:12px;border:1px solid lightgray;padding:10px;display:flex;flex-direction:row;border-radius:3px;margin-bottom:3px;box-shadow:2px 1px #d3d3d380;background:white}.ione-configurator .thumbnail{width:54px;min-width:54px;height:54px;min-height:54px;border:1px solid #d3d3d3;border-radius:5px}.ione-configurator .img-size{width:54px;min-width:54px;height:54px;min-height:54px;border-radius:5px}.ione-configurator .answer-wrapper{display:block}.ione-configurator .answer-title{font-size:12px;position:relative;overflow:hidden;cursor:pointer}.ione-configurator .question{font-weight:bold;color:#1a1a1a}.ione-configurator .answer{font-size:12px;font-style:italic;margin-top:3px}.ione-configurator .collapse-wrapper{display:block}.ione-configurator .collapse-content{display:block}.ione-configurator .collapse-handle{position:absolute;top:10px;right:12px;border:solid black;border-width:0 3px 3px 0;display:inline-block;padding:3px;transform:rotate(45deg);-webkit-transform:rotate(45deg)}.ione-configurator .collapse-handle.expanded{transform:rotate(-135deg);-webkit-transform:rotate(-135deg)}.ione-configurator .child-selection{margin-left:10px;display:flex;flex-direction:column;margin-top:5px}.ione-configurator .mat-title{margin-left:10px;color:#1a1a1a}.ione-configurator .drawer__header{height:48px}.ione-configurator .rp-selections-summary{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;background:transparent;overflow:auto;position:absolute;top:0;right:0;width:400px}.ione-configurator .selections-content{overflow-y:auto}.ione-configurator .co-summary-line{position:relative;overflow:hidden;cursor:pointer;font-size:12px;border:1px solid lightgray;padding:10px;display:flex;flex-direction:row;border-radius:3px;margin-bottom:3px;box-shadow:2px 1px #d3d3d380;background:white}.ione-configurator .selection-thumbnail{width:54px;min-width:54px;height:54px;min-height:54px;border:1px solid #d3d3d3;border-radius:5px}.ione-configurator .selection-img{width:54px;min-width:54px;height:54px;min-height:54px;border-radius:5px}.ione-configurator .answer-thumbnail{width:54px;min-width:54px;height:54px;min-height:54px;border:1px solid #d3d3d3;border-radius:5px}.ione-configurator .answer-img{width:54px;min-width:54px;height:54px;min-height:54px;border-radius:5px}.ione-configurator .unloaded{background-color:#d3d3d3}.ione-configurator .titles{margin-left:14px;align-self:center}.ione-configurator .title-wrapper{display:flex;flex-direction:column}.ione-configurator .answer-title-wrapper{text-align:center;align-self:center;margin-left:14px}\n"]
|
|
2034
|
+
},] }
|
|
1729
2035
|
];
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
}
|
|
1735
|
-
|
|
2036
|
+
AnswersComponent.ctorParameters = () => [];
|
|
2037
|
+
AnswersComponent.propDecorators = {
|
|
2038
|
+
answers: [{ type: Input }],
|
|
2039
|
+
selectionTitle: [{ type: Input }],
|
|
2040
|
+
answerClick: [{ type: Output }]
|
|
2041
|
+
};
|
|
1736
2042
|
|
|
1737
|
-
|
|
1738
|
-
constructor(
|
|
1739
|
-
this.
|
|
2043
|
+
class AnswerComponent {
|
|
2044
|
+
constructor(_builder) {
|
|
2045
|
+
this._builder = _builder;
|
|
1740
2046
|
}
|
|
1741
2047
|
set showing(value) {
|
|
1742
2048
|
this.answer.imageData = '';
|
|
@@ -1751,25 +2057,16 @@ let AnswerComponent = class AnswerComponent {
|
|
|
1751
2057
|
}
|
|
1752
2058
|
_loadThumbnail(answer) {
|
|
1753
2059
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1754
|
-
yield this.
|
|
2060
|
+
yield this._builder.getImageForSelectionOrAnswer(answer).then((imageSrc) => {
|
|
1755
2061
|
answer.imageData = imageSrc === "" ? null : imageSrc;
|
|
1756
2062
|
});
|
|
1757
2063
|
});
|
|
1758
2064
|
}
|
|
1759
|
-
}
|
|
1760
|
-
AnswerComponent.
|
|
1761
|
-
{ type:
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
Input()
|
|
1765
|
-
], AnswerComponent.prototype, "answer", void 0);
|
|
1766
|
-
__decorate([
|
|
1767
|
-
Input()
|
|
1768
|
-
], AnswerComponent.prototype, "showing", null);
|
|
1769
|
-
AnswerComponent = __decorate([
|
|
1770
|
-
Component({
|
|
1771
|
-
selector: 'answer',
|
|
1772
|
-
template: `
|
|
2065
|
+
}
|
|
2066
|
+
AnswerComponent.decorators = [
|
|
2067
|
+
{ type: Component, args: [{
|
|
2068
|
+
selector: 'answer',
|
|
2069
|
+
template: `
|
|
1773
2070
|
<div class="ione-configurator">
|
|
1774
2071
|
<div class="answer-wrapper">
|
|
1775
2072
|
<div class="answer-content" @answerAppear>
|
|
@@ -1787,18 +2084,26 @@ AnswerComponent = __decorate([
|
|
|
1787
2084
|
</div>
|
|
1788
2085
|
</div>
|
|
1789
2086
|
`,
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
]
|
|
2087
|
+
animations: [
|
|
2088
|
+
trigger('answerAppear', [
|
|
2089
|
+
state('void', style({ 'background': '#dbdbdb' })),
|
|
2090
|
+
state('white', style({ 'background': 'white' })),
|
|
2091
|
+
transition('void <=> *', animate(500))
|
|
2092
|
+
])
|
|
2093
|
+
],
|
|
2094
|
+
styles: [".ione-configurator .rp-answers-slideout{position:absolute;top:0;right:0;width:400px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}.ione-configurator .answers-title{margin-left:10px;color:#1a1a1a}.ione-configurator .answers-container{height:100vh;overflow-y:scroll}.ione-configurator .answer-content{position:relative;overflow:hidden;cursor:pointer;font-size:12px;border:1px solid lightgray;padding:10px;display:flex;flex-direction:row;border-radius:3px;margin-bottom:3px;box-shadow:2px 1px #d3d3d380;background:white}.ione-configurator .thumbnail{width:54px;min-width:54px;height:54px;min-height:54px;border:1px solid #d3d3d3;border-radius:5px}.ione-configurator .img-size{width:54px;min-width:54px;height:54px;min-height:54px;border-radius:5px}.ione-configurator .answer-wrapper{display:block}.ione-configurator .answer-title{font-size:12px;position:relative;overflow:hidden;cursor:pointer}.ione-configurator .question{font-weight:bold;color:#1a1a1a}.ione-configurator .answer{font-size:12px;font-style:italic;margin-top:3px}.ione-configurator .collapse-wrapper{display:block}.ione-configurator .collapse-content{display:block}.ione-configurator .collapse-handle{position:absolute;top:10px;right:12px;border:solid black;border-width:0 3px 3px 0;display:inline-block;padding:3px;transform:rotate(45deg);-webkit-transform:rotate(45deg)}.ione-configurator .collapse-handle.expanded{transform:rotate(-135deg);-webkit-transform:rotate(-135deg)}.ione-configurator .child-selection{margin-left:10px;display:flex;flex-direction:column;margin-top:5px}.ione-configurator .mat-title{margin-left:10px;color:#1a1a1a}.ione-configurator .drawer__header{height:48px}.ione-configurator .rp-selections-summary{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;background:transparent;overflow:auto;position:absolute;top:0;right:0;width:400px}.ione-configurator .selections-content{overflow-y:auto}.ione-configurator .co-summary-line{position:relative;overflow:hidden;cursor:pointer;font-size:12px;border:1px solid lightgray;padding:10px;display:flex;flex-direction:row;border-radius:3px;margin-bottom:3px;box-shadow:2px 1px #d3d3d380;background:white}.ione-configurator .selection-thumbnail{width:54px;min-width:54px;height:54px;min-height:54px;border:1px solid #d3d3d3;border-radius:5px}.ione-configurator .selection-img{width:54px;min-width:54px;height:54px;min-height:54px;border-radius:5px}.ione-configurator .answer-thumbnail{width:54px;min-width:54px;height:54px;min-height:54px;border:1px solid #d3d3d3;border-radius:5px}.ione-configurator .answer-img{width:54px;min-width:54px;height:54px;min-height:54px;border-radius:5px}.ione-configurator .unloaded{background-color:#d3d3d3}.ione-configurator .titles{margin-left:14px;align-self:center}.ione-configurator .title-wrapper{display:flex;flex-direction:column}.ione-configurator .answer-title-wrapper{text-align:center;align-self:center;margin-left:14px}\n"]
|
|
2095
|
+
},] }
|
|
2096
|
+
];
|
|
2097
|
+
AnswerComponent.ctorParameters = () => [
|
|
2098
|
+
{ type: Builder }
|
|
2099
|
+
];
|
|
2100
|
+
AnswerComponent.propDecorators = {
|
|
2101
|
+
answer: [{ type: Input }],
|
|
2102
|
+
showing: [{ type: Input }]
|
|
2103
|
+
};
|
|
1800
2104
|
|
|
1801
|
-
|
|
2105
|
+
// Import the core angular services.
|
|
2106
|
+
class VisibilityObserverMasterDirective {
|
|
1802
2107
|
// I initialize the intersection observer parent directive.
|
|
1803
2108
|
constructor() {
|
|
1804
2109
|
// As each observable child attaches itself to the parent observer, we need to
|
|
@@ -1838,14 +2143,15 @@ let VisibilityObserverMasterDirective = class VisibilityObserverMasterDirective
|
|
|
1838
2143
|
this._mapping.delete(element);
|
|
1839
2144
|
this._observer.unobserve(element);
|
|
1840
2145
|
}
|
|
1841
|
-
}
|
|
1842
|
-
VisibilityObserverMasterDirective =
|
|
1843
|
-
Directive
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
]
|
|
2146
|
+
}
|
|
2147
|
+
VisibilityObserverMasterDirective.decorators = [
|
|
2148
|
+
{ type: Directive, args: [{
|
|
2149
|
+
selector: '[visibilityObserverMaster]'
|
|
2150
|
+
},] }
|
|
2151
|
+
];
|
|
2152
|
+
VisibilityObserverMasterDirective.ctorParameters = () => [];
|
|
1847
2153
|
|
|
1848
|
-
|
|
2154
|
+
class VisibilityObserverDirective {
|
|
1849
2155
|
// I initialize the intersection observer directive.
|
|
1850
2156
|
constructor(parent, elementRef) {
|
|
1851
2157
|
this.observerEnabled = false;
|
|
@@ -1883,27 +2189,27 @@ let VisibilityObserverDirective = class VisibilityObserverDirective {
|
|
|
1883
2189
|
});
|
|
1884
2190
|
}
|
|
1885
2191
|
}
|
|
1886
|
-
}
|
|
2192
|
+
}
|
|
2193
|
+
VisibilityObserverDirective.decorators = [
|
|
2194
|
+
{ type: Directive, args: [{
|
|
2195
|
+
selector: '[visibilityObserver]',
|
|
2196
|
+
exportAs: 'intersection'
|
|
2197
|
+
},] }
|
|
2198
|
+
];
|
|
1887
2199
|
VisibilityObserverDirective.ctorParameters = () => [
|
|
1888
2200
|
{ type: VisibilityObserverMasterDirective },
|
|
1889
2201
|
{ type: ElementRef }
|
|
1890
2202
|
];
|
|
1891
|
-
|
|
1892
|
-
Input
|
|
1893
|
-
|
|
1894
|
-
VisibilityObserverDirective = __decorate([
|
|
1895
|
-
Directive({
|
|
1896
|
-
selector: '[visibilityObserver]',
|
|
1897
|
-
exportAs: 'intersection'
|
|
1898
|
-
})
|
|
1899
|
-
], VisibilityObserverDirective);
|
|
2203
|
+
VisibilityObserverDirective.propDecorators = {
|
|
2204
|
+
observerEnabled: [{ type: Input }]
|
|
2205
|
+
};
|
|
1900
2206
|
|
|
1901
|
-
|
|
1902
|
-
}
|
|
1903
|
-
LoaderComponent =
|
|
1904
|
-
Component
|
|
1905
|
-
|
|
1906
|
-
|
|
2207
|
+
class LoaderComponent {
|
|
2208
|
+
}
|
|
2209
|
+
LoaderComponent.decorators = [
|
|
2210
|
+
{ type: Component, args: [{
|
|
2211
|
+
selector: 'rp-loader',
|
|
2212
|
+
template: `
|
|
1907
2213
|
<div class="loader-wrapper">
|
|
1908
2214
|
<svg xmlns="http://www.w3.org/2000/svg" width="44" height="44" viewBox="0 0 44 44" stroke="#3760a1">
|
|
1909
2215
|
<g fill="none" fill-rule="evenodd" stroke-width="3">
|
|
@@ -1915,45 +2221,45 @@ LoaderComponent = __decorate([
|
|
|
1915
2221
|
</svg>
|
|
1916
2222
|
</div>
|
|
1917
2223
|
`,
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
]
|
|
2224
|
+
styles: [":host{-webkit-user-select:none;user-select:none;pointer-events:none}:host .loader-wrapper{z-index:1100;position:absolute;width:54px;height:54px}:host .loader-wrapper svg{width:100%;height:100%}:host .loader-wrapper svg .ripple1{transform-origin:center;animation:ripple 1.5s infinite}:host .loader-wrapper svg .ripple2{transform-origin:center;animation:ripple 1.5s infinite .4s}@keyframes ripple{0%{transform:scale(0);opacity:1}to{transform:scale(1);opacity:0}}\n"]
|
|
2225
|
+
},] }
|
|
2226
|
+
];
|
|
1921
2227
|
|
|
1922
|
-
|
|
1923
|
-
}
|
|
1924
|
-
SharedModule =
|
|
1925
|
-
NgModule
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
]
|
|
2228
|
+
class SharedModule {
|
|
2229
|
+
}
|
|
2230
|
+
SharedModule.decorators = [
|
|
2231
|
+
{ type: NgModule, args: [{
|
|
2232
|
+
imports: [
|
|
2233
|
+
CommonModule
|
|
2234
|
+
],
|
|
2235
|
+
declarations: [
|
|
2236
|
+
LoaderComponent
|
|
2237
|
+
],
|
|
2238
|
+
exports: [
|
|
2239
|
+
LoaderComponent
|
|
2240
|
+
]
|
|
2241
|
+
},] }
|
|
2242
|
+
];
|
|
1937
2243
|
|
|
1938
|
-
|
|
1939
|
-
}
|
|
1940
|
-
AnswersModule =
|
|
1941
|
-
NgModule
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
]
|
|
2244
|
+
class AnswersModule {
|
|
2245
|
+
}
|
|
2246
|
+
AnswersModule.decorators = [
|
|
2247
|
+
{ type: NgModule, args: [{
|
|
2248
|
+
imports: [
|
|
2249
|
+
CommonModule,
|
|
2250
|
+
SharedModule
|
|
2251
|
+
],
|
|
2252
|
+
declarations: [
|
|
2253
|
+
AnswersComponent,
|
|
2254
|
+
AnswerComponent,
|
|
2255
|
+
VisibilityObserverDirective,
|
|
2256
|
+
VisibilityObserverMasterDirective
|
|
2257
|
+
],
|
|
2258
|
+
exports: [
|
|
2259
|
+
AnswersComponent
|
|
2260
|
+
]
|
|
2261
|
+
},] }
|
|
2262
|
+
];
|
|
1957
2263
|
|
|
1958
2264
|
class SelectionViewModel {
|
|
1959
2265
|
constructor() {
|
|
@@ -1962,9 +2268,9 @@ class SelectionViewModel {
|
|
|
1962
2268
|
this.thumbnail = '';
|
|
1963
2269
|
}
|
|
1964
2270
|
}
|
|
1965
|
-
|
|
1966
|
-
constructor(
|
|
1967
|
-
this.
|
|
2271
|
+
class SelectionsComponent {
|
|
2272
|
+
constructor(_builder) {
|
|
2273
|
+
this._builder = _builder;
|
|
1968
2274
|
this.selectionViewModels = [];
|
|
1969
2275
|
this.selectionClick = new EventEmitter();
|
|
1970
2276
|
}
|
|
@@ -1972,8 +2278,6 @@ let SelectionsComponent = class SelectionsComponent {
|
|
|
1972
2278
|
this._prepareSelections(value);
|
|
1973
2279
|
this._loadThumbnails();
|
|
1974
2280
|
}
|
|
1975
|
-
ngOnInit() {
|
|
1976
|
-
}
|
|
1977
2281
|
expandClicked(selectionViewModel, mouseEvent) {
|
|
1978
2282
|
mouseEvent.preventDefault();
|
|
1979
2283
|
mouseEvent.stopImmediatePropagation();
|
|
@@ -1988,7 +2292,7 @@ let SelectionsComponent = class SelectionsComponent {
|
|
|
1988
2292
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1989
2293
|
if (this.selectionViewModels.length > 0) {
|
|
1990
2294
|
this.selectionViewModels.forEach((viewModel) => __awaiter(this, void 0, void 0, function* () {
|
|
1991
|
-
yield this.
|
|
2295
|
+
yield this._builder.getImageForSelectionOrAnswer(viewModel.selection).then((imageSrc) => {
|
|
1992
2296
|
viewModel.thumbnail = imageSrc === "" ? null : imageSrc;
|
|
1993
2297
|
});
|
|
1994
2298
|
}));
|
|
@@ -2011,20 +2315,11 @@ let SelectionsComponent = class SelectionsComponent {
|
|
|
2011
2315
|
}
|
|
2012
2316
|
});
|
|
2013
2317
|
}
|
|
2014
|
-
}
|
|
2015
|
-
SelectionsComponent.
|
|
2016
|
-
{ type:
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
Input()
|
|
2020
|
-
], SelectionsComponent.prototype, "selections", null);
|
|
2021
|
-
__decorate([
|
|
2022
|
-
Output()
|
|
2023
|
-
], SelectionsComponent.prototype, "selectionClick", void 0);
|
|
2024
|
-
SelectionsComponent = __decorate([
|
|
2025
|
-
Component({
|
|
2026
|
-
selector: "selections",
|
|
2027
|
-
template: `
|
|
2318
|
+
}
|
|
2319
|
+
SelectionsComponent.decorators = [
|
|
2320
|
+
{ type: Component, args: [{
|
|
2321
|
+
selector: "selections",
|
|
2322
|
+
template: `
|
|
2028
2323
|
<div class="ione-configurator">
|
|
2029
2324
|
<div class="rp-selections-summary">
|
|
2030
2325
|
<header class="drawer__header">
|
|
@@ -2073,37 +2368,44 @@ SelectionsComponent = __decorate([
|
|
|
2073
2368
|
</div>
|
|
2074
2369
|
</div>
|
|
2075
2370
|
`,
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
]
|
|
2371
|
+
animations: [
|
|
2372
|
+
trigger('showHideChildren', [
|
|
2373
|
+
state('void', style({ 'height': '0' })),
|
|
2374
|
+
state('*', style({ 'height': '*' })),
|
|
2375
|
+
transition('void <=> *', animate(200))
|
|
2376
|
+
])
|
|
2377
|
+
],
|
|
2378
|
+
styles: [".ione-configurator .rp-answers-slideout{position:absolute;top:0;right:0;width:400px;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content}.ione-configurator .answers-title{margin-left:10px;color:#1a1a1a}.ione-configurator .answers-container{height:100vh;overflow-y:scroll}.ione-configurator .answer-content{position:relative;overflow:hidden;cursor:pointer;font-size:12px;border:1px solid lightgray;padding:10px;display:flex;flex-direction:row;border-radius:3px;margin-bottom:3px;box-shadow:2px 1px #d3d3d380;background:white}.ione-configurator .thumbnail{width:54px;min-width:54px;height:54px;min-height:54px;border:1px solid #d3d3d3;border-radius:5px}.ione-configurator .img-size{width:54px;min-width:54px;height:54px;min-height:54px;border-radius:5px}.ione-configurator .answer-wrapper{display:block}.ione-configurator .answer-title{font-size:12px;position:relative;overflow:hidden;cursor:pointer}.ione-configurator .question{font-weight:bold;color:#1a1a1a}.ione-configurator .answer{font-size:12px;font-style:italic;margin-top:3px}.ione-configurator .collapse-wrapper{display:block}.ione-configurator .collapse-content{display:block}.ione-configurator .collapse-handle{position:absolute;top:10px;right:12px;border:solid black;border-width:0 3px 3px 0;display:inline-block;padding:3px;transform:rotate(45deg);-webkit-transform:rotate(45deg)}.ione-configurator .collapse-handle.expanded{transform:rotate(-135deg);-webkit-transform:rotate(-135deg)}.ione-configurator .child-selection{margin-left:10px;display:flex;flex-direction:column;margin-top:5px}.ione-configurator .mat-title{margin-left:10px;color:#1a1a1a}.ione-configurator .drawer__header{height:48px}.ione-configurator .rp-selections-summary{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;background:transparent;overflow:auto;position:absolute;top:0;right:0;width:400px}.ione-configurator .selections-content{overflow-y:auto}.ione-configurator .co-summary-line{position:relative;overflow:hidden;cursor:pointer;font-size:12px;border:1px solid lightgray;padding:10px;display:flex;flex-direction:row;border-radius:3px;margin-bottom:3px;box-shadow:2px 1px #d3d3d380;background:white}.ione-configurator .selection-thumbnail{width:54px;min-width:54px;height:54px;min-height:54px;border:1px solid #d3d3d3;border-radius:5px}.ione-configurator .selection-img{width:54px;min-width:54px;height:54px;min-height:54px;border-radius:5px}.ione-configurator .answer-thumbnail{width:54px;min-width:54px;height:54px;min-height:54px;border:1px solid #d3d3d3;border-radius:5px}.ione-configurator .answer-img{width:54px;min-width:54px;height:54px;min-height:54px;border-radius:5px}.ione-configurator .unloaded{background-color:#d3d3d3}.ione-configurator .titles{margin-left:14px;align-self:center}.ione-configurator .title-wrapper{display:flex;flex-direction:column}.ione-configurator .answer-title-wrapper{text-align:center;align-self:center;margin-left:14px}\n"]
|
|
2379
|
+
},] }
|
|
2380
|
+
];
|
|
2381
|
+
SelectionsComponent.ctorParameters = () => [
|
|
2382
|
+
{ type: Builder }
|
|
2383
|
+
];
|
|
2384
|
+
SelectionsComponent.propDecorators = {
|
|
2385
|
+
selections: [{ type: Input }],
|
|
2386
|
+
selectionClick: [{ type: Output }]
|
|
2387
|
+
};
|
|
2086
2388
|
|
|
2087
|
-
|
|
2088
|
-
}
|
|
2089
|
-
SelectionsModule =
|
|
2090
|
-
NgModule
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
]
|
|
2389
|
+
class SelectionsModule {
|
|
2390
|
+
}
|
|
2391
|
+
SelectionsModule.decorators = [
|
|
2392
|
+
{ type: NgModule, args: [{
|
|
2393
|
+
imports: [
|
|
2394
|
+
CommonModule,
|
|
2395
|
+
SharedModule
|
|
2396
|
+
],
|
|
2397
|
+
declarations: [
|
|
2398
|
+
SelectionsComponent
|
|
2399
|
+
],
|
|
2400
|
+
exports: [
|
|
2401
|
+
SelectionsComponent
|
|
2402
|
+
]
|
|
2403
|
+
},] }
|
|
2404
|
+
];
|
|
2103
2405
|
|
|
2104
2406
|
/**
|
|
2105
2407
|
* Generated bundle index. Do not edit.
|
|
2106
2408
|
*/
|
|
2107
2409
|
|
|
2108
|
-
export { AnswersComponent, AnswersModule, Builder, ConfiguratorService, SelectionsComponent, SelectionsModule, SharedModule as ɵa, LoaderComponent as ɵb, AnswerComponent as ɵc,
|
|
2410
|
+
export { AnswersComponent, AnswersModule, Builder, ConfiguratorService, SelectionsComponent, SelectionsModule, SharedModule as ɵa, LoaderComponent as ɵb, AnswerComponent as ɵc, VisibilityObserverDirective as ɵd, VisibilityObserverMasterDirective as ɵe };
|
|
2109
2411
|
//# sourceMappingURL=colijnit-configurator.js.map
|