@configura/babylon-view 1.6.2 → 2.0.0-alpha.10
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/.eslintrc.json +18 -18
- package/LICENSE +201 -201
- package/README.md +1 -1
- package/dist/animation/AnimatableObject.d.ts +8 -8
- package/dist/animation/AnimatableObject.js +3 -3
- package/dist/animation/animator/Animator.d.ts +33 -33
- package/dist/animation/animator/Animator.js +58 -58
- package/dist/animation/animator/AnimatorEasing.d.ts +16 -16
- package/dist/animation/animator/AnimatorEasing.js +31 -31
- package/dist/animation/animator/AnimatorEasingMatrix.d.ts +14 -14
- package/dist/animation/animator/AnimatorEasingMatrix.js +16 -16
- package/dist/animation/animator/AnimatorHighlight.d.ts +16 -16
- package/dist/animation/animator/AnimatorHighlight.js +32 -32
- package/dist/animation/animator/AnimatorPointToPoint.d.ts +8 -8
- package/dist/animation/animator/AnimatorPointToPoint.js +14 -14
- package/dist/animation/animator/AnimatorQueue.d.ts +13 -13
- package/dist/animation/animator/AnimatorQueue.js +57 -57
- package/dist/animation/animator/AnimatorScale.d.ts +8 -8
- package/dist/animation/animator/AnimatorScale.js +13 -13
- package/dist/animation/animator/AnimatorSpin.d.ts +10 -10
- package/dist/animation/animator/AnimatorSpin.js +13 -13
- package/dist/animation/animator/EasingFunctions.d.ts +35 -35
- package/dist/animation/animator/EasingFunctions.js +137 -137
- package/dist/animation/coordinator/Coordinator.d.ts +28 -28
- package/dist/animation/coordinator/Coordinator.js +53 -53
- package/dist/animation/coordinator/CoordinatorDropAndSpin.d.ts +22 -22
- package/dist/animation/coordinator/CoordinatorDropAndSpin.js +138 -138
- package/dist/animation/coordinator/CoordinatorIdentity.d.ts +11 -11
- package/dist/animation/coordinator/CoordinatorIdentity.js +14 -14
- package/dist/animation/coordinator/CoordinatorNodeQueues.d.ts +18 -18
- package/dist/animation/coordinator/CoordinatorNodeQueues.js +50 -50
- package/dist/animation/coordinator/CoordinatorPulse.d.ts +21 -21
- package/dist/animation/coordinator/CoordinatorPulse.js +47 -47
- package/dist/animation/coordinator/CoordinatorPulseBounce.d.ts +14 -14
- package/dist/animation/coordinator/CoordinatorPulseBounce.js +35 -35
- package/dist/animation/coordinator/CoordinatorPulseHighlight.d.ts +13 -13
- package/dist/animation/coordinator/CoordinatorPulseHighlight.js +29 -29
- package/dist/animation/coordinator/CoordinatorPulseInflate.d.ts +14 -14
- package/dist/animation/coordinator/CoordinatorPulseInflate.js +23 -23
- package/dist/camera/CameraCreator.d.ts +5 -5
- package/dist/camera/CameraCreator.js +4 -4
- package/dist/camera/CfgArcRotateCameraPointersInput.d.ts +26 -26
- package/dist/camera/CfgArcRotateCameraPointersInput.js +266 -266
- package/dist/camera/CfgOrbitalCamera.d.ts +76 -68
- package/dist/camera/CfgOrbitalCamera.js +276 -250
- package/dist/camera/CfgOrbitalCameraControlProps.d.ts +12 -6
- package/dist/camera/CfgOrbitalCameraControlProps.js +7 -3
- package/dist/camera/GradingApplier.d.ts +3 -3
- package/dist/camera/GradingApplier.js +48 -48
- package/dist/engine/EngineCreator.d.ts +3 -3
- package/dist/engine/EngineCreator.js +10 -10
- package/dist/geometry/CfgGeometry.d.ts +29 -29
- package/dist/geometry/CfgGeometry.js +146 -146
- package/dist/geometry/CfgMesh.d.ts +10 -10
- package/dist/geometry/CfgMesh.js +38 -38
- package/dist/geometry/geoSplitter.d.ts +8 -8
- package/dist/geometry/geoSplitter.js +192 -192
- package/dist/geometry/stretch/CfgMorphTarget.d.ts +15 -15
- package/dist/geometry/stretch/CfgMorphTarget.js +65 -65
- package/dist/geometry/stretch/CfgStretchData.d.ts +116 -116
- package/dist/geometry/stretch/CfgStretchData.js +350 -350
- package/dist/geometry/stretch/CfgStretchMorphGeometry.d.ts +16 -16
- package/dist/geometry/stretch/CfgStretchMorphGeometry.js +95 -95
- package/dist/index.d.ts +16 -13
- package/dist/index.js +16 -13
- package/dist/io/CfgHistoryToCameraConfConnector.d.ts +30 -0
- package/dist/io/CfgHistoryToCameraConfConnector.js +80 -0
- package/dist/io/CfgIOCameraConfConnector.d.ts +36 -0
- package/dist/io/CfgIOCameraConfConnector.js +81 -0
- package/dist/io/CfgObservableStateToCameraConfConnector.d.ts +11 -0
- package/dist/io/CfgObservableStateToCameraConfConnector.js +11 -0
- package/dist/io/CfgWindowMessageToCameraConfConnector.d.ts +11 -0
- package/dist/io/CfgWindowMessageToCameraConfConnector.js +11 -0
- package/dist/light/CfgDirectionalLight.d.ts +8 -8
- package/dist/light/CfgDirectionalLight.js +18 -18
- package/dist/light/CfgHemisphericLight.d.ts +7 -7
- package/dist/light/CfgHemisphericLight.js +17 -17
- package/dist/light/CfgPointLight.d.ts +8 -8
- package/dist/light/CfgPointLight.js +18 -18
- package/dist/light/DefaultLightRig.d.ts +19 -19
- package/dist/light/DefaultLightRig.js +77 -77
- package/dist/light/LightRigCreator.d.ts +9 -9
- package/dist/light/LightRigCreator.js +3 -3
- package/dist/material/CfgMaterial.d.ts +68 -68
- package/dist/material/CfgMaterial.js +482 -482
- package/dist/material/DummyMaterialCreator.d.ts +4 -4
- package/dist/material/DummyMaterialCreator.js +15 -15
- package/dist/material/material.d.ts +18 -18
- package/dist/material/material.js +128 -128
- package/dist/material/texture.d.ts +14 -14
- package/dist/material/texture.js +306 -306
- package/dist/nodes/CfgContentRootNode.d.ts +19 -19
- package/dist/nodes/CfgContentRootNode.js +75 -75
- package/dist/nodes/CfgDeferredMeshNode.d.ts +55 -55
- package/dist/nodes/CfgDeferredMeshNode.js +378 -378
- package/dist/nodes/CfgProductNode.d.ts +127 -127
- package/dist/nodes/CfgProductNode.js +598 -598
- package/dist/nodes/CfgSymNode.d.ts +50 -50
- package/dist/nodes/CfgSymNode.js +249 -249
- package/dist/nodes/CfgSymRootNode.d.ts +45 -45
- package/dist/nodes/CfgSymRootNode.js +229 -229
- package/dist/nodes/CfgTransformNode.d.ts +33 -33
- package/dist/nodes/CfgTransformNode.js +83 -83
- package/dist/scene/SceneCreator.d.ts +6 -6
- package/dist/scene/SceneCreator.js +22 -22
- package/dist/utilities/CfgBoundingBox.d.ts +21 -21
- package/dist/utilities/CfgBoundingBox.js +81 -81
- package/dist/utilities/anchor/anchor.d.ts +50 -50
- package/dist/utilities/anchor/anchor.js +133 -133
- package/dist/utilities/anchor/anchorMap.d.ts +20 -20
- package/dist/utilities/anchor/anchorMap.js +111 -111
- package/dist/utilities/utilities3D.d.ts +70 -70
- package/dist/utilities/utilities3D.js +265 -265
- package/dist/utilities/utilitiesColor.d.ts +18 -18
- package/dist/utilities/utilitiesColor.js +50 -50
- package/dist/utilities/utilitiesImage.d.ts +6 -6
- package/dist/utilities/utilitiesImage.js +107 -107
- package/dist/utilities/utilitiesSymRootIdentifier.d.ts +7 -7
- package/dist/utilities/utilitiesSymRootIdentifier.js +26 -26
- package/dist/view/BaseView.d.ts +78 -78
- package/dist/view/BaseView.js +303 -303
- package/dist/view/BaseViewConfiguration.d.ts +32 -32
- package/dist/view/BaseViewConfiguration.js +10 -10
- package/dist/view/RenderEnv.d.ts +43 -43
- package/dist/view/RenderEnv.js +7 -7
- package/dist/view/SingleProductDefaultCameraView.d.ts +37 -34
- package/dist/view/SingleProductDefaultCameraView.js +145 -141
- package/dist/view/SingleProductDefaultCameraViewConfiguration.d.ts +42 -46
- package/dist/view/SingleProductDefaultCameraViewConfiguration.js +11 -11
- package/dist/view/SingleProductView.d.ts +44 -42
- package/dist/view/SingleProductView.js +212 -207
- package/dist/view/SingleProductViewConfiguration.d.ts +32 -32
- package/dist/view/SingleProductViewConfiguration.js +19 -19
- package/package.json +5 -5
|
@@ -1,207 +1,212 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { CfgMtrlApplication, CfgMtrlApplicationSource, } from "@configura/web-api";
|
|
11
|
-
import { getWaitFramesPromise, Observable } from "@configura/web-utilities";
|
|
12
|
-
import { CoordinatorIdentity } from "../animation/coordinator/CoordinatorIdentity.js";
|
|
13
|
-
import { CfgProductNode } from "../nodes/CfgProductNode.js";
|
|
14
|
-
import { BaseView } from "./BaseView.js";
|
|
15
|
-
import { SingleProductViewPhase, } from "./SingleProductViewConfiguration.js";
|
|
16
|
-
export class SingleProductView extends BaseView {
|
|
17
|
-
constructor(options) {
|
|
18
|
-
super(options);
|
|
19
|
-
this.
|
|
20
|
-
this.
|
|
21
|
-
this.
|
|
22
|
-
this.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
this.
|
|
34
|
-
this.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
let
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
this.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
this.
|
|
55
|
-
this.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
this.
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
this
|
|
101
|
-
this.
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
this.
|
|
120
|
-
|
|
121
|
-
this.
|
|
122
|
-
|
|
123
|
-
this.
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
this.
|
|
154
|
-
this.
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
super.
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
}
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { CfgMtrlApplication, CfgMtrlApplicationSource, } from "@configura/web-api";
|
|
11
|
+
import { getWaitFramesPromise, Observable } from "@configura/web-utilities";
|
|
12
|
+
import { CoordinatorIdentity } from "../animation/coordinator/CoordinatorIdentity.js";
|
|
13
|
+
import { CfgProductNode } from "../nodes/CfgProductNode.js";
|
|
14
|
+
import { BaseView } from "./BaseView.js";
|
|
15
|
+
import { SingleProductViewPhase, } from "./SingleProductViewConfiguration.js";
|
|
16
|
+
export class SingleProductView extends BaseView {
|
|
17
|
+
constructor(options) {
|
|
18
|
+
super(options);
|
|
19
|
+
this._isFirstLoad = true;
|
|
20
|
+
this._scheduledForRemoval = [];
|
|
21
|
+
this._viewPhaseObservable = new Observable();
|
|
22
|
+
this._currentPhase = SingleProductViewPhase.Idle;
|
|
23
|
+
this.notifyPhaseChange = (phase) => {
|
|
24
|
+
this._viewPhaseObservable.notifyAll({
|
|
25
|
+
previous: this._currentPhase,
|
|
26
|
+
current: phase,
|
|
27
|
+
});
|
|
28
|
+
this._currentPhase = phase;
|
|
29
|
+
};
|
|
30
|
+
this.clearProduct = () => {
|
|
31
|
+
const currentProductNode = this._currentProductNode;
|
|
32
|
+
if (currentProductNode !== undefined) {
|
|
33
|
+
this.notifyPhaseChange(SingleProductViewPhase.RemovePreviousProduct);
|
|
34
|
+
this.scheduleForRemoval(currentProductNode);
|
|
35
|
+
this._currentProductNode = undefined;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
this.loadProduct = (applicationAreas, product) => {
|
|
39
|
+
this.notifyPhaseChange(SingleProductViewPhase.LoadProductCalled);
|
|
40
|
+
const abortController = new AbortController();
|
|
41
|
+
const abortSignal = abortController.signal;
|
|
42
|
+
const loadingToken = this._loadingObservable.startChildLoading();
|
|
43
|
+
const stopLoading = () => {
|
|
44
|
+
this._loadingObservable.stopChildLoading(loadingToken);
|
|
45
|
+
};
|
|
46
|
+
void (() => __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
let isNewProduct = false;
|
|
48
|
+
let currentProductNode = this._currentProductNode;
|
|
49
|
+
if (currentProductNode === undefined ||
|
|
50
|
+
!currentProductNode.product.isBackedBySame(product)) {
|
|
51
|
+
this.clearProduct();
|
|
52
|
+
this.notifyPhaseChange(SingleProductViewPhase.MakeNewProduct);
|
|
53
|
+
currentProductNode = CfgProductNode.make(this._renderEnvironment, product);
|
|
54
|
+
this.notifyPhaseChange(SingleProductViewPhase.AddNewProduct);
|
|
55
|
+
this._currentProductNode = currentProductNode;
|
|
56
|
+
this._contentRoot.add(currentProductNode);
|
|
57
|
+
isNewProduct = true;
|
|
58
|
+
}
|
|
59
|
+
const animationCoordinator = {
|
|
60
|
+
coordinator: this._animationCoordinator,
|
|
61
|
+
isNewProduct,
|
|
62
|
+
};
|
|
63
|
+
try {
|
|
64
|
+
this.notifyPhaseChange(SingleProductViewPhase.SetModelsAndLoadGeo);
|
|
65
|
+
currentProductNode.refreshStretch();
|
|
66
|
+
yield currentProductNode.loadGeo(animationCoordinator);
|
|
67
|
+
if (isNewProduct) {
|
|
68
|
+
// New products needs resizing before rendering the first time
|
|
69
|
+
this.notifyPhaseChange(SingleProductViewPhase.HandleSizing);
|
|
70
|
+
this.handleSizing(true);
|
|
71
|
+
}
|
|
72
|
+
if (abortSignal.aborted) {
|
|
73
|
+
this.notifyPhaseChange(SingleProductViewPhase.Aborted);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (applicationAreas !== "loading") {
|
|
77
|
+
this.notifyPhaseChange(SingleProductViewPhase.SetApplicationAreas);
|
|
78
|
+
currentProductNode.setApplicationAreas(applicationAreas.map((a) => CfgMtrlApplication.fromMtrlLikeApplication(CfgMtrlApplicationSource.ApplicationArea, a)));
|
|
79
|
+
}
|
|
80
|
+
const loadMaterialsPromise = currentProductNode.loadMaterials(animationCoordinator);
|
|
81
|
+
const doRenderTemporaryMaterials = yield Promise.race([
|
|
82
|
+
(() => __awaiter(this, void 0, void 0, function* () {
|
|
83
|
+
yield loadMaterialsPromise;
|
|
84
|
+
return false;
|
|
85
|
+
}))(),
|
|
86
|
+
(() => __awaiter(this, void 0, void 0, function* () {
|
|
87
|
+
yield getWaitFramesPromise(10);
|
|
88
|
+
return true;
|
|
89
|
+
}))(),
|
|
90
|
+
]);
|
|
91
|
+
this.notifyPhaseChange(SingleProductViewPhase.ApplyGeo);
|
|
92
|
+
yield currentProductNode.applyGeo(animationCoordinator);
|
|
93
|
+
// We don't have to wait for this
|
|
94
|
+
void this.flushScheduledForRemove(animationCoordinator);
|
|
95
|
+
if (abortSignal.aborted) {
|
|
96
|
+
this.notifyPhaseChange(SingleProductViewPhase.Aborted);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
if (!isNewProduct) {
|
|
100
|
+
// At this stage, any change in geometry has been applied
|
|
101
|
+
this.notifyPhaseChange(SingleProductViewPhase.HandleSizing);
|
|
102
|
+
this.handleSizing(false);
|
|
103
|
+
}
|
|
104
|
+
this._isFirstLoad = false;
|
|
105
|
+
if (doRenderTemporaryMaterials) {
|
|
106
|
+
this.scheduleRerender();
|
|
107
|
+
}
|
|
108
|
+
if (abortSignal.aborted) {
|
|
109
|
+
this.notifyPhaseChange(SingleProductViewPhase.Aborted);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
this.notifyPhaseChange(SingleProductViewPhase.LoadMaterials);
|
|
113
|
+
yield loadMaterialsPromise;
|
|
114
|
+
if (abortSignal.aborted) {
|
|
115
|
+
this.notifyPhaseChange(SingleProductViewPhase.Aborted);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
this.notifyPhaseChange(SingleProductViewPhase.ApplyMaterials);
|
|
119
|
+
this.pauseRendering();
|
|
120
|
+
yield currentProductNode.applyMaterials();
|
|
121
|
+
this.resumeRendering();
|
|
122
|
+
this.notifyPhaseChange(SingleProductViewPhase.AppliedMaterials);
|
|
123
|
+
this.scheduleRerender();
|
|
124
|
+
stopLoading();
|
|
125
|
+
this.notifyPhaseChange(SingleProductViewPhase.Idle);
|
|
126
|
+
}
|
|
127
|
+
catch (e) {
|
|
128
|
+
this.notifyPhaseChange(SingleProductViewPhase.Error);
|
|
129
|
+
this.notifyError(e);
|
|
130
|
+
stopLoading();
|
|
131
|
+
// Might result in double-unlock of semaphore, this is OK.
|
|
132
|
+
this.resumeRendering();
|
|
133
|
+
}
|
|
134
|
+
}))();
|
|
135
|
+
return () => {
|
|
136
|
+
abortController.abort();
|
|
137
|
+
stopLoading();
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
this._animationCoordinator = new CoordinatorIdentity(this, this._viewPhaseObservable);
|
|
141
|
+
}
|
|
142
|
+
destroy() {
|
|
143
|
+
this._animationCoordinator.destroy();
|
|
144
|
+
super.destroy();
|
|
145
|
+
}
|
|
146
|
+
scheduleForRemoval(productNode) {
|
|
147
|
+
productNode.destroy();
|
|
148
|
+
this._scheduledForRemoval.push(productNode);
|
|
149
|
+
}
|
|
150
|
+
setConfiguration(configuration) {
|
|
151
|
+
const animationCoordinatorCreator = configuration.experimentalAnimationCoordinator;
|
|
152
|
+
if (animationCoordinatorCreator !== undefined &&
|
|
153
|
+
this._animationCoordinatorCreator !== animationCoordinatorCreator) {
|
|
154
|
+
this._animationCoordinatorCreator = animationCoordinatorCreator;
|
|
155
|
+
this._animationCoordinator.destroy();
|
|
156
|
+
this._animationCoordinator = animationCoordinatorCreator(this, this._viewPhaseObservable);
|
|
157
|
+
}
|
|
158
|
+
super.setConfiguration(configuration);
|
|
159
|
+
}
|
|
160
|
+
get currentProductNode() {
|
|
161
|
+
return this._currentProductNode;
|
|
162
|
+
}
|
|
163
|
+
get isFirstLoad() {
|
|
164
|
+
return this._isFirstLoad;
|
|
165
|
+
}
|
|
166
|
+
addEventListener(event, listener) {
|
|
167
|
+
switch (event) {
|
|
168
|
+
case "viewPhase":
|
|
169
|
+
this._viewPhaseObservable.listen(listener);
|
|
170
|
+
break;
|
|
171
|
+
default:
|
|
172
|
+
super.addEventListener(event, listener);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
removeEventListener(event, listener) {
|
|
176
|
+
switch (event) {
|
|
177
|
+
case "viewPhase":
|
|
178
|
+
this._viewPhaseObservable.stopListen(listener);
|
|
179
|
+
break;
|
|
180
|
+
default:
|
|
181
|
+
super.removeEventListener(event, listener);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
getNeededFrameRender(time) {
|
|
185
|
+
return (super.getNeededFrameRender(time) ||
|
|
186
|
+
this._animationCoordinator.willTick(time, this._engine.getDeltaTime()));
|
|
187
|
+
}
|
|
188
|
+
renderFrame(time) {
|
|
189
|
+
this._animationCoordinator.tick(time, this._engine.getDeltaTime());
|
|
190
|
+
super.renderFrame(time);
|
|
191
|
+
}
|
|
192
|
+
flushScheduledForRemove(animationCoordinator) {
|
|
193
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
194
|
+
if (this._scheduledForRemoval.length === 0) {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
const promises = [];
|
|
198
|
+
for (;;) {
|
|
199
|
+
const productNode = this._scheduledForRemoval.shift();
|
|
200
|
+
if (productNode === undefined) {
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
203
|
+
promises.push((() => __awaiter(this, void 0, void 0, function* () {
|
|
204
|
+
yield productNode.flushScheduledForRemove(animationCoordinator);
|
|
205
|
+
this._contentRoot.remove(true, productNode);
|
|
206
|
+
}))());
|
|
207
|
+
}
|
|
208
|
+
yield Promise.all(promises);
|
|
209
|
+
this.notifyPhaseChange(SingleProductViewPhase.RemovedProduct);
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
}
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { EventListener } from "@configura/web-utilities";
|
|
2
|
-
import { CoordinatorCreator } from "../animation/coordinator/Coordinator.js";
|
|
3
|
-
import { BaseViewConfiguration, BaseViewEventMap } from "./BaseViewConfiguration.js";
|
|
4
|
-
export interface SingleProductViewConfiguration extends BaseViewConfiguration {
|
|
5
|
-
experimentalAnimationCoordinator?: CoordinatorCreator;
|
|
6
|
-
}
|
|
7
|
-
export interface SingleProductViewEventMap extends BaseViewEventMap {
|
|
8
|
-
viewPhase: SingleProductViewPhaseEvent;
|
|
9
|
-
}
|
|
10
|
-
export declare type SingleProductViewEventListener<K extends keyof SingleProductViewEventMap> = EventListener<SingleProductViewEventMap, K>;
|
|
11
|
-
export declare type SingleProductViewPhaseEvent = {
|
|
12
|
-
previous: SingleProductViewPhase;
|
|
13
|
-
current: SingleProductViewPhase;
|
|
14
|
-
};
|
|
15
|
-
export declare enum SingleProductViewPhase {
|
|
16
|
-
Idle = "Idle",
|
|
17
|
-
LoadProductCalled = "LoadProductCalled",
|
|
18
|
-
RemovePreviousProduct = "RemovePreviousProduct",
|
|
19
|
-
RemovedProduct = "RemovedProduct",
|
|
20
|
-
MakeNewProduct = "MakeNewProduct",
|
|
21
|
-
AddNewProduct = "AddNewProduct",
|
|
22
|
-
SetApplicationAreas = "SetApplicationAreas",
|
|
23
|
-
SetModelsAndLoadGeo = "SetModelsAndLoadGeo",
|
|
24
|
-
GeoLoaded = "GeoLoaded",
|
|
25
|
-
ApplyGeo = "ApplyGeo",
|
|
26
|
-
HandleSizing = "HandleSizing",
|
|
27
|
-
LoadMaterials = "LoadMaterials",
|
|
28
|
-
ApplyMaterials = "ApplyMaterials",
|
|
29
|
-
AppliedMaterials = "AppliedMaterials",
|
|
30
|
-
Aborted = "Aborted",
|
|
31
|
-
Error = "Error"
|
|
32
|
-
}
|
|
1
|
+
import { EventListener } from "@configura/web-utilities";
|
|
2
|
+
import { CoordinatorCreator } from "../animation/coordinator/Coordinator.js";
|
|
3
|
+
import { BaseViewConfiguration, BaseViewEventMap } from "./BaseViewConfiguration.js";
|
|
4
|
+
export interface SingleProductViewConfiguration extends BaseViewConfiguration {
|
|
5
|
+
experimentalAnimationCoordinator?: CoordinatorCreator;
|
|
6
|
+
}
|
|
7
|
+
export interface SingleProductViewEventMap extends BaseViewEventMap {
|
|
8
|
+
viewPhase: SingleProductViewPhaseEvent;
|
|
9
|
+
}
|
|
10
|
+
export declare type SingleProductViewEventListener<K extends keyof SingleProductViewEventMap> = EventListener<SingleProductViewEventMap, K>;
|
|
11
|
+
export declare type SingleProductViewPhaseEvent = {
|
|
12
|
+
previous: SingleProductViewPhase;
|
|
13
|
+
current: SingleProductViewPhase;
|
|
14
|
+
};
|
|
15
|
+
export declare enum SingleProductViewPhase {
|
|
16
|
+
Idle = "Idle",
|
|
17
|
+
LoadProductCalled = "LoadProductCalled",
|
|
18
|
+
RemovePreviousProduct = "RemovePreviousProduct",
|
|
19
|
+
RemovedProduct = "RemovedProduct",
|
|
20
|
+
MakeNewProduct = "MakeNewProduct",
|
|
21
|
+
AddNewProduct = "AddNewProduct",
|
|
22
|
+
SetApplicationAreas = "SetApplicationAreas",
|
|
23
|
+
SetModelsAndLoadGeo = "SetModelsAndLoadGeo",
|
|
24
|
+
GeoLoaded = "GeoLoaded",
|
|
25
|
+
ApplyGeo = "ApplyGeo",
|
|
26
|
+
HandleSizing = "HandleSizing",
|
|
27
|
+
LoadMaterials = "LoadMaterials",
|
|
28
|
+
ApplyMaterials = "ApplyMaterials",
|
|
29
|
+
AppliedMaterials = "AppliedMaterials",
|
|
30
|
+
Aborted = "Aborted",
|
|
31
|
+
Error = "Error"
|
|
32
|
+
}
|
|
33
33
|
//# sourceMappingURL=SingleProductViewConfiguration.d.ts.map
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
export var SingleProductViewPhase;
|
|
2
|
-
(function (SingleProductViewPhase) {
|
|
3
|
-
SingleProductViewPhase["Idle"] = "Idle";
|
|
4
|
-
SingleProductViewPhase["LoadProductCalled"] = "LoadProductCalled";
|
|
5
|
-
SingleProductViewPhase["RemovePreviousProduct"] = "RemovePreviousProduct";
|
|
6
|
-
SingleProductViewPhase["RemovedProduct"] = "RemovedProduct";
|
|
7
|
-
SingleProductViewPhase["MakeNewProduct"] = "MakeNewProduct";
|
|
8
|
-
SingleProductViewPhase["AddNewProduct"] = "AddNewProduct";
|
|
9
|
-
SingleProductViewPhase["SetApplicationAreas"] = "SetApplicationAreas";
|
|
10
|
-
SingleProductViewPhase["SetModelsAndLoadGeo"] = "SetModelsAndLoadGeo";
|
|
11
|
-
SingleProductViewPhase["GeoLoaded"] = "GeoLoaded";
|
|
12
|
-
SingleProductViewPhase["ApplyGeo"] = "ApplyGeo";
|
|
13
|
-
SingleProductViewPhase["HandleSizing"] = "HandleSizing";
|
|
14
|
-
SingleProductViewPhase["LoadMaterials"] = "LoadMaterials";
|
|
15
|
-
SingleProductViewPhase["ApplyMaterials"] = "ApplyMaterials";
|
|
16
|
-
SingleProductViewPhase["AppliedMaterials"] = "AppliedMaterials";
|
|
17
|
-
SingleProductViewPhase["Aborted"] = "Aborted";
|
|
18
|
-
SingleProductViewPhase["Error"] = "Error";
|
|
19
|
-
})(SingleProductViewPhase || (SingleProductViewPhase = {}));
|
|
1
|
+
export var SingleProductViewPhase;
|
|
2
|
+
(function (SingleProductViewPhase) {
|
|
3
|
+
SingleProductViewPhase["Idle"] = "Idle";
|
|
4
|
+
SingleProductViewPhase["LoadProductCalled"] = "LoadProductCalled";
|
|
5
|
+
SingleProductViewPhase["RemovePreviousProduct"] = "RemovePreviousProduct";
|
|
6
|
+
SingleProductViewPhase["RemovedProduct"] = "RemovedProduct";
|
|
7
|
+
SingleProductViewPhase["MakeNewProduct"] = "MakeNewProduct";
|
|
8
|
+
SingleProductViewPhase["AddNewProduct"] = "AddNewProduct";
|
|
9
|
+
SingleProductViewPhase["SetApplicationAreas"] = "SetApplicationAreas";
|
|
10
|
+
SingleProductViewPhase["SetModelsAndLoadGeo"] = "SetModelsAndLoadGeo";
|
|
11
|
+
SingleProductViewPhase["GeoLoaded"] = "GeoLoaded";
|
|
12
|
+
SingleProductViewPhase["ApplyGeo"] = "ApplyGeo";
|
|
13
|
+
SingleProductViewPhase["HandleSizing"] = "HandleSizing";
|
|
14
|
+
SingleProductViewPhase["LoadMaterials"] = "LoadMaterials";
|
|
15
|
+
SingleProductViewPhase["ApplyMaterials"] = "ApplyMaterials";
|
|
16
|
+
SingleProductViewPhase["AppliedMaterials"] = "AppliedMaterials";
|
|
17
|
+
SingleProductViewPhase["Aborted"] = "Aborted";
|
|
18
|
+
SingleProductViewPhase["Error"] = "Error";
|
|
19
|
+
})(SingleProductViewPhase || (SingleProductViewPhase = {}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@configura/babylon-view",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-alpha.10",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -16,16 +16,16 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@babylonjs/core": "4.2.0",
|
|
19
|
-
"@configura/web-core": "
|
|
20
|
-
"@configura/web-utilities": "
|
|
19
|
+
"@configura/web-core": "2.0.0-alpha.10",
|
|
20
|
+
"@configura/web-utilities": "2.0.0-alpha.10"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@configura/web-api": "
|
|
23
|
+
"@configura/web-api": "2.0.0-alpha.10",
|
|
24
24
|
"del-cli": "^3.0.0",
|
|
25
25
|
"typescript": "4.2"
|
|
26
26
|
},
|
|
27
27
|
"publishConfig": {
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "77f9cbe7521be3fd58a139bdc93167a349ef384f"
|
|
31
31
|
}
|