@combeenation/3d-viewer 6.0.0 → 6.1.0-beta2
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/README.md +111 -111
- package/dist/lib-cjs/api/classes/animationInterface.d.ts +8 -8
- package/dist/lib-cjs/api/classes/animationInterface.js +2 -2
- package/dist/lib-cjs/api/classes/dottedPath.d.ts +79 -79
- package/dist/lib-cjs/api/classes/dottedPath.js +166 -166
- package/dist/lib-cjs/api/classes/element.d.ts +149 -149
- package/dist/lib-cjs/api/classes/element.js +669 -669
- package/dist/lib-cjs/api/classes/event.d.ts +342 -326
- package/dist/lib-cjs/api/classes/event.js +365 -349
- package/dist/lib-cjs/api/classes/event.js.map +1 -1
- package/dist/lib-cjs/api/classes/eventBroadcaster.d.ts +26 -26
- package/dist/lib-cjs/api/classes/eventBroadcaster.js +49 -49
- package/dist/lib-cjs/api/classes/parameter.d.ts +339 -339
- package/dist/lib-cjs/api/classes/parameter.js +464 -464
- package/dist/lib-cjs/api/classes/parameterObservable.d.ts +36 -36
- package/dist/lib-cjs/api/classes/parameterObservable.js +97 -97
- package/dist/lib-cjs/api/classes/parameterizable.d.ts +15 -15
- package/dist/lib-cjs/api/classes/parameterizable.js +102 -102
- package/dist/lib-cjs/api/classes/placementAnimation.d.ts +45 -45
- package/dist/lib-cjs/api/classes/placementAnimation.js +176 -176
- package/dist/lib-cjs/api/classes/variant.d.ts +234 -234
- package/dist/lib-cjs/api/classes/variant.js +836 -836
- package/dist/lib-cjs/api/classes/variantInstance.d.ts +44 -44
- package/dist/lib-cjs/api/classes/variantInstance.js +105 -105
- package/dist/lib-cjs/api/classes/variantParameterizable.d.ts +17 -17
- package/dist/lib-cjs/api/classes/variantParameterizable.js +88 -88
- package/dist/lib-cjs/api/classes/viewer.d.ts +187 -189
- package/dist/lib-cjs/api/classes/viewer.js +594 -594
- package/dist/lib-cjs/api/classes/viewer.js.map +1 -1
- package/dist/lib-cjs/api/classes/viewerLight.d.ts +66 -66
- package/dist/lib-cjs/api/classes/viewerLight.js +348 -348
- package/dist/lib-cjs/api/internal/lensRendering.d.ts +8 -8
- package/dist/lib-cjs/api/internal/lensRendering.js +11 -11
- package/dist/lib-cjs/api/internal/sceneSetup.d.ts +13 -13
- package/dist/lib-cjs/api/internal/sceneSetup.js +226 -226
- package/dist/lib-cjs/api/manager/animationManager.d.ts +30 -30
- package/dist/lib-cjs/api/manager/animationManager.js +126 -126
- package/dist/lib-cjs/api/manager/gltfExportManager.d.ts +78 -65
- package/dist/lib-cjs/api/manager/gltfExportManager.js +241 -197
- package/dist/lib-cjs/api/manager/gltfExportManager.js.map +1 -1
- package/dist/lib-cjs/api/manager/sceneManager.d.ts +33 -31
- package/dist/lib-cjs/api/manager/sceneManager.js +130 -127
- package/dist/lib-cjs/api/manager/sceneManager.js.map +1 -1
- package/dist/lib-cjs/api/manager/textureLoadManager.d.ts +22 -0
- package/dist/lib-cjs/api/manager/textureLoadManager.js +98 -0
- package/dist/lib-cjs/api/manager/textureLoadManager.js.map +1 -0
- package/dist/lib-cjs/api/manager/variantInstanceManager.d.ts +92 -92
- package/dist/lib-cjs/api/manager/variantInstanceManager.js +260 -260
- package/dist/lib-cjs/api/store/specStorage.d.ts +24 -24
- package/dist/lib-cjs/api/store/specStorage.js +50 -50
- package/dist/lib-cjs/api/util/babylonHelper.d.ts +183 -174
- package/dist/lib-cjs/api/util/babylonHelper.js +596 -585
- package/dist/lib-cjs/api/util/babylonHelper.js.map +1 -1
- package/dist/lib-cjs/api/util/globalTypes.d.ts +383 -370
- package/dist/lib-cjs/api/util/globalTypes.js +1 -1
- package/dist/lib-cjs/api/util/resourceHelper.d.ts +58 -58
- package/dist/lib-cjs/api/util/resourceHelper.js +203 -203
- package/dist/lib-cjs/api/util/sceneLoaderHelper.d.ts +42 -35
- package/dist/lib-cjs/api/util/sceneLoaderHelper.js +139 -139
- package/dist/lib-cjs/api/util/sceneLoaderHelper.js.map +1 -1
- package/dist/lib-cjs/api/util/stringHelper.d.ts +9 -9
- package/dist/lib-cjs/api/util/stringHelper.js +25 -25
- package/dist/lib-cjs/api/util/structureHelper.d.ts +9 -9
- package/dist/lib-cjs/api/util/structureHelper.js +48 -48
- package/dist/lib-cjs/buildinfo.json +3 -3
- package/dist/lib-cjs/commonjs.tsconfig.tsbuildinfo +1 -1
- package/dist/lib-cjs/index.d.ts +51 -51
- package/dist/lib-cjs/index.js +110 -110
- package/dist/webpack-stats.json +0 -0
- package/package.json +79 -79
- package/src/api/classes/animationInterface.ts +10 -10
- package/src/api/classes/dottedPath.ts +181 -181
- package/src/api/classes/element.ts +717 -717
- package/src/api/classes/event.ts +385 -367
- package/src/api/classes/eventBroadcaster.ts +52 -52
- package/src/api/classes/parameter.ts +497 -497
- package/src/api/classes/parameterObservable.ts +100 -100
- package/src/api/classes/parameterizable.ts +87 -87
- package/src/api/classes/placementAnimation.ts +162 -162
- package/src/api/classes/variant.ts +904 -904
- package/src/api/classes/variantInstance.ts +97 -97
- package/src/api/classes/variantParameterizable.ts +85 -85
- package/src/api/classes/viewer.ts +672 -670
- package/src/api/classes/viewerLight.ts +339 -339
- package/src/api/internal/debugViewer.ts +90 -90
- package/src/api/internal/lensRendering.ts +9 -9
- package/src/api/internal/sceneSetup.ts +205 -205
- package/src/api/manager/animationManager.ts +143 -143
- package/src/api/manager/gltfExportManager.ts +236 -192
- package/src/api/manager/sceneManager.ts +132 -127
- package/src/api/manager/textureLoadManager.ts +95 -0
- package/src/api/manager/variantInstanceManager.ts +265 -265
- package/src/api/store/specStorage.ts +51 -51
- package/src/api/util/babylonHelper.ts +658 -645
- package/src/api/util/globalTypes.ts +432 -417
- package/src/api/util/resourceHelper.ts +191 -191
- package/src/api/util/sceneLoaderHelper.ts +137 -144
- package/src/api/util/stringHelper.ts +23 -23
- package/src/api/util/structureHelper.ts +49 -49
- package/src/buildinfo.json +3 -3
- package/src/dev.ts +61 -61
- package/src/index.ts +96 -96
- package/src/types.d.ts +28 -28
- package/dist/lib-es6/api/classes/animationInterface.d.ts +0 -8
- package/dist/lib-es6/api/classes/animationInterface.js +0 -2
- package/dist/lib-es6/api/classes/animationInterface.js.map +0 -1
- package/dist/lib-es6/api/classes/dottedPath.d.ts +0 -79
- package/dist/lib-es6/api/classes/dottedPath.js +0 -163
- package/dist/lib-es6/api/classes/dottedPath.js.map +0 -1
- package/dist/lib-es6/api/classes/element.d.ts +0 -149
- package/dist/lib-es6/api/classes/element.js +0 -666
- package/dist/lib-es6/api/classes/element.js.map +0 -1
- package/dist/lib-es6/api/classes/event.d.ts +0 -326
- package/dist/lib-es6/api/classes/event.js +0 -346
- package/dist/lib-es6/api/classes/event.js.map +0 -1
- package/dist/lib-es6/api/classes/eventBroadcaster.d.ts +0 -26
- package/dist/lib-es6/api/classes/eventBroadcaster.js +0 -43
- package/dist/lib-es6/api/classes/eventBroadcaster.js.map +0 -1
- package/dist/lib-es6/api/classes/parameter.d.ts +0 -339
- package/dist/lib-es6/api/classes/parameter.js +0 -461
- package/dist/lib-es6/api/classes/parameter.js.map +0 -1
- package/dist/lib-es6/api/classes/parameterObservable.d.ts +0 -36
- package/dist/lib-es6/api/classes/parameterObservable.js +0 -94
- package/dist/lib-es6/api/classes/parameterObservable.js.map +0 -1
- package/dist/lib-es6/api/classes/parameterizable.d.ts +0 -15
- package/dist/lib-es6/api/classes/parameterizable.js +0 -99
- package/dist/lib-es6/api/classes/parameterizable.js.map +0 -1
- package/dist/lib-es6/api/classes/placementAnimation.d.ts +0 -45
- package/dist/lib-es6/api/classes/placementAnimation.js +0 -173
- package/dist/lib-es6/api/classes/placementAnimation.js.map +0 -1
- package/dist/lib-es6/api/classes/variant.d.ts +0 -234
- package/dist/lib-es6/api/classes/variant.js +0 -833
- package/dist/lib-es6/api/classes/variant.js.map +0 -1
- package/dist/lib-es6/api/classes/variantInstance.d.ts +0 -44
- package/dist/lib-es6/api/classes/variantInstance.js +0 -102
- package/dist/lib-es6/api/classes/variantInstance.js.map +0 -1
- package/dist/lib-es6/api/classes/variantParameterizable.d.ts +0 -17
- package/dist/lib-es6/api/classes/variantParameterizable.js +0 -85
- package/dist/lib-es6/api/classes/variantParameterizable.js.map +0 -1
- package/dist/lib-es6/api/classes/viewer.d.ts +0 -189
- package/dist/lib-es6/api/classes/viewer.js +0 -588
- package/dist/lib-es6/api/classes/viewer.js.map +0 -1
- package/dist/lib-es6/api/classes/viewerLight.d.ts +0 -66
- package/dist/lib-es6/api/classes/viewerLight.js +0 -322
- package/dist/lib-es6/api/classes/viewerLight.js.map +0 -1
- package/dist/lib-es6/api/internal/lensRendering.d.ts +0 -8
- package/dist/lib-es6/api/internal/lensRendering.js +0 -9
- package/dist/lib-es6/api/internal/lensRendering.js.map +0 -1
- package/dist/lib-es6/api/internal/sceneSetup.d.ts +0 -13
- package/dist/lib-es6/api/internal/sceneSetup.js +0 -199
- package/dist/lib-es6/api/internal/sceneSetup.js.map +0 -1
- package/dist/lib-es6/api/manager/animationManager.d.ts +0 -30
- package/dist/lib-es6/api/manager/animationManager.js +0 -123
- package/dist/lib-es6/api/manager/animationManager.js.map +0 -1
- package/dist/lib-es6/api/manager/gltfExportManager.d.ts +0 -65
- package/dist/lib-es6/api/manager/gltfExportManager.js +0 -194
- package/dist/lib-es6/api/manager/gltfExportManager.js.map +0 -1
- package/dist/lib-es6/api/manager/sceneManager.d.ts +0 -31
- package/dist/lib-es6/api/manager/sceneManager.js +0 -124
- package/dist/lib-es6/api/manager/sceneManager.js.map +0 -1
- package/dist/lib-es6/api/manager/variantInstanceManager.d.ts +0 -92
- package/dist/lib-es6/api/manager/variantInstanceManager.js +0 -257
- package/dist/lib-es6/api/manager/variantInstanceManager.js.map +0 -1
- package/dist/lib-es6/api/store/specStorage.d.ts +0 -24
- package/dist/lib-es6/api/store/specStorage.js +0 -47
- package/dist/lib-es6/api/store/specStorage.js.map +0 -1
- package/dist/lib-es6/api/util/babylonHelper.d.ts +0 -174
- package/dist/lib-es6/api/util/babylonHelper.js +0 -556
- package/dist/lib-es6/api/util/babylonHelper.js.map +0 -1
- package/dist/lib-es6/api/util/globalTypes.d.ts +0 -370
- package/dist/lib-es6/api/util/globalTypes.js +0 -2
- package/dist/lib-es6/api/util/globalTypes.js.map +0 -1
- package/dist/lib-es6/api/util/resourceHelper.d.ts +0 -58
- package/dist/lib-es6/api/util/resourceHelper.js +0 -194
- package/dist/lib-es6/api/util/resourceHelper.js.map +0 -1
- package/dist/lib-es6/api/util/sceneLoaderHelper.d.ts +0 -35
- package/dist/lib-es6/api/util/sceneLoaderHelper.js +0 -130
- package/dist/lib-es6/api/util/sceneLoaderHelper.js.map +0 -1
- package/dist/lib-es6/api/util/stringHelper.d.ts +0 -9
- package/dist/lib-es6/api/util/stringHelper.js +0 -22
- package/dist/lib-es6/api/util/stringHelper.js.map +0 -1
- package/dist/lib-es6/api/util/structureHelper.d.ts +0 -9
- package/dist/lib-es6/api/util/structureHelper.js +0 -46
- package/dist/lib-es6/api/util/structureHelper.js.map +0 -1
- package/dist/lib-es6/buildinfo.json +0 -3
- package/dist/lib-es6/es6.tsconfig.tsbuildinfo +0 -1
- package/dist/lib-es6/index.d.ts +0 -51
- package/dist/lib-es6/index.js +0 -49
- package/dist/lib-es6/index.js.map +0 -1
|
@@ -1,99 +0,0 @@
|
|
|
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 { Parameter } from './parameter';
|
|
11
|
-
import { ParameterObservable } from './parameterObservable';
|
|
12
|
-
export class Parameterizable extends ParameterObservable {
|
|
13
|
-
constructor() {
|
|
14
|
-
super(...arguments);
|
|
15
|
-
this.parameterDeclaration = Parameter.declarations;
|
|
16
|
-
}
|
|
17
|
-
get visible() {
|
|
18
|
-
if (!(Parameter.VISIBLE in this.parameters)) {
|
|
19
|
-
return undefined;
|
|
20
|
-
}
|
|
21
|
-
try {
|
|
22
|
-
return Parameter.parseBoolean(this.parameters[Parameter.VISIBLE]);
|
|
23
|
-
}
|
|
24
|
-
catch (e) {
|
|
25
|
-
return undefined;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
get highlighted() {
|
|
29
|
-
if (!(Parameter.HIGHLIGHTED in this.parameters)) {
|
|
30
|
-
return undefined;
|
|
31
|
-
}
|
|
32
|
-
try {
|
|
33
|
-
return Parameter.parseBoolean(this.parameters[Parameter.HIGHLIGHTED]);
|
|
34
|
-
}
|
|
35
|
-
catch (e) {
|
|
36
|
-
return undefined;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
get material() {
|
|
40
|
-
if (!(Parameter.MATERIAL in this.parameters)) {
|
|
41
|
-
return undefined;
|
|
42
|
-
}
|
|
43
|
-
return this.parameters[Parameter.MATERIAL].toString();
|
|
44
|
-
}
|
|
45
|
-
get scaling() {
|
|
46
|
-
if (!(Parameter.SCALING in this.parameters)) {
|
|
47
|
-
return undefined;
|
|
48
|
-
}
|
|
49
|
-
return this.parameters[Parameter.SCALING].toString();
|
|
50
|
-
}
|
|
51
|
-
get position() {
|
|
52
|
-
if (!(Parameter.POSITION in this.parameters)) {
|
|
53
|
-
return undefined;
|
|
54
|
-
}
|
|
55
|
-
return this.parameters[Parameter.POSITION].toString();
|
|
56
|
-
}
|
|
57
|
-
get rotation() {
|
|
58
|
-
if (!(Parameter.ROTATION in this.parameters)) {
|
|
59
|
-
return undefined;
|
|
60
|
-
}
|
|
61
|
-
return this.parameters[Parameter.ROTATION].toString();
|
|
62
|
-
}
|
|
63
|
-
get castShadow() {
|
|
64
|
-
if (!(Parameter.CAST_SHADOW in this.parameters)) {
|
|
65
|
-
return undefined;
|
|
66
|
-
}
|
|
67
|
-
try {
|
|
68
|
-
return Parameter.parseBoolean(this.parameters[Parameter.CAST_SHADOW]);
|
|
69
|
-
}
|
|
70
|
-
catch (e) {
|
|
71
|
-
return undefined;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
show() {
|
|
75
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
-
yield this.commitParameter(Parameter.VISIBLE, true);
|
|
77
|
-
return this;
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
hide() {
|
|
81
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
-
yield this.commitParameter(Parameter.VISIBLE, false);
|
|
83
|
-
return this;
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
toggle() {
|
|
87
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
-
yield this.commitParameter(Parameter.VISIBLE, !this.visible);
|
|
89
|
-
return this;
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
toggleHighlight() {
|
|
93
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
-
yield this.commitParameter(Parameter.HIGHLIGHTED, !this.highlighted);
|
|
95
|
-
return this;
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
//# sourceMappingURL=parameterizable.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parameterizable.js","sourceRoot":"","sources":["../../../../src/api/classes/parameterizable.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,OAAgB,eAAgB,SAAQ,mBAAmB;IAAjE;;QACY,yBAAoB,GAA0B,SAAS,CAAC,YAAY,CAAC;IAkFjF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ationInterface';
|
|
3
|
-
/**
|
|
4
|
-
* An {@link PlacementAnimation} handling `Tweens` of the `GSAP` API using configured {@link PlacementDefinition}s
|
|
5
|
-
* and {@link AnimationDefinition}s. It mutates the attributes in the given {@link PlacementDefinition} with the given
|
|
6
|
-
* {@link AnimationDefinition}. The latter can be anything the `GSAP` allows in its API. Please consider using the
|
|
7
|
-
* API of the {@link AnimationManager} to handle instances of this class in your consuming project.
|
|
8
|
-
*/
|
|
9
|
-
export declare class PlacementAnimation implements AnimationInterface {
|
|
10
|
-
readonly mutable: object;
|
|
11
|
-
protected _placement: PlacementDefinition | string;
|
|
12
|
-
protected _animation?: string | AnimationDefinition | undefined;
|
|
13
|
-
protected _placementDefinition: PlacementDefinition;
|
|
14
|
-
protected _animationDefinition: AnimationDefinition;
|
|
15
|
-
protected _timeline: GSAPTimeline;
|
|
16
|
-
/**
|
|
17
|
-
* Constructor.
|
|
18
|
-
*/
|
|
19
|
-
constructor(mutable: object, _placement: PlacementDefinition | string, _animation?: string | AnimationDefinition | undefined);
|
|
20
|
-
/**
|
|
21
|
-
* Plays all `Tweens` of this {@link PlacementAnimation}.
|
|
22
|
-
*/
|
|
23
|
-
play(): Promise<AnimationInterface>;
|
|
24
|
-
/**
|
|
25
|
-
* Pause all `Tweens` of this {@link PlacementAnimation}.
|
|
26
|
-
*/
|
|
27
|
-
pause(): AnimationInterface;
|
|
28
|
-
/**
|
|
29
|
-
* Kills all `Tweens` of this {@link PlacementAnimation}.
|
|
30
|
-
*/
|
|
31
|
-
kill(): AnimationInterface;
|
|
32
|
-
/**
|
|
33
|
-
* Creates a {@link AnimationDefinition} definition if not provided in the constructor and sets some defaults.
|
|
34
|
-
* Only custom properties from {@link AnimationDefinition} are adjusted, all {@link GSAPTweenVars} remain untouched.
|
|
35
|
-
*/
|
|
36
|
-
protected prepareAnimationDefinition(): void;
|
|
37
|
-
/**
|
|
38
|
-
* Prepares different types of {@link PlacementDefinition} and sets some defaults.
|
|
39
|
-
*/
|
|
40
|
-
protected preparePlacementDefinition(): void;
|
|
41
|
-
/**
|
|
42
|
-
* Creates `Tweens` for the {@link PlacementDefinition} configured for this {@link PlacementAnimation}.
|
|
43
|
-
*/
|
|
44
|
-
protected createTweens(): void;
|
|
45
|
-
}
|
|
@@ -1,173 +0,0 @@
|
|
|
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
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
11
|
-
var t = {};
|
|
12
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
13
|
-
t[p] = s[p];
|
|
14
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
15
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
16
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
17
|
-
t[p[i]] = s[p[i]];
|
|
18
|
-
}
|
|
19
|
-
return t;
|
|
20
|
-
};
|
|
21
|
-
import { Parameter } from '../classes/parameter';
|
|
22
|
-
import { SpecStorage } from '../store/specStorage';
|
|
23
|
-
import { ArcRotateCamera } from '@babylonjs/core/Cameras/arcRotateCamera';
|
|
24
|
-
import { Vector3 } from '@babylonjs/core/Maths/math.vector';
|
|
25
|
-
import { gsap } from 'gsap';
|
|
26
|
-
import { cloneDeep, get, isString, merge, set } from 'lodash-es';
|
|
27
|
-
/**
|
|
28
|
-
* An {@link PlacementAnimation} handling `Tweens` of the `GSAP` API using configured {@link PlacementDefinition}s
|
|
29
|
-
* and {@link AnimationDefinition}s. It mutates the attributes in the given {@link PlacementDefinition} with the given
|
|
30
|
-
* {@link AnimationDefinition}. The latter can be anything the `GSAP` allows in its API. Please consider using the
|
|
31
|
-
* API of the {@link AnimationManager} to handle instances of this class in your consuming project.
|
|
32
|
-
*/
|
|
33
|
-
export class PlacementAnimation {
|
|
34
|
-
/**
|
|
35
|
-
* Constructor.
|
|
36
|
-
*/
|
|
37
|
-
constructor(mutable, _placement, _animation) {
|
|
38
|
-
var _a;
|
|
39
|
-
this.mutable = mutable;
|
|
40
|
-
this._placement = _placement;
|
|
41
|
-
this._animation = _animation;
|
|
42
|
-
if (isString(_placement)) {
|
|
43
|
-
const placementDefinitions = SpecStorage.get('scene.placements');
|
|
44
|
-
if (!placementDefinitions) {
|
|
45
|
-
throw new Error(`No PlacementDefinitions defined in JSON structure.`);
|
|
46
|
-
}
|
|
47
|
-
const placementDefinition = placementDefinitions[_placement];
|
|
48
|
-
if (!placementDefinition) {
|
|
49
|
-
throw new Error(`PlacementDefinition "${_placement}" not defined in JSON structure.`);
|
|
50
|
-
}
|
|
51
|
-
this._placementDefinition = cloneDeep(placementDefinition);
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
this._placementDefinition = cloneDeep(_placement);
|
|
55
|
-
}
|
|
56
|
-
if (isString(_animation)) {
|
|
57
|
-
const animationDefinition = (_a = SpecStorage.get('scene.animations')) === null || _a === void 0 ? void 0 : _a[_animation];
|
|
58
|
-
if (!animationDefinition) {
|
|
59
|
-
throw new Error(`AnimationDefinition "${_animation}" not defined in JSON structure.`);
|
|
60
|
-
}
|
|
61
|
-
this._animationDefinition = cloneDeep(animationDefinition);
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
this._animationDefinition = cloneDeep(_animation);
|
|
65
|
-
}
|
|
66
|
-
this.prepareAnimationDefinition();
|
|
67
|
-
// create (shallow) copy for GSAP which doesn't contain `shortestWay`,
|
|
68
|
-
// because that's not part of the original `TweenVars` input typing and therefore leads to warnings
|
|
69
|
-
const _b = this._animationDefinition, { shortestWay } = _b, gsapTweenVars = __rest(_b, ["shortestWay"]);
|
|
70
|
-
this._timeline = gsap.timeline({
|
|
71
|
-
defaults: gsapTweenVars,
|
|
72
|
-
paused: true,
|
|
73
|
-
});
|
|
74
|
-
this.preparePlacementDefinition();
|
|
75
|
-
this.createTweens();
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Plays all `Tweens` of this {@link PlacementAnimation}.
|
|
79
|
-
*/
|
|
80
|
-
play() {
|
|
81
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
-
yield this._timeline.play().then();
|
|
83
|
-
return this;
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Pause all `Tweens` of this {@link PlacementAnimation}.
|
|
88
|
-
*/
|
|
89
|
-
pause() {
|
|
90
|
-
this._timeline.pause();
|
|
91
|
-
return this;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Kills all `Tweens` of this {@link PlacementAnimation}.
|
|
95
|
-
*/
|
|
96
|
-
kill() {
|
|
97
|
-
this._timeline.kill();
|
|
98
|
-
return this;
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Creates a {@link AnimationDefinition} definition if not provided in the constructor and sets some defaults.
|
|
102
|
-
* Only custom properties from {@link AnimationDefinition} are adjusted, all {@link GSAPTweenVars} remain untouched.
|
|
103
|
-
*/
|
|
104
|
-
prepareAnimationDefinition() {
|
|
105
|
-
// create an animation definition if not available yet
|
|
106
|
-
this._animationDefinition = this._animationDefinition || {};
|
|
107
|
-
// parse shortest way flag or set to `true` if not configured
|
|
108
|
-
if (this._animationDefinition.shortestWay !== undefined) {
|
|
109
|
-
this._animationDefinition.shortestWay = Parameter.parseBoolean(this._animationDefinition.shortestWay);
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
this._animationDefinition.shortestWay = true;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Prepares different types of {@link PlacementDefinition} and sets some defaults.
|
|
117
|
-
*/
|
|
118
|
-
preparePlacementDefinition() {
|
|
119
|
-
let position = this._placementDefinition.position;
|
|
120
|
-
if (isString(position)) {
|
|
121
|
-
position = Parameter.parseVector(position);
|
|
122
|
-
this._placementDefinition.position = position;
|
|
123
|
-
}
|
|
124
|
-
if (this.mutable instanceof ArcRotateCamera) {
|
|
125
|
-
// parse the target
|
|
126
|
-
if (isString(this._placementDefinition.target)) {
|
|
127
|
-
this._placementDefinition.target = Parameter.parseVector(this._placementDefinition.target);
|
|
128
|
-
}
|
|
129
|
-
if (position) {
|
|
130
|
-
// parse the position and calculate alpha, beta and radius with a "ghost camera"
|
|
131
|
-
// @see https://www.babylonjs-playground.com/#4IVMG#0
|
|
132
|
-
const ghostCam = this.mutable.clone('ghost');
|
|
133
|
-
ghostCam.setPosition(position);
|
|
134
|
-
merge(this._placementDefinition, {
|
|
135
|
-
alpha: ghostCam.alpha,
|
|
136
|
-
beta: ghostCam.beta,
|
|
137
|
-
radius: ghostCam.radius,
|
|
138
|
-
});
|
|
139
|
-
delete this._placementDefinition.position;
|
|
140
|
-
ghostCam.dispose();
|
|
141
|
-
}
|
|
142
|
-
else if (this._animationDefinition.shortestWay && this._placementDefinition.alpha !== undefined) {
|
|
143
|
-
// transform the target's alpha value into the same turn as the current camera position to avoid movements
|
|
144
|
-
// > 360 degrees
|
|
145
|
-
const alphaGap = this.mutable.alpha - this._placementDefinition.alpha;
|
|
146
|
-
const cntTurns = Math.round(alphaGap / (2 * Math.PI));
|
|
147
|
-
this._placementDefinition.alpha += 2 * Math.PI * cntTurns;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Creates `Tweens` for the {@link PlacementDefinition} configured for this {@link PlacementAnimation}.
|
|
153
|
-
*/
|
|
154
|
-
createTweens() {
|
|
155
|
-
for (const property in this._placementDefinition) {
|
|
156
|
-
const propertyValue = get(this._placementDefinition, property);
|
|
157
|
-
const tweenVars = {};
|
|
158
|
-
let _mutable = this.mutable;
|
|
159
|
-
if (propertyValue instanceof Vector3) {
|
|
160
|
-
// GSAP does not support mutation of complex objects, so we are forced
|
|
161
|
-
// to use the properties on the object as mutable directly and mutate
|
|
162
|
-
// the coordinates separately.
|
|
163
|
-
_mutable = get(this.mutable, property);
|
|
164
|
-
merge(tweenVars, { x: propertyValue.x, y: propertyValue.y, z: propertyValue.z });
|
|
165
|
-
}
|
|
166
|
-
else {
|
|
167
|
-
set(tweenVars, property, propertyValue);
|
|
168
|
-
}
|
|
169
|
-
this._timeline.to(_mutable, tweenVars, 0); // Note: position 0 does the "parallel" stuff here
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
//# sourceMappingURL=placementAnimation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"placementAnimation.js","sourceRoot":"","sources":["../../../../src/api/classes/placementAnimation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,OAAO,kBAAkB;IAO7B;;OAEG;IACH,YACkB,OAAe,EACrB,UAAwC,EACxC,UAAyC;;QAFnC,Y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,CAAC,oBAAoB,EAAE,QAAQ,CAAC,CAAC;YAC/D,MAAM,SAAS,GAAW,EAAE,CAAC;YAC7B,IAAI,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC;YAC5B,IAAI,aAAa,YAAY,OAAO,EAAE;gBACpC,sEAAsE;gBACtE,qEAAqE;gBACrE,8BAA8B;gBAC9B,QAAQ,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;gBACvC,KAAK,CAAC,SAAS,EAAE,EAAE,CAAC,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC;aAClF;iBAAM;gBACL,GAAG,CAAC,SAAS,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC;aACzC;YACD,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,kDAAkD;SAC9F;IACH,CAAC;CACF"}
|
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
import { DottedPath } from './dottedPath';
|
|
2
|
-
import { Element } from './element';
|
|
3
|
-
import { ParameterObservable } from './parameterObservable';
|
|
4
|
-
import { Parameterizable } from './parameterizable';
|
|
5
|
-
import { VariantParameterizable } from './variantParameterizable';
|
|
6
|
-
import { Viewer } from './viewer';
|
|
7
|
-
import { ViewerLight } from './viewerLight';
|
|
8
|
-
import { Light } from '@babylonjs/core/Lights/light';
|
|
9
|
-
import '@babylonjs/core/Loading/Plugins/babylonFileLoader';
|
|
10
|
-
import { Material } from '@babylonjs/core/Materials/material';
|
|
11
|
-
import { Mesh } from '@babylonjs/core/Meshes/mesh';
|
|
12
|
-
import { TransformNode } from '@babylonjs/core/Meshes/transformNode';
|
|
13
|
-
import { AssetContainer } from '@babylonjs/core/assetContainer';
|
|
14
|
-
import '@babylonjs/loaders/glTF/2.0/Extensions/KHR_draco_mesh_compression';
|
|
15
|
-
import '@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_clearcoat';
|
|
16
|
-
import '@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_ior';
|
|
17
|
-
import '@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_pbrSpecularGlossiness';
|
|
18
|
-
import '@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_sheen';
|
|
19
|
-
import '@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_specular';
|
|
20
|
-
import '@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_translucency';
|
|
21
|
-
import '@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_transmission';
|
|
22
|
-
import '@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_unlit';
|
|
23
|
-
import '@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_variants';
|
|
24
|
-
import '@babylonjs/loaders/glTF/2.0/Extensions/KHR_texture_basisu';
|
|
25
|
-
import '@babylonjs/loaders/glTF/2.0/Extensions/KHR_texture_transform';
|
|
26
|
-
import '@babylonjs/loaders/glTF/2.0/glTFLoader';
|
|
27
|
-
/**
|
|
28
|
-
* A concrete "Variant". Most of these are handled by either the {@link Viewer} or {@link VariantInstance}.
|
|
29
|
-
*/
|
|
30
|
-
export declare class Variant extends Parameterizable {
|
|
31
|
-
readonly name: string;
|
|
32
|
-
protected readonly _structureJson: StructureJson;
|
|
33
|
-
readonly viewer: Viewer;
|
|
34
|
-
readonly parent?: Variant | undefined;
|
|
35
|
-
assetContainer: AssetContainer;
|
|
36
|
-
readonly elements: Element[];
|
|
37
|
-
readonly viewerLights: ViewerLight[];
|
|
38
|
-
structureJson: StructureJson;
|
|
39
|
-
protected _dottedNodes: Map<DottedPath, TransformNode> | undefined;
|
|
40
|
-
protected readonly _children: Map<string, Variant>;
|
|
41
|
-
protected readonly _parameterObservers: Map<string, ParameterObserver[]>;
|
|
42
|
-
/**
|
|
43
|
-
* @internal
|
|
44
|
-
*/
|
|
45
|
-
private parametersInitialized;
|
|
46
|
-
/**
|
|
47
|
-
* Constructor.
|
|
48
|
-
*/
|
|
49
|
-
protected constructor(name: string, _structureJson: StructureJson, viewer: Viewer, parent?: Variant | undefined);
|
|
50
|
-
/**
|
|
51
|
-
* Creates a {@link Variant} based on given parameters.
|
|
52
|
-
*
|
|
53
|
-
* @throws Error if "gltf" property is provided without a filename
|
|
54
|
-
*/
|
|
55
|
-
static create(name: string, structureJson: StructureJson, viewer: Viewer, parent?: Variant): Promise<Variant>;
|
|
56
|
-
/**
|
|
57
|
-
* The ancestor {@link Variant}s ordered from top to bottom in the built tree.
|
|
58
|
-
*/
|
|
59
|
-
get ancestors(): Variant[];
|
|
60
|
-
/**
|
|
61
|
-
* The root {@link Variant}.
|
|
62
|
-
*/
|
|
63
|
-
get root(): Variant;
|
|
64
|
-
/**
|
|
65
|
-
* The {@link DottedPath} in the built tree of {@link Variant}s.
|
|
66
|
-
* E.g. "_.top-1.sub-2.sub-sub-3"
|
|
67
|
-
*/
|
|
68
|
-
get dottedPath(): DottedPath;
|
|
69
|
-
/**
|
|
70
|
-
* The id representing a {@link DottedPath}.
|
|
71
|
-
*/
|
|
72
|
-
get id(): string;
|
|
73
|
-
/**
|
|
74
|
-
* The defined glTF Asset.
|
|
75
|
-
*/
|
|
76
|
-
get glTF(): Asset | undefined;
|
|
77
|
-
/**
|
|
78
|
-
* The defined glTF URI.
|
|
79
|
-
*/
|
|
80
|
-
get glTFUri(): string | undefined;
|
|
81
|
-
/**
|
|
82
|
-
* The inherited defined glTF URI.
|
|
83
|
-
*/
|
|
84
|
-
get inheritedGlTFUri(): string | undefined;
|
|
85
|
-
/**
|
|
86
|
-
* The TransformNodes of the {@link Variant}.
|
|
87
|
-
*/
|
|
88
|
-
get nodes(): TransformNode[];
|
|
89
|
-
/**
|
|
90
|
-
* The {@link ViewerLight}s of the {@link Variant}.
|
|
91
|
-
*/
|
|
92
|
-
get lights(): Light[];
|
|
93
|
-
/**
|
|
94
|
-
* All TransformNodes of the {@link Variant} mapped flat with a {@link DottedPath}.
|
|
95
|
-
*/
|
|
96
|
-
get dottedNodes(): Map<DottedPath, TransformNode>;
|
|
97
|
-
/**
|
|
98
|
-
* The Materials of the {@link Variant}.
|
|
99
|
-
*/
|
|
100
|
-
get materials(): Material[];
|
|
101
|
-
/**
|
|
102
|
-
* All {@link Element}s from this {@link Variant}'s parents.
|
|
103
|
-
*/
|
|
104
|
-
get inheritedElements(): Element[];
|
|
105
|
-
/**
|
|
106
|
-
* All {@link ViewerLight}s inherited from this {@link Variant}'s parents.
|
|
107
|
-
*/
|
|
108
|
-
get inheritedViewerLights(): ViewerLight[];
|
|
109
|
-
/**
|
|
110
|
-
* All TransformNodes inherited from this {@link Variant}'s parents.
|
|
111
|
-
*/
|
|
112
|
-
get inheritedNodes(): TransformNode[];
|
|
113
|
-
/**
|
|
114
|
-
* All TransformNodes inherited from this {@link Variant}'s parents mapped flat with a {@link DottedPath}.
|
|
115
|
-
*/
|
|
116
|
-
get inheritedDottedNodes(): Map<DottedPath, TransformNode>;
|
|
117
|
-
/**
|
|
118
|
-
* All Lights inherited from this {@link Variant}'s parents.
|
|
119
|
-
*/
|
|
120
|
-
get inheritedLights(): Light[];
|
|
121
|
-
/**
|
|
122
|
-
* The {@link ParameterDeclarations} inherited from this {@link Variant}'s parents.
|
|
123
|
-
*/
|
|
124
|
-
get inheritedParameterDeclaration(): ParameterDeclarations;
|
|
125
|
-
/**
|
|
126
|
-
* The {@link ParameterBag} inherited from this {@link Variant}'s parents.
|
|
127
|
-
*/
|
|
128
|
-
get inheritedParameters(): ParameterBag;
|
|
129
|
-
/**
|
|
130
|
-
* All Materials from this {@link Variant}'s parents.
|
|
131
|
-
*/
|
|
132
|
-
get inheritedMaterials(): Material[];
|
|
133
|
-
/**
|
|
134
|
-
* Gets the direct children of the current {@link Variant}.
|
|
135
|
-
*/
|
|
136
|
-
getChildren(): Promise<Variant[]>;
|
|
137
|
-
/**
|
|
138
|
-
* Gets a descendant {@link Variant} of the current {@link Variant} relative to its {@link DottedPath}.
|
|
139
|
-
* If you have the dotted path `_.product_x.variant_blue.with_yellow_highlight` in a tree and you operate on the
|
|
140
|
-
* `product_x`, you can call `this.getDescendant('variant_blue.with_yellow_highlight')` to get the lowermost
|
|
141
|
-
* {@link Variant}.
|
|
142
|
-
*/
|
|
143
|
-
getDescendant(dottedPath: DottedPathArgument): Promise<Variant>;
|
|
144
|
-
/**
|
|
145
|
-
* Gets the desired {@link Element} of the current {@link Variant} relative to its {@link DottedPath}.
|
|
146
|
-
* Uses the mechanism of {@link getDescendant} to resolve the appropriate variant in tree.
|
|
147
|
-
*/
|
|
148
|
-
getElement(dottedPath: DottedPathArgument): Promise<Element>;
|
|
149
|
-
/**
|
|
150
|
-
* Gets the desired {@link ViewerLight} of the current {@link Variant} relative to its {@link DottedPath}.
|
|
151
|
-
* Uses the mechanism of {@link getDescendant} to resolve the appropriate variant in tree.
|
|
152
|
-
*/
|
|
153
|
-
getViewerLight(dottedPath: DottedPathArgument): Promise<ViewerLight>;
|
|
154
|
-
/**
|
|
155
|
-
* A proxy for directly getting a Node from an {@link Element} by its {@link DottedPath}s.
|
|
156
|
-
*/
|
|
157
|
-
getNode(elementDottedPath: DottedPathArgument, nodeDottedPath: DottedPathArgument): Promise<TransformNode>;
|
|
158
|
-
/**
|
|
159
|
-
* A proxy for directly getting a Mesh from an {@link Element} by its {@link DottedPath}s.
|
|
160
|
-
*/
|
|
161
|
-
getMesh(elementDottedPath: DottedPathArgument, meshDottedPath: DottedPathArgument): Promise<Mesh | null>;
|
|
162
|
-
/**
|
|
163
|
-
* Gets the Material defined in one of the variants glTFs by its id.
|
|
164
|
-
*/
|
|
165
|
-
getOrCreateMaterial(id: string): Material;
|
|
166
|
-
/**
|
|
167
|
-
* Creates a living clone of this {@link Variant}. Will clone all parent {@link Variant}s in tree.
|
|
168
|
-
*
|
|
169
|
-
* @emit {@link Event.VARIANT_CREATED}
|
|
170
|
-
* @ignore
|
|
171
|
-
*/
|
|
172
|
-
createLiving(parameters?: ParameterBag): Promise<Variant>;
|
|
173
|
-
/**
|
|
174
|
-
* Destroys this {@link Variant}, all parents and destroy the {@link Element}s.
|
|
175
|
-
*/
|
|
176
|
-
destroy(): Variant;
|
|
177
|
-
/**
|
|
178
|
-
* Places the given {@link ParameterBag} in the {@link Variant}'s parameters, replaces all patterns in the
|
|
179
|
-
* {@link StructureJson}, broadcasts all {@link ParameterObserver}s and delegates them to its {@link Element}s.
|
|
180
|
-
*
|
|
181
|
-
* @emit {@link Event.VARIANT_PARAMETER_COMMITTED}
|
|
182
|
-
*/
|
|
183
|
-
commitParameters(parameters?: ParameterBag): Promise<Variant>;
|
|
184
|
-
/**
|
|
185
|
-
* Adds an observer function for camera matrix changes for given `dottedPath` representing the {@link Element}
|
|
186
|
-
* and the `traceable`. The `observer` gets 2 parameters: the `AbstractMesh` and a `ClientRect` object.
|
|
187
|
-
*/
|
|
188
|
-
addTraceableObserver(dottedPath: DottedPathArgument, observer: CallableFunction, payload?: any): Promise<Element>;
|
|
189
|
-
/**
|
|
190
|
-
* Loads {@link glTFUri} with assets, adds them to the {@link Variant}'s `assetContainer` and deactivates the meshes.
|
|
191
|
-
* (for further processing).
|
|
192
|
-
* @emits {@link Event.ASSET_LOADING_START}
|
|
193
|
-
* @emits {@link Event.ASSET_LOADING_END}
|
|
194
|
-
*/
|
|
195
|
-
protected loadAssets(): Promise<Variant>;
|
|
196
|
-
/**
|
|
197
|
-
* Commits given parameters to all {@link Element}s.
|
|
198
|
-
*/
|
|
199
|
-
protected commitParametersToElements(parameters: ParameterBag): Promise<void>;
|
|
200
|
-
/**
|
|
201
|
-
* Commits given parameters to all {@link ViewerLight}s.
|
|
202
|
-
*/
|
|
203
|
-
protected commitParametersToViewerLights(parameters: ParameterBag): Promise<void>;
|
|
204
|
-
/**
|
|
205
|
-
* Commits given parameters to a {@link VariantParameterizable} and updates the according definition with given
|
|
206
|
-
* key in the {@link StructureJson}. The `definitionKey` "elements" for example will update the definition in
|
|
207
|
-
* `this.structureJson.elements`.
|
|
208
|
-
*/
|
|
209
|
-
protected commitParametersToVariantParameterizable(parameters: ParameterBag, parameterizable: VariantParameterizable, definitionKey: string): Promise<ParameterObservable>;
|
|
210
|
-
/**
|
|
211
|
-
* Commits given {@link Parameter} to the {@link Variant}'s {@link Element}s.
|
|
212
|
-
*/
|
|
213
|
-
protected commitParameterToElements(parameter: string, value: ParameterValue): Promise<Variant>;
|
|
214
|
-
/**
|
|
215
|
-
* Commits given {@link Parameter} to the {@link Variant}'s {@link Element}s.
|
|
216
|
-
*/
|
|
217
|
-
protected commitParameterToViewerLights(parameter: string, value: ParameterValue): Promise<Variant>;
|
|
218
|
-
/**
|
|
219
|
-
* Adds the default {@link ParameterObserver}s which are called every time {@link commitParameters} is called.
|
|
220
|
-
*/
|
|
221
|
-
protected addParameterObservers(): Variant;
|
|
222
|
-
/**
|
|
223
|
-
* Creates {@link Element}s and clones nodes into them.
|
|
224
|
-
*/
|
|
225
|
-
protected createElements(): Promise<Variant>;
|
|
226
|
-
/**
|
|
227
|
-
* Creates {@link ViewerLight}s.
|
|
228
|
-
*/
|
|
229
|
-
protected createViewerLights(): Promise<Variant>;
|
|
230
|
-
/**
|
|
231
|
-
* Bootstrapping for parameters. It sets the `parametersInitialized` to true for all ancestors.
|
|
232
|
-
*/
|
|
233
|
-
protected bootstrapParameters(parameters?: ParameterBag): Promise<Variant>;
|
|
234
|
-
}
|