@combeenation/3d-viewer 4.0.0-beta1 → 4.0.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.
Files changed (57) hide show
  1. package/README.md +1 -0
  2. package/dist/lib-cjs/api/classes/element.d.ts +12 -16
  3. package/dist/lib-cjs/api/classes/element.js +129 -194
  4. package/dist/lib-cjs/api/classes/element.js.map +1 -1
  5. package/dist/lib-cjs/api/classes/event.d.ts +1 -15
  6. package/dist/lib-cjs/api/classes/event.js +1 -15
  7. package/dist/lib-cjs/api/classes/event.js.map +1 -1
  8. package/dist/lib-cjs/api/classes/parameter.d.ts +7 -101
  9. package/dist/lib-cjs/api/classes/parameter.js +21 -141
  10. package/dist/lib-cjs/api/classes/parameter.js.map +1 -1
  11. package/dist/lib-cjs/api/classes/parameterObservable.js +36 -11
  12. package/dist/lib-cjs/api/classes/parameterObservable.js.map +1 -1
  13. package/dist/lib-cjs/api/classes/placementAnimation.d.ts +2 -2
  14. package/dist/lib-cjs/api/classes/placementAnimation.js +0 -11
  15. package/dist/lib-cjs/api/classes/placementAnimation.js.map +1 -1
  16. package/dist/lib-cjs/api/classes/variant.d.ts +14 -48
  17. package/dist/lib-cjs/api/classes/variant.js +56 -320
  18. package/dist/lib-cjs/api/classes/variant.js.map +1 -1
  19. package/dist/lib-cjs/api/classes/variantInstance.d.ts +1 -5
  20. package/dist/lib-cjs/api/classes/variantInstance.js +0 -10
  21. package/dist/lib-cjs/api/classes/variantInstance.js.map +1 -1
  22. package/dist/lib-cjs/api/classes/viewer.d.ts +3 -6
  23. package/dist/lib-cjs/api/classes/viewer.js +59 -133
  24. package/dist/lib-cjs/api/classes/viewer.js.map +1 -1
  25. package/dist/lib-cjs/api/internal/sceneSetup.d.ts +1 -5
  26. package/dist/lib-cjs/api/internal/sceneSetup.js +71 -75
  27. package/dist/lib-cjs/api/internal/sceneSetup.js.map +1 -1
  28. package/dist/lib-cjs/api/util/babylonHelper.d.ts +4 -54
  29. package/dist/lib-cjs/api/util/babylonHelper.js +8 -160
  30. package/dist/lib-cjs/api/util/babylonHelper.js.map +1 -1
  31. package/dist/lib-cjs/api/util/globalTypes.d.ts +12 -62
  32. package/dist/lib-cjs/api/util/resourceHelper.d.ts +8 -8
  33. package/dist/lib-cjs/api/util/resourceHelper.js +24 -63
  34. package/dist/lib-cjs/api/util/resourceHelper.js.map +1 -1
  35. package/dist/lib-cjs/index.d.ts +22 -24
  36. package/dist/lib-cjs/index.js +38 -42
  37. package/dist/lib-cjs/index.js.map +1 -1
  38. package/package.json +1 -1
  39. package/src/api/classes/element.ts +117 -146
  40. package/src/api/classes/{parameterizable.ts → elementParameterizable.ts} +1 -12
  41. package/src/api/classes/event.ts +1 -16
  42. package/src/api/classes/parameter.ts +22 -153
  43. package/src/api/classes/parameterObservable.ts +31 -9
  44. package/src/api/classes/placementAnimation.ts +0 -10
  45. package/src/api/classes/variant.ts +51 -187
  46. package/src/api/classes/variantInstance.ts +1 -8
  47. package/src/api/classes/viewer.ts +11 -68
  48. package/src/api/internal/sceneSetup.ts +109 -99
  49. package/src/api/util/babylonHelper.ts +10 -171
  50. package/src/api/util/globalTypes.ts +14 -71
  51. package/src/api/util/resourceHelper.ts +23 -31
  52. package/src/dev.ts +6 -2
  53. package/src/index.ts +23 -27
  54. package/src/pagesconfig.json +13 -8
  55. package/src/api/classes/variantParameterizable.ts +0 -73
  56. package/src/api/classes/viewerLight.ts +0 -330
  57. package/src/api/util/stringHelper.ts +0 -26
@@ -8,7 +8,6 @@ type VariantInstance = import("../classes/variantInstance").VariantInstance;
8
8
  */
9
9
  type VariantElement = import("../classes/element").Element;
10
10
  type DottedPath = import("../classes/dottedPath").DottedPath;
11
- type ViewerLight = import("../classes/viewerLight").ViewerLight;
12
11
 
13
12
  // global accessible types imported from BabylonJS
14
13
  type Scene = import("@babylonjs/core/scene").Scene;
@@ -69,10 +68,6 @@ type Asset = {
69
68
  fileName: string | undefined
70
69
  };
71
70
 
72
- type ElementDefinitions = {
73
- [name: string]: ElementDefinition | string[]
74
- };
75
-
76
71
  type ElementDefinition = {
77
72
  paths: PathDefinitions,
78
73
  traceables?: TraceableDefinitions,
@@ -97,9 +92,9 @@ type StructureJson = {
97
92
  glTF?: Asset | string,
98
93
  parameterDeclaration?: ParameterDeclarations,
99
94
  parameters?: ParameterBag,
100
- elements?: ElementDefinitions,
101
- lights?: LightDefinitions,
102
- grounds?: GroundDefinitions,
95
+ elements?: {
96
+ [name: string]: ElementDefinition | string[]
97
+ },
103
98
  /**
104
99
  * `variants` is a declarative description of 3D-model variations in the configurator. Each variant itself is a
105
100
  * {@link StructureJson} which must at least define a `name` in the key of the list and the properties `glTF` and
@@ -128,7 +123,7 @@ type StructureJson = {
128
123
  */
129
124
  variants?: {
130
125
  [id: string]: StructureJson,
131
- },
126
+ }
132
127
  };
133
128
 
134
129
  type SceneJson = {
@@ -149,7 +144,8 @@ type SceneJson = {
149
144
 
150
145
  type SceneDefinition = {
151
146
  globals: SceneGlobals,
152
- cameras?: CameraDefinitions,
147
+ lights?: LightDefinitions,
148
+ cameras?: CameraDefinitions
153
149
  };
154
150
 
155
151
  type SceneGlobals = {
@@ -193,29 +189,12 @@ type SceneGlobals = {
193
189
  }
194
190
  };
195
191
 
196
- /**
197
- * {@link Viewer.screenshot} internally uses Babylons [ScreenshotTools.CreateScreenshotUsingRenderTarget](https://doc.babylonjs.com/typedoc/classes/babylon.screenshottools#createscreenshotusingrendertarget). \
198
- * See this link for additional info about the properties.
199
- */
200
192
  type ScreenshotSettings = {
201
- /** Defaults to canvas width & height */
202
193
  size?: IScreenshotSize,
203
- /**
204
- * Default `image/png`
205
- *
206
- * **Info regarding JPEG:** \
207
- * Use mimeType `image/jpeg` (**not** `image/jpg`) when creating jpeg's. \
208
- * Also ensure that {@link Scene.clearColor | viewer.scene.clearColor} has an alpha value of `1` as jpeg's don't support
209
- * transparency. Otherwise background will always be black for jpeg's.
210
- */
211
194
  mimeType?: string,
212
- /** Default `1` */
213
195
  samples?: number,
214
- /** Default `false` */
215
196
  antialiasing?: boolean,
216
- /** Default `screenshot.png` */
217
197
  fileName?: string,
218
- /** Default `false` */
219
198
  renderSprites?: boolean
220
199
  };
221
200
 
@@ -231,40 +210,11 @@ type AutofocusSettings = {
231
210
  };
232
211
 
233
212
  type LightDefinitions = {
234
- [name: string]: LightDefinition | string
213
+ [light: string]: LightDefinition
235
214
  };
236
215
 
237
216
  type LightDefinition = {
238
- type: 'baked' | 'hemispheric' | 'point' | 'directional' | 'spot',
239
- path?: string,
240
- shadowGenerator?: ShadowGeneratorDefinition
241
- };
242
-
243
- type ShadowGeneratorDefinition = {
244
- mapSize: number
245
- [others: string]: any,
246
- /**
247
- * Further properties like `usePoissonSampling` are set directly on the ShadowGenerator object.
248
- * [Shadows](https://doc.babylonjs.com/divingDeeper/lights/shadows)
249
- */
250
- };
251
-
252
- type GroundDefinitions = {
253
- [ground: string]: GroundDefinition
254
- };
255
-
256
- type GroundDefinition = {
257
- type: 'baked' | 'ground' | 'heightmap',
258
- meshId?: string,
259
- url?: string,
260
- width?: number,
261
- height?: number,
262
- subdivisions?: number,
263
- receiveShadows?: boolean,
264
- minHeight?: number,
265
- maxHeight?: number,
266
- alphaFilter?: number,
267
- onReady?: any
217
+ type: 'hemispheric' | 'point'
268
218
  };
269
219
 
270
220
  type CameraDefinitions = {
@@ -280,6 +230,10 @@ type CameraDefinition = {
280
230
  /**
281
231
  * `arc` is a default camera position where the 3D-model is the center and the camera rotates around the 3D-model.
282
232
  * More Information about `arc` in [ArcRotateCamera](https://doc.babylonjs.com/typedoc/classes/babylon.arcrotatecamera).
233
+ *
234
+ * NOTE: While "baked" camera definitions from a GLB or babylon file can currently not be instatiated within the `Specification`, it's still possible to use them in the viewer.\
235
+ * For the moment all camera definitions inside these files are automatically added to the scene and can be actived using the {@link switchCamera} function.\
236
+ * The `newCamera` input has to match the name of the camera node inside the GLB/babylon file.
283
237
  */
284
238
  type: 'arc'
285
239
  /**
@@ -304,8 +258,7 @@ type ParameterDeclarations = {
304
258
  };
305
259
 
306
260
  type ParameterDeclaration = {
307
- type: 'string' | 'boolean' | 'number' | 'color' | 'select' | 'vector' | 'csl',
308
- parser?: any,
261
+ type: 'string' | 'boolean' | 'number' | 'color' | 'select' | 'vector',
309
262
  options?: ParameterValue[]
310
263
  };
311
264
 
@@ -315,10 +268,6 @@ type ParameterBag = {
315
268
  [name: string]: ParameterValue
316
269
  };
317
270
 
318
- type ParsedParameterBag = {
319
- [name: string]: any
320
- };
321
-
322
271
  type DottedPathArgument = string | string[] | DottedPath;
323
272
 
324
273
  type ParameterObserver = (
@@ -350,12 +299,6 @@ type AnimationDefinitions = {
350
299
  * liking and simply copy the `ease` function shown at the bottom of the visualizer into the `ease` property of your
351
300
  * {@link AnimationDefinition}.
352
301
  *
353
- * The `GSAPTWeenVars` are extended by the `shortestWay` property.\
354
- * This property defines if the camera should move to the target position within the shortest possible distance.\
355
- * If `shortestWay` is `false`, the camera moves the whole difference between the current camera position and the target position
356
- * and that could be > 360, which can appear very unconvenient to the operator.\
357
- * The default value of this flag is `true`.
358
- *
359
302
  * Example usage in {@link SceneJson | SceneJson.animations}:
360
303
  *
361
304
  * ```js
@@ -373,4 +316,4 @@ type AnimationDefinitions = {
373
316
  * // ...
374
317
  * ```
375
318
  */
376
- type AnimationDefinition = GSAPTweenVars & { shortestWay?: boolean }
319
+ type AnimationDefinition = GSAPTweenVars;
@@ -1,10 +1,5 @@
1
1
  import { emitter, Event } from '../classes/event';
2
2
 
3
- /**
4
- * Sleeps for a certain amount of microseconds.
5
- */
6
- const sleep = ( ms: number ) => new Promise( resolve => window.setTimeout( resolve, ms ) );
7
-
8
3
  /**
9
4
  * Loads any kind of response from given path.
10
5
  * @emits {@link Event.LOADING_START}
@@ -61,6 +56,16 @@ const debounce = function( func: Function, wait: number, immediate: boolean = fa
61
56
  };
62
57
  };
63
58
 
59
+ /**
60
+ * Creates a random uuidv4.
61
+ */
62
+ const uuidv4 = function() {
63
+ // @ts-ignore
64
+ return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace( /[018]/g, c =>
65
+ (c ^ crypto.getRandomValues( new Uint8Array( 1 ) )[0] & 15 >> c / 4).toString( 16 )
66
+ );
67
+ };
68
+
64
69
  /**
65
70
  * Merges multiple maps.
66
71
  */
@@ -75,31 +80,19 @@ const mergeMaps = function <TKey, TValue>( ...maps: Map<TKey, TValue>[] ): Map<T
75
80
  };
76
81
 
77
82
  /**
78
- * Creates an `ImageBitmap` from a SVG string using native `createImageBitmap` functionality.
83
+ * Converts a svg string into an URL with a base64 representation of that image.\
84
+ * This URL can be used as the basis of a paintable texture.
79
85
  */
80
- const createImageBitmapFromSvg = async function( svgSrc: string ): Promise<ImageBitmap> {
81
- return new Promise( async resolve => {
82
- const svgWithAssetsEmbedded = await _embedAssets( svgSrc );
83
- const svgBlob = new Blob( [svgWithAssetsEmbedded], { type: 'image/svg+xml;charset=utf-8' } );
84
- const svgBase64 = URL.createObjectURL( svgBlob );
85
- let img = new Image();
86
- img.onload = async () => {
87
- const imgBitmap = await createImageBitmap( img );
88
- resolve( imgBitmap );
89
- };
90
- img.src = svgBase64;
91
- } );
92
- };
86
+ const createImageUrlFromSvg = async function( svgSrc: string ): Promise<string> {
87
+ // replace assets with their base64 versions in svg source code
88
+ const svgWithAssetsEmbedded = await _embedAssets( svgSrc );
93
89
 
94
- const createImageBitmapFromImgSrc = async function( imgSrc: string ): Promise<ImageBitmap> {
95
- const img = new Image();
96
- img.src = imgSrc;
97
- return new Promise( resolve => {
98
- img.onload = async () => {
99
- const imgBitmap = await createImageBitmap( img );
100
- resolve( imgBitmap );
101
- };
102
- } );
90
+ // create blob from that
91
+ const svgBlob = new Blob( [svgWithAssetsEmbedded], { type: 'image/svg+xml' } );
92
+
93
+ // create URL that can be used in HTML (?)
94
+ const imgUrl = URL.createObjectURL( svgBlob );
95
+ return imgUrl;
103
96
  };
104
97
 
105
98
  /**
@@ -154,11 +147,10 @@ const _fetchBase64AssetUrl = async function( assetUrl: string ): Promise<{ url:
154
147
  };
155
148
 
156
149
  export {
157
- sleep,
158
150
  loadJson,
159
151
  loadText,
160
152
  debounce,
153
+ uuidv4,
161
154
  mergeMaps,
162
- createImageBitmapFromSvg,
163
- createImageBitmapFromImgSrc
155
+ createImageUrlFromSvg
164
156
  };
package/src/dev.ts CHANGED
@@ -4,8 +4,10 @@ import { set } from 'lodash-es';
4
4
 
5
5
  import { Emitter, Viewer } from '.';
6
6
 
7
- import { createSpec, beforeBootstrap, afterBootstrap, createUIelements } from '../assets/CB-6062-async-check/main';
8
-
7
+ /**
8
+ * (i) HERE YOU @TODO (1) ADJUST THE CURRENT DEMO YOU ARE WORKING ON.
9
+ */
10
+ import { createSpec, beforeBootstrap, afterBootstrap, createUIelements } from '../assets/hulahoop/main';
9
11
  const loadingElement = document.getElementById( 'loading' ) as HTMLDivElement;
10
12
 
11
13
  Emitter.on( Event.BOOTSTRAP_START, () => {
@@ -39,5 +41,7 @@ async function bootstrapViewer() {
39
41
  }
40
42
  await afterBootstrap( viewer );
41
43
  await createUIelements( viewer );
44
+ console.info( ' --- UI Initialized ---');
45
+
42
46
  return viewer;
43
47
  }
package/src/index.ts CHANGED
@@ -1,50 +1,48 @@
1
1
  /// <reference path="api/util/globalTypes.ts" />
2
2
 
3
- import { Animation as BabylonAnimation } from '@babylonjs/core/Animations/animation';
4
3
  import { ArcRotateCamera } from '@babylonjs/core/Cameras/arcRotateCamera';
5
4
  import { Engine } from '@babylonjs/core/Engines/engine';
6
- import { DirectionalLight } from '@babylonjs/core/Lights/directionalLight';
7
- import { HemisphericLight } from '@babylonjs/core/Lights/hemisphericLight';
8
5
  import { Material } from '@babylonjs/core/Materials/material';
9
6
  import { PBRMaterial } from '@babylonjs/core/Materials/PBR/pbrMaterial';
10
7
  import { StandardMaterial } from '@babylonjs/core/Materials/standardMaterial';
11
- import { CubeTexture } from '@babylonjs/core/Materials/Textures/cubeTexture';
12
8
  import { DynamicTexture } from '@babylonjs/core/Materials/Textures/dynamicTexture';
13
- import { Texture } from '@babylonjs/core/Materials/Textures/texture';
14
9
  import { Color3, Color4 } from '@babylonjs/core/Maths/math.color';
15
10
  import { Vector3 } from '@babylonjs/core/Maths/math.vector';
16
11
  import { AbstractMesh } from '@babylonjs/core/Meshes/abstractMesh';
17
12
  import { InstancedMesh } from '@babylonjs/core/Meshes/instancedMesh';
18
13
  import { Mesh } from '@babylonjs/core/Meshes/mesh';
19
- import { MeshBuilder } from '@babylonjs/core/Meshes/meshBuilder';
20
14
  import { TransformNode } from '@babylonjs/core/Meshes/transformNode';
21
15
  import { Node } from '@babylonjs/core/node';
22
-
23
- /**
24
- * Without explicitly importing the "BoundingBoxRenderer", we're getting "scene.getBoundingBoxRenderer is undefined"
25
- * errors when creating HighlightLayer instances. Not sure why but those errors only happen when using the built
26
- * version of the viewer (e.g. when pulling it from NPM etc.)...
27
- */
28
- import '@babylonjs/core/Rendering/boundingBoxRenderer';
29
16
  import { Scene } from '@babylonjs/core/scene';
30
- import { Parameterizable } from './api/classes/parameterizable';
31
- import { VariantParameterizable } from './api/classes/variantParameterizable';
17
+ import { VariantInstance } from './api/classes/variantInstance';
18
+ import { Viewer } from './api/classes/viewer';
19
+ import { Event, emitter } from './api/classes/event';
32
20
  import { EventEmitter } from 'eventemitter3';
33
- import { Element } from './api/classes/element';
34
- import { emitter, Event } from './api/classes/event';
35
- import { EventBroadcaster } from './api/classes/eventBroadcaster';
36
21
  import { Parameter } from './api/classes/parameter';
37
- import { ParameterObservable } from './api/classes/parameterObservable';
38
- import { PlacementAnimation } from './api/classes/placementAnimation';
22
+ import { CubeTexture } from '@babylonjs/core/Materials/Textures/cubeTexture';
23
+ import { Animation as BabylonAnimation } from '@babylonjs/core/Animations/animation';
24
+ import { MeshBuilder } from '@babylonjs/core/Meshes/meshBuilder';
25
+ import { Texture } from '@babylonjs/core/Materials/Textures/texture';
26
+ import { DirectionalLight } from '@babylonjs/core/Lights/directionalLight';
27
+ import { HemisphericLight } from '@babylonjs/core/Lights/hemisphericLight';
39
28
  import { Variant } from './api/classes/variant';
40
- import { VariantInstance } from './api/classes/variantInstance';
41
- import { Viewer } from './api/classes/viewer';
42
- import { ViewerLight } from './api/classes/viewerLight';
29
+ import { ParameterObservable } from './api/classes/parameterObservable';
30
+ import { ElementParameterizable } from './api/classes/elementParameterizable';
31
+ import { Element } from './api/classes/element';
32
+ import { VariantInstanceManager } from './api/manager/variantInstanceManager';
43
33
  import { AnimationManager } from './api/manager/animationManager';
34
+ import { EventBroadcaster } from './api/classes/eventBroadcaster';
44
35
  import { SceneManager } from './api/manager/sceneManager';
45
- import { VariantInstanceManager } from './api/manager/variantInstanceManager';
36
+ import { PlacementAnimation } from './api/classes/placementAnimation';
46
37
  import * as BabylonHelper from './api/util/babylonHelper';
47
38
 
39
+ /**
40
+ * Without explicitly importing the "BoundingBoxRenderer", we're getting "scene.getBoundingBoxRenderer is undefined"
41
+ * errors when creating HighlightLayer instances. Not sure why but those errors only happen when using the built
42
+ * version of the viewer (e.g. when pulling it from NPM etc.)...
43
+ */
44
+ import '@babylonjs/core/Rendering/boundingBoxRenderer';
45
+
48
46
  /**
49
47
  * Expose some frequently used babylon modules by our consumers.
50
48
  */
@@ -54,9 +52,7 @@ export {
54
52
  VariantInstanceManager,
55
53
  Viewer,
56
54
  ParameterObservable,
57
- Parameterizable,
58
- VariantParameterizable,
59
- ViewerLight,
55
+ ElementParameterizable,
60
56
  emitter as Emitter,
61
57
  EventEmitter,
62
58
  Event,
@@ -32,21 +32,26 @@
32
32
  "pages": [
33
33
  {
34
34
  "title": "Specification",
35
- "source": "./doc/Specification.md"
35
+ "source": "./doc/documentation/Specification.md"
36
36
  },
37
37
  {
38
38
  "title": "Parameters",
39
- "source": "./doc/Parameters.md"
40
- },
41
- {
42
- "title": "ViewerLights",
43
- "source": "./doc/ViewerLights.md"
39
+ "source": "./doc/documentation/Parameters.md"
44
40
  },
45
41
  {
46
42
  "title": "Paintables",
47
- "source": "./doc/Paintables.md"
43
+ "source": "./doc/documentation/Paintables.md"
44
+ }
45
+ ]
46
+ },
47
+ {
48
+ "title": "Best Practice",
49
+ "pages": [
50
+ {
51
+ "title": "How to change custom material properties",
52
+ "source": "./doc/best-practice/Custom-material-properties.md"
48
53
  }
49
54
  ]
50
55
  }
51
56
  ]
52
- }
57
+ }
@@ -1,73 +0,0 @@
1
- import { DottedPath } from './../classes/dottedPath';
2
- import { Event } from './../classes/event';
3
- import { Parameterizable } from './../classes/parameterizable';
4
- import { Variant } from './../classes/variant';
5
- import { mergeMaps } from './../util/resourceHelper';
6
- import { camelToSnakeCase } from './../util/stringHelper';
7
- import { cloneDeep, concat, get, merge } from 'lodash-es';
8
-
9
- export abstract class VariantParameterizable extends Parameterizable {
10
-
11
- protected readonly _parameterObservers: Map<string, ParameterObserver[]> = new Map();
12
-
13
- protected constructor( public readonly variant: Variant,
14
- public readonly name: string ) {
15
- super();
16
- }
17
-
18
- /**
19
- * Gets the inherited parameters from the {@link Variant} with cleaned {@link Parameterizable} prefix.
20
- */
21
- get inheritedParameters(): ParameterBag {
22
- const parameterBag: ParameterBag = {};
23
- for( const parameter in this.variant.inheritedParameters ) {
24
- const dpp = DottedPath.create( parameter );
25
- if( dpp.firstPart !== this.name ) {
26
- continue;
27
- }
28
- dpp.shiftPart();
29
- parameterBag[dpp.path] = this.variant.inheritedParameters[parameter];
30
- }
31
- return parameterBag;
32
- }
33
-
34
- /**
35
- * Places the given {@link ParameterBag} in the {@link VariantParameterizable}'s parameters, replaces all patterns in the
36
- * {@link StructureJson} and broadcasts all {@link ParameterObserver}s.
37
- */
38
- public async commitParameters( parameters?: ParameterBag ): Promise<VariantParameterizable> {
39
- if( !parameters ) {
40
- parameters = {};
41
- }
42
- const oldParameters = cloneDeep( this.parameters );
43
- merge( this.parameters, parameters );
44
- // handle parameter observers
45
- let observerPromises: Promise<void | ParameterObserver>[] = [];
46
- for( const parameter in this.parameters ) {
47
- const oldParameterValue = oldParameters[parameter];
48
- const newParameterValue = this.parameters[parameter];
49
- this.variant.assertParameter( this.variant.inheritedParameterDeclaration, parameter, newParameterValue );
50
- if( oldParameterValue === newParameterValue ) {
51
- continue;
52
- }
53
- // parameter changed
54
- const parameterObservers = mergeMaps( this._parameterObservers, this.parameterObservers );
55
- if( parameterObservers.has( parameter ) ) {
56
- const observers = parameterObservers.get( parameter )!;
57
- observerPromises = concat( observerPromises, observers.map( observer => {
58
- const observerResult = observer( this, oldParameterValue, newParameterValue );
59
- const observerPromise = Promise.resolve( observerResult );
60
- observerPromise.then( () => {
61
- const clsName = camelToSnakeCase( this.constructor.name ).toUpperCase();
62
- this.broadcastEvent( get( Event, clsName + '_PARAMETER_COMMITTED' ),
63
- this, parameter, oldParameterValue, newParameterValue );
64
- } );
65
- return observerPromise;
66
- } ) );
67
- }
68
- }
69
- await Promise.all( observerPromises );
70
- return this;
71
- }
72
-
73
- }