@colijnit/configurator 1.0.21 → 1.0.22
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 +53 -0
- package/app/components/answers/answer/answer.component.d.ts +11 -0
- package/app/components/answers/answers.component.d.ts +8 -0
- package/app/components/answers/answers.module.d.ts +2 -0
- package/app/components/selections/selections.component.d.ts +22 -0
- package/app/components/selections/selections.module.d.ts +2 -0
- package/app/components/shared/loader/loader.component.d.ts +2 -0
- package/app/components/shared/shared.module.d.ts +2 -0
- package/app/directives/visibility-observer-master.directive.d.ts +9 -0
- package/app/directives/visibility-observer.directive.d.ts +13 -0
- package/app/services/configurator.service.d.ts +22 -0
- package/app/services/image-cache.service.d.ts +10 -0
- package/app/services/locator.service.d.ts +4 -0
- package/bundles/colijnit-configurator.umd.js +2745 -0
- package/bundles/colijnit-configurator.umd.js.map +1 -0
- package/bundles/colijnit-configurator.umd.min.js +17 -0
- package/bundles/colijnit-configurator.umd.min.js.map +1 -0
- package/colijnit-configurator.d.ts +10 -0
- package/colijnit-configurator.metadata.json +1 -0
- package/esm2015/app/builder.js +477 -0
- package/esm2015/app/components/answers/answer/answer.component.js +69 -0
- package/esm2015/app/components/answers/answers.component.js +43 -0
- package/esm2015/app/components/answers/answers.module.js +29 -0
- package/esm2015/app/components/selections/selections.component.js +134 -0
- package/esm2015/app/components/selections/selections.module.js +23 -0
- package/esm2015/app/components/shared/loader/loader.component.js +24 -0
- package/esm2015/app/components/shared/shared.module.js +21 -0
- package/esm2015/app/directives/visibility-observer-master.directive.js +51 -0
- package/esm2015/app/directives/visibility-observer.directive.js +57 -0
- package/esm2015/app/services/configurator.service.js +94 -0
- package/esm2015/app/services/image-cache.service.js +66 -0
- package/esm2015/app/services/locator.service.js +10 -0
- package/esm2015/colijnit-configurator.js +11 -0
- package/esm2015/helper/variation-helper.js +216 -0
- package/esm2015/model/material.js +11 -0
- package/esm2015/model/variation-settings.js +6 -0
- package/esm2015/model/variation.js +3 -0
- package/esm2015/public_api.js +7 -0
- package/esm2015/utils/asset.utils.js +74 -0
- package/esm2015/utils/file.utils.js +139 -0
- package/esm2015/utils/image.utils.js +52 -0
- package/esm2015/utils/object.utils.js +49 -0
- package/esm2015/utils/scene-utils.js +94 -0
- package/esm2015/utils/threed.utils.js +222 -0
- package/esm2015/utils/variation-utils.js +224 -0
- package/esm5/app/builder.js +591 -0
- package/esm5/app/components/answers/answer/answer.component.js +64 -0
- package/esm5/app/components/answers/answers.component.js +27 -0
- package/esm5/app/components/answers/answers.module.js +32 -0
- package/esm5/app/components/selections/selections.component.js +104 -0
- package/esm5/app/components/selections/selections.module.js +26 -0
- package/esm5/app/components/shared/loader/loader.component.js +16 -0
- package/esm5/app/components/shared/shared.module.js +24 -0
- package/esm5/app/directives/visibility-observer-master.directive.js +64 -0
- package/esm5/app/directives/visibility-observer.directive.js +59 -0
- package/esm5/app/services/configurator.service.js +160 -0
- package/esm5/app/services/image-cache.service.js +69 -0
- package/esm5/app/services/locator.service.js +13 -0
- package/esm5/colijnit-configurator.js +11 -0
- package/esm5/helper/variation-helper.js +268 -0
- package/esm5/model/material.js +13 -0
- package/esm5/model/variation-settings.js +8 -0
- package/esm5/model/variation.js +7 -0
- package/esm5/public_api.js +7 -0
- package/esm5/utils/asset.utils.js +106 -0
- package/esm5/utils/file.utils.js +151 -0
- package/esm5/utils/image.utils.js +56 -0
- package/esm5/utils/object.utils.js +56 -0
- package/esm5/utils/scene-utils.js +98 -0
- package/esm5/utils/threed.utils.js +279 -0
- package/esm5/utils/variation-utils.js +327 -0
- package/fesm2015/colijnit-configurator.js +2109 -0
- package/fesm2015/colijnit-configurator.js.map +1 -0
- package/fesm5/colijnit-configurator.js +2527 -0
- package/fesm5/colijnit-configurator.js.map +1 -0
- package/helper/variation-helper.d.ts +14 -0
- package/model/material.d.ts +17 -0
- package/model/variation-settings.d.ts +14 -0
- package/model/variation.d.ts +10 -0
- package/package.json +12 -45
- package/{src/public_api.ts → public_api.d.ts} +6 -6
- package/utils/asset.utils.d.ts +13 -0
- package/utils/file.utils.d.ts +27 -0
- package/utils/image.utils.d.ts +8 -0
- package/utils/object.utils.d.ts +7 -0
- package/utils/scene-utils.d.ts +7 -0
- package/utils/threed.utils.d.ts +16 -0
- package/utils/variation-utils.d.ts +12 -0
- package/.idea/Configurator.iml +0 -12
- package/.idea/codeStyles/Project.xml +0 -21
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/misc.xml +0 -9
- package/.idea/modules.xml +0 -8
- package/.idea/vcs.xml +0 -6
- package/angular.json +0 -193
- package/configurator.iml +0 -11
- package/dist/configurator/index.html +0 -14
- package/dist/configurator/main-es2015.js +0 -3129
- package/dist/configurator/main-es2015.js.map +0 -1
- package/dist/configurator/main-es5.js +0 -5482
- package/dist/configurator/main-es5.js.map +0 -1
- package/dist/configurator/polyfills-es2015.js +0 -4520
- package/dist/configurator/polyfills-es2015.js.map +0 -1
- package/dist/configurator/polyfills-es5.js +0 -18375
- package/dist/configurator/polyfills-es5.js.map +0 -1
- package/dist/configurator/runtime-es2015.js +0 -155
- package/dist/configurator/runtime-es2015.js.map +0 -1
- package/dist/configurator/runtime-es5.js +0 -155
- package/dist/configurator/runtime-es5.js.map +0 -1
- package/dist/configurator/styles-es2015.js +0 -450
- package/dist/configurator/styles-es2015.js.map +0 -1
- package/dist/configurator/styles-es5.js +0 -432
- package/dist/configurator/styles-es5.js.map +0 -1
- package/dist/configurator/vendor-es2015.js +0 -155551
- package/dist/configurator/vendor-es2015.js.map +0 -1
- package/dist/configurator/vendor-es5.js +0 -183588
- package/dist/configurator/vendor-es5.js.map +0 -1
- package/ng-package.json +0 -9
- package/src/app/app.component.ts +0 -222
- package/src/app/app.module.ts +0 -34
- package/src/app/builder.ts +0 -480
- package/src/app/components/answers/answer/answer.component.ts +0 -61
- package/src/app/components/answers/answers.component.ts +0 -41
- package/src/app/components/answers/answers.module.ts +0 -26
- package/src/app/components/selections/selections.component.ts +0 -131
- package/src/app/components/selections/selections.module.ts +0 -20
- package/src/app/components/shared/loader/loader.component.scss +0 -33
- package/src/app/components/shared/loader/loader.component.ts +0 -20
- package/src/app/components/shared/shared.module.ts +0 -16
- package/src/app/directives/visibility-observer-master.directive.ts +0 -71
- package/src/app/directives/visibility-observer.directive.ts +0 -74
- package/src/app/services/configurator.service.ts +0 -86
- package/src/app/services/image-cache.service.ts +0 -56
- package/src/app/services/locator.service.ts +0 -6
- package/src/environments/environment.prod.ts +0 -3
- package/src/environments/environment.ts +0 -8
- package/src/helper/variation-helper.ts +0 -220
- package/src/index.html +0 -14
- package/src/main.ts +0 -11
- package/src/model/material.ts +0 -22
- package/src/model/variation-settings.ts +0 -14
- package/src/model/variation.ts +0 -11
- package/src/polyfills.ts +0 -73
- package/src/style/shared.scss +0 -173
- package/src/style/styles.scss +0 -45
- package/src/tsconfig.app.json +0 -16
- package/src/tsconfig.spec.json +0 -19
- package/src/utils/asset.utils.ts +0 -88
- package/src/utils/file.utils.ts +0 -156
- package/src/utils/file.utils.unit.test.ts +0 -8
- package/src/utils/image.utils.ts +0 -54
- package/src/utils/object.utils.ts +0 -52
- package/src/utils/scene-utils.ts +0 -119
- package/src/utils/threed.utils.ts +0 -219
- package/src/utils/variation-utils.ts +0 -216
- package/tsconfig.json +0 -23
- package/tslint.json +0 -132
package/ng-package.json
DELETED
package/src/app/app.component.ts
DELETED
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
import {AfterViewInit, Component, ElementRef, OnDestroy, ViewChild} from "@angular/core";
|
|
2
|
-
import * as THREE from "three";
|
|
3
|
-
import {OrbitControls} from "three/examples/jsm/controls/OrbitControls";
|
|
4
|
-
import {Builder} from "./builder";
|
|
5
|
-
import {Options} from "@colijnit/ioneconnector/build/model/options";
|
|
6
|
-
import axios from "axios";
|
|
7
|
-
import {GLTFLoader} from "three/examples/jsm/loaders/GLTFLoader";
|
|
8
|
-
import {Subscription} from "rxjs";
|
|
9
|
-
import {Selection} from "@colijnit/configuratorapi/build/model/selection";
|
|
10
|
-
import {Answer} from "@colijnit/configuratorapi/build/model/answer";
|
|
11
|
-
import {ConfiguratorService} from './services/configurator.service';
|
|
12
|
-
import {AmbientLight, DirectionalLight, HemisphereLight, Object3D, SpotLight} from 'three';
|
|
13
|
-
|
|
14
|
-
// @ts-ignore
|
|
15
|
-
window.loadGLTF = async (file: string) => {
|
|
16
|
-
const gltfLoader: GLTFLoader = new GLTFLoader();
|
|
17
|
-
try {
|
|
18
|
-
return new Promise((resolve: Function) => {
|
|
19
|
-
gltfLoader.load(file, (obj) => {
|
|
20
|
-
resolve(obj.scene);
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
} catch (e) {
|
|
24
|
-
console.error(e);
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
// @ts-ignore
|
|
29
|
-
window.downloadVariation = async (fileName: string) => {
|
|
30
|
-
const response: any = await axios({
|
|
31
|
-
method: "get",
|
|
32
|
-
url: `https://cdn1.colijn-it.nl/${fileName}`,
|
|
33
|
-
responseType: "arraybuffer"
|
|
34
|
-
});
|
|
35
|
-
if (response.status !== 200) {
|
|
36
|
-
throw Error(response.statusText);
|
|
37
|
-
}
|
|
38
|
-
return await response.data;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
@Component({
|
|
42
|
-
selector: 'app-root',
|
|
43
|
-
template: `
|
|
44
|
-
<div #canvas class="canvas"></div>
|
|
45
|
-
<selections *ngIf="!showAnswers" [selections]="selections" (selectionClick)="selectSelection($event)"></selections>
|
|
46
|
-
<answers *ngIf="showAnswers" [selectionTitle]="selectionTitle" [answers]="answers" (answerClick)="selectAnswer($event)"></answers>
|
|
47
|
-
`
|
|
48
|
-
})
|
|
49
|
-
export class AppComponent implements AfterViewInit, OnDestroy {
|
|
50
|
-
|
|
51
|
-
@ViewChild('canvas', {read: ElementRef})
|
|
52
|
-
public canvasElement: ElementRef;
|
|
53
|
-
|
|
54
|
-
public selectionTitle: string;
|
|
55
|
-
public selections: Selection[] = [];
|
|
56
|
-
public answers: Answer[] = [];
|
|
57
|
-
|
|
58
|
-
public showAnswers: boolean = false;
|
|
59
|
-
public showSelections: boolean = true;
|
|
60
|
-
|
|
61
|
-
private _builder: Builder;
|
|
62
|
-
private _object: THREE.Object3D;
|
|
63
|
-
private scene: THREE.Scene = new THREE.Scene();
|
|
64
|
-
private renderer: THREE.WebGLRenderer;
|
|
65
|
-
private camera: THREE.PerspectiveCamera;
|
|
66
|
-
private controls: OrbitControls;
|
|
67
|
-
private _subs: Subscription[] = [];
|
|
68
|
-
private _options: Options = {
|
|
69
|
-
url: "http://130.62.7.180:8082/ione",
|
|
70
|
-
version: "251",
|
|
71
|
-
schema: "815"
|
|
72
|
-
};
|
|
73
|
-
private _instanceId: string = undefined;
|
|
74
|
-
private _sku: string = '1000234793';
|
|
75
|
-
|
|
76
|
-
constructor(private _configuratorService: ConfiguratorService) {}
|
|
77
|
-
|
|
78
|
-
ngAfterViewInit(): void {
|
|
79
|
-
this._builder = new Builder(this.scene, this._options, true);
|
|
80
|
-
this._subs.push(
|
|
81
|
-
this._builder.selectionsReceived.subscribe((selections: Selection[]) => {
|
|
82
|
-
this.selections = selections;
|
|
83
|
-
}),
|
|
84
|
-
this._builder.answersReceived.subscribe((answers: Answer[]) => {
|
|
85
|
-
this.answers = answers;
|
|
86
|
-
this.showAnswers = this.answers.length > 0;
|
|
87
|
-
}),
|
|
88
|
-
this._builder.modelLoaded.subscribe((object: Object3D) => {
|
|
89
|
-
if (object && this.answers.length === 0) {
|
|
90
|
-
this._loadModel(object);
|
|
91
|
-
}
|
|
92
|
-
})
|
|
93
|
-
);
|
|
94
|
-
this._initScene();
|
|
95
|
-
this._initRenderer();
|
|
96
|
-
this._initCameraAndControls();
|
|
97
|
-
this._initLights();
|
|
98
|
-
// this._test();
|
|
99
|
-
this._animate();
|
|
100
|
-
this._builder.buildModel(this._sku, this._instanceId);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
ngOnDestroy(): void {
|
|
104
|
-
this._subs.forEach(s => s.unsubscribe());
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
public disableControls(): void {
|
|
108
|
-
this.controls.enabled = false;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
public enableControls(): void {
|
|
112
|
-
this.controls.enabled = true;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
public selectSelection(selection: Selection): void {
|
|
116
|
-
this._builder.selectSelection(selection);
|
|
117
|
-
this.selectionTitle = selection.commercialQuestion;
|
|
118
|
-
this.showSelections = false;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
public selectAnswer(answer: Answer): void {
|
|
122
|
-
this._builder.selectAnswer(answer);
|
|
123
|
-
this.selectionTitle = ' . . / ' + answer.answer;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
private _initScene(): void {
|
|
127
|
-
this.scene = new THREE.Scene();
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
private _initRenderer(): void {
|
|
131
|
-
this.renderer = new THREE.WebGLRenderer({
|
|
132
|
-
alpha: true,
|
|
133
|
-
antialias: true,
|
|
134
|
-
preserveDrawingBuffer: true
|
|
135
|
-
});
|
|
136
|
-
this.renderer.setClearColor(0xfafafa);
|
|
137
|
-
this.renderer.autoClear = true;
|
|
138
|
-
this.renderer.setPixelRatio(window.devicePixelRatio);
|
|
139
|
-
this.renderer.shadowMap.enabled = true;
|
|
140
|
-
// Use PCFShadowMap to enable radius else use PCFSoftShadowMap
|
|
141
|
-
this.renderer.shadowMap.type = THREE.PCFSoftShadowMap;
|
|
142
|
-
this.renderer.outputEncoding = THREE.LinearEncoding;
|
|
143
|
-
// this.renderer.gammaFactor = 2.2;
|
|
144
|
-
// this.renderer.toneMappingExposure = 1.1;
|
|
145
|
-
this.canvasElement.nativeElement.appendChild(this.renderer.domElement);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
private _initCameraAndControls(): void {
|
|
149
|
-
this.camera = new THREE.PerspectiveCamera(45, 1, 0.01, 100);
|
|
150
|
-
this.controls = new OrbitControls( this.camera, this.renderer.domElement );
|
|
151
|
-
this.camera.position.set(0, 3, 1.5);
|
|
152
|
-
this.controls.update();
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
private _animate(): void {
|
|
156
|
-
this.renderer.setAnimationLoop(() => this._render());
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
private _render(): void {
|
|
160
|
-
this._checkCanvasResize();
|
|
161
|
-
this.renderer.render(this.scene, this.camera);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
private _checkCanvasResize(): void {
|
|
165
|
-
const canvas = this.renderer.domElement;
|
|
166
|
-
if (this.canvasElement.nativeElement.clientWidth !== canvas.width || this.canvasElement.nativeElement.clientHeight !== canvas.height) {
|
|
167
|
-
this._updateWindowSize();
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
private _updateWindowSize() {
|
|
172
|
-
this._resizeRendererToDisplaySize();
|
|
173
|
-
const canvas = this.renderer.domElement;
|
|
174
|
-
const aspect = canvas.width / canvas.height;
|
|
175
|
-
this.camera.aspect = aspect;
|
|
176
|
-
(this.camera as THREE.PerspectiveCamera).updateProjectionMatrix();
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
private _resizeRendererToDisplaySize() {
|
|
180
|
-
this.renderer.setSize(this.canvasElement.nativeElement.clientWidth, this.canvasElement.nativeElement.clientHeight, false);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
private _test(): void {
|
|
184
|
-
const mat: THREE.MeshBasicMaterial = new THREE.MeshBasicMaterial({color: 'blue'});
|
|
185
|
-
const geo: THREE.BoxGeometry = new THREE.BoxGeometry(1, 1, 1);
|
|
186
|
-
const mesh: THREE.Mesh = new THREE.Mesh(geo, mat);
|
|
187
|
-
this.scene.add(mesh);
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
private async _loadModel(object: Object3D): Promise<void> {
|
|
191
|
-
object.name = this._sku;
|
|
192
|
-
object.visible = true;
|
|
193
|
-
const objectFromScene = this.scene.getObjectByName(this._sku);
|
|
194
|
-
if (objectFromScene) {
|
|
195
|
-
this.scene.remove(objectFromScene);
|
|
196
|
-
}
|
|
197
|
-
this.scene.add(object);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
private _initLights(): void {
|
|
201
|
-
const ambientLight: AmbientLight = new AmbientLight('#595959', 1.2);
|
|
202
|
-
ambientLight.name = 'ambientLight';
|
|
203
|
-
const directional: DirectionalLight = new DirectionalLight('white', 1);
|
|
204
|
-
directional.position.set(0, 4, 0);
|
|
205
|
-
directional.castShadow = true;
|
|
206
|
-
const spotLight1 = new SpotLight('white', 4, 25, 0.7, 0, 0.7);
|
|
207
|
-
spotLight1.position.set(-15, 9 , -15);
|
|
208
|
-
spotLight1.castShadow = true;
|
|
209
|
-
const spotLight2 = new SpotLight('white', 4, 25, 0.7, 0, 0.7);
|
|
210
|
-
spotLight2.position.set(15, 9 , -15);
|
|
211
|
-
spotLight2.castShadow = true;
|
|
212
|
-
const spotLight3 = new SpotLight('white', 4, 25, 0.7, 0, 0.7);
|
|
213
|
-
spotLight3.position.set(-15, 9 , 15);
|
|
214
|
-
spotLight3.castShadow = true;
|
|
215
|
-
const spotLight4 = new SpotLight('white', 4, 25, 0.7, 0, 0.7);
|
|
216
|
-
spotLight4.position.set(15, 9 , 15);
|
|
217
|
-
spotLight4.castShadow = true;
|
|
218
|
-
const hemiSphere = new HemisphereLight('white', 'white', 0.15);
|
|
219
|
-
|
|
220
|
-
this.scene.add(ambientLight, directional, spotLight1, spotLight2, spotLight3, spotLight4, hemiSphere);
|
|
221
|
-
}
|
|
222
|
-
}
|
package/src/app/app.module.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import {NgModule} from '@angular/core';
|
|
2
|
-
import {AppComponent} from "./app.component";
|
|
3
|
-
import {CommonModule} from "@angular/common";
|
|
4
|
-
import {BrowserAnimationsModule} from "@angular/platform-browser/animations";
|
|
5
|
-
import {SelectionsModule} from "./components/selections/selections.module";
|
|
6
|
-
import {AnswersModule} from "./components/answers/answers.module";
|
|
7
|
-
import {Builder} from './builder';
|
|
8
|
-
|
|
9
|
-
@NgModule({
|
|
10
|
-
imports: [
|
|
11
|
-
BrowserAnimationsModule,
|
|
12
|
-
CommonModule,
|
|
13
|
-
SelectionsModule,
|
|
14
|
-
AnswersModule
|
|
15
|
-
],
|
|
16
|
-
providers: [
|
|
17
|
-
Builder
|
|
18
|
-
],
|
|
19
|
-
declarations: [
|
|
20
|
-
AppComponent
|
|
21
|
-
],
|
|
22
|
-
entryComponents: [
|
|
23
|
-
AppComponent
|
|
24
|
-
],
|
|
25
|
-
exports: [
|
|
26
|
-
AppComponent
|
|
27
|
-
],
|
|
28
|
-
bootstrap: [
|
|
29
|
-
AppComponent
|
|
30
|
-
]
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
export class AppModule {
|
|
34
|
-
}
|