@configura/babylon-view 1.6.1-alpha.7 → 1.6.1

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 (34) hide show
  1. package/.eslintrc.json +18 -0
  2. package/dist/animation/animator/EasingFunctions.d.ts +17 -17
  3. package/dist/animation/animator/EasingFunctions.js +19 -19
  4. package/dist/animation/coordinator/Coordinator.d.ts +1 -1
  5. package/dist/animation/coordinator/Coordinator.js +9 -3
  6. package/dist/animation/coordinator/CoordinatorDropAndSpin.js +17 -12
  7. package/dist/animation/coordinator/CoordinatorIdentity.d.ts +1 -1
  8. package/dist/animation/coordinator/CoordinatorIdentity.js +3 -1
  9. package/dist/animation/coordinator/CoordinatorNodeQueues.d.ts +2 -2
  10. package/dist/animation/coordinator/CoordinatorNodeQueues.js +1 -1
  11. package/dist/animation/coordinator/CoordinatorPulseBounce.js +17 -22
  12. package/dist/animation/coordinator/CoordinatorPulseHighlight.js +13 -18
  13. package/dist/animation/coordinator/CoordinatorPulseInflate.js +7 -14
  14. package/dist/camera/CfgArcRotateCameraPointersInput.js +2 -0
  15. package/dist/camera/GradingApplier.d.ts +1 -1
  16. package/dist/camera/GradingApplier.js +2 -2
  17. package/dist/geometry/stretch/CfgStretchData.js +5 -1
  18. package/dist/material/texture.js +1 -1
  19. package/dist/nodes/CfgDeferredMeshNode.js +9 -8
  20. package/dist/nodes/CfgProductNode.d.ts +3 -2
  21. package/dist/nodes/CfgProductNode.js +36 -16
  22. package/dist/nodes/CfgSymNode.js +1 -1
  23. package/dist/nodes/CfgSymRootNode.js +17 -8
  24. package/dist/scene/SceneCreator.js +2 -2
  25. package/dist/utilities/CfgBoundingBox.d.ts +1 -1
  26. package/dist/utilities/CfgBoundingBox.js +3 -3
  27. package/dist/utilities/anchor/anchorMap.js +1 -1
  28. package/dist/utilities/utilitiesColor.d.ts +2 -2
  29. package/dist/utilities/utilitiesColor.js +6 -4
  30. package/dist/view/BaseView.js +14 -8
  31. package/dist/view/SingleProductDefaultCameraView.d.ts +3 -2
  32. package/dist/view/SingleProductDefaultCameraView.js +1 -1
  33. package/dist/view/SingleProductView.js +5 -4
  34. package/package.json +5 -5
package/.eslintrc.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "parser": "@typescript-eslint/parser",
3
+ "plugins": ["@typescript-eslint"],
4
+ "extends": [
5
+ "eslint:recommended",
6
+ "plugin:@typescript-eslint/recommended",
7
+ "prettier"
8
+
9
+ // TODO: Type-checking rules require a proper tsconfig-file to work,
10
+ // pointed at by the parserOption.project setting.
11
+ //
12
+ //"plugin:@typescript-eslint/recommended-requiring-type-checking"
13
+ ]
14
+ //"rules": { "@typescript-eslint/no-floating-promises": "error" }
15
+ //"parserOptions": {
16
+ // "project": "./tsconfig.json"
17
+ //}
18
+ }
@@ -13,23 +13,23 @@ export declare const EasingFunctions: {
13
13
  easeInQuint: EasingFunction;
14
14
  easeOutQuint: EasingFunction;
15
15
  easeInOutQuint: EasingFunction;
16
- sinBounce: (oscillations: number) => (t: number) => number;
17
- easeInSine: (t: number) => number;
18
- easeOutSine: (t: number) => number;
19
- easeInOutSine: (t: number) => number;
20
- easeInExpo: (t: number) => number;
21
- easeOutExpo: (t: number) => number;
22
- easeInOutExpo: (t: number) => number;
23
- easeInCirc: (t: number) => number;
24
- easeOutCirc: (t: number) => number;
25
- easeInOutCirc: (t: number) => number;
26
- easeInElastic: (t: number) => number;
27
- easeOutElastic: (t: number) => number;
28
- easeInOutElastic: (t: number) => number;
29
- easeInBack: (s?: number) => (t: number) => number;
30
- easeOutBack: (s?: number) => (t: number) => number;
31
- easeInOutBack: (s?: number) => (t: number) => number;
32
- easeOutBounce: (t: number) => number;
16
+ sinBounce: (oscillations: number) => EasingFunction;
17
+ easeInSine: EasingFunction;
18
+ easeOutSine: EasingFunction;
19
+ easeInOutSine: EasingFunction;
20
+ easeInExpo: EasingFunction;
21
+ easeOutExpo: EasingFunction;
22
+ easeInOutExpo: EasingFunction;
23
+ easeInCirc: EasingFunction;
24
+ easeOutCirc: EasingFunction;
25
+ easeInOutCirc: EasingFunction;
26
+ easeInElastic: EasingFunction;
27
+ easeOutElastic: EasingFunction;
28
+ easeInOutElastic: EasingFunction;
29
+ easeInBack: (s?: number) => EasingFunction;
30
+ easeOutBack: (s?: number) => EasingFunction;
31
+ easeInOutBack: (s?: number) => EasingFunction;
32
+ easeOutBounce: EasingFunction;
33
33
  makeMirrored: (func: EasingFunction) => EasingFunction;
34
34
  invert: (func: EasingFunction) => EasingFunction;
35
35
  };
@@ -26,12 +26,12 @@ export const EasingFunctions = {
26
26
  // acceleration until halfway, then deceleration
27
27
  easeInOutQuint: ((t) => t < 0.5 ? 16 * t * t * t * t * t : 1 + 16 * --t * t * t * t * t),
28
28
  sinBounce: (oscillations) => (t) => (1 - Math.cos(t * oscillations * Math.PI * 2)) / 2,
29
- easeInSine: (t) => -Math.cos(t * (Math.PI / 2)) + 1,
30
- easeOutSine: (t) => Math.sin(t * (Math.PI / 2)),
31
- easeInOutSine: (t) => (-1 / 2) * (Math.cos(Math.PI * t) - 1),
32
- easeInExpo: (t) => (t === 0 ? 0 : Math.pow(2, 10 * (t - 1))),
33
- easeOutExpo: (t) => (t === 1 ? 1 : -Math.pow(2, -10 * t) + 1),
34
- easeInOutExpo: (t) => {
29
+ easeInSine: ((t) => -Math.cos(t * (Math.PI / 2)) + 1),
30
+ easeOutSine: ((t) => Math.sin(t * (Math.PI / 2))),
31
+ easeInOutSine: ((t) => (-1 / 2) * (Math.cos(Math.PI * t) - 1)),
32
+ easeInExpo: ((t) => (t === 0 ? 0 : Math.pow(2, 10 * (t - 1)))),
33
+ easeOutExpo: ((t) => (t === 1 ? 1 : -Math.pow(2, -10 * t) + 1)),
34
+ easeInOutExpo: ((t) => {
35
35
  if (t === 0)
36
36
  return 0;
37
37
  if (t === 1)
@@ -39,15 +39,15 @@ export const EasingFunctions = {
39
39
  if ((t /= 1 / 2) < 1)
40
40
  return (1 / 2) * Math.pow(2, 10 * (t - 1));
41
41
  return (1 / 2) * (-Math.pow(2, -10 * --t) + 2);
42
- },
43
- easeInCirc: (t) => -(Math.sqrt(1 - t * t) - 1),
44
- easeOutCirc: (t) => Math.sqrt(1 - (t = t - 1) * t),
45
- easeInOutCirc: (t) => {
42
+ }),
43
+ easeInCirc: ((t) => -(Math.sqrt(1 - t * t) - 1)),
44
+ easeOutCirc: ((t) => Math.sqrt(1 - (t = t - 1) * t)),
45
+ easeInOutCirc: ((t) => {
46
46
  if (t / 1 / 2 < 1)
47
47
  return (-1 / 2) * (Math.sqrt(1 - t * t) - 1);
48
48
  return (1 / 2) * (Math.sqrt(1 - (t -= 2) * t) + 1);
49
- },
50
- easeInElastic: (t) => {
49
+ }),
50
+ easeInElastic: ((t) => {
51
51
  let s = 1.70158;
52
52
  let p = 0;
53
53
  let a = 1;
@@ -65,8 +65,8 @@ export const EasingFunctions = {
65
65
  s = (p / (2 * Math.PI)) * Math.asin(1 / a);
66
66
  }
67
67
  return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin(((t - s) * (2 * Math.PI)) / p));
68
- },
69
- easeOutElastic: (t) => {
68
+ }),
69
+ easeOutElastic: ((t) => {
70
70
  let s = 1.70158;
71
71
  let p = 0;
72
72
  let a = 1;
@@ -84,8 +84,8 @@ export const EasingFunctions = {
84
84
  s = (p / (2 * Math.PI)) * Math.asin(1 / a);
85
85
  }
86
86
  return a * Math.pow(2, -10 * t) * Math.sin(((t - s) * (2 * Math.PI)) / p) + 1;
87
- },
88
- easeInOutElastic: (t) => {
87
+ }),
88
+ easeInOutElastic: ((t) => {
89
89
  let s = 1.70158;
90
90
  let p = 0;
91
91
  let a = 1;
@@ -105,7 +105,7 @@ export const EasingFunctions = {
105
105
  if (t < 1)
106
106
  return (-0.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin(((t - s) * (2 * Math.PI)) / p)));
107
107
  return a * Math.pow(2, -10 * (t -= 1)) * Math.sin(((t - s) * (2 * Math.PI)) / p) * 0.5 + 1;
108
- },
108
+ }),
109
109
  easeInBack: (s = 1.70158) => (t) => t * t * ((s + 1) * t - s),
110
110
  easeOutBack: (s = 1.70158) => (t) => (t = t - 1) * t * ((s + 1) * t + s) + 1,
111
111
  easeInOutBack: (s = 1.70158) => (t) => {
@@ -113,7 +113,7 @@ export const EasingFunctions = {
113
113
  return (1 / 2) * (t * t * (((s *= 1.525) + 1) * t - s));
114
114
  return (1 / 2) * ((t -= 2) * t * (((s *= 1.525) + 1) * t + s) + 2);
115
115
  },
116
- easeOutBounce: (t) => {
116
+ easeOutBounce: ((t) => {
117
117
  if (t < 1 / 2.75) {
118
118
  return 7.5625 * t * t;
119
119
  }
@@ -126,7 +126,7 @@ export const EasingFunctions = {
126
126
  else {
127
127
  return 7.5625 * (t -= 2.625 / 2.75) * t + 0.984375;
128
128
  }
129
- },
129
+ }),
130
130
  makeMirrored: (func) => (t) => {
131
131
  const perceivedT = (t < 0.5 ? t : 1 - t) * 2;
132
132
  return func(perceivedT);
@@ -9,7 +9,7 @@ export declare type CoordinatorWithMeta = {
9
9
  coordinator: Coordinator;
10
10
  isNewProduct: boolean;
11
11
  };
12
- export declare type CoordinatorConfig = {};
12
+ export declare type CoordinatorConfig = Record<string, unknown>;
13
13
  export declare const defaultConfig: CoordinatorConfig;
14
14
  export declare abstract class Coordinator<Config extends CoordinatorConfig = CoordinatorConfig> {
15
15
  protected view: SingleProductView;
@@ -36,12 +36,18 @@ export class Coordinator {
36
36
  this.productNode = productNode;
37
37
  }
38
38
  prepareForEnter(_node, _isNewProduct) {
39
- return __awaiter(this, void 0, void 0, function* () { });
39
+ return __awaiter(this, void 0, void 0, function* () {
40
+ // Do nothing
41
+ });
40
42
  }
41
43
  prepareForExit(_node) {
42
- return __awaiter(this, void 0, void 0, function* () { });
44
+ return __awaiter(this, void 0, void 0, function* () {
45
+ // Do nothing
46
+ });
43
47
  }
44
48
  prepareForMaterialChange(_node, _isNewProduct) {
45
- return __awaiter(this, void 0, void 0, function* () { });
49
+ return __awaiter(this, void 0, void 0, function* () {
50
+ // Do nothing
51
+ });
46
52
  }
47
53
  }
@@ -45,7 +45,10 @@ export class CoordinatorDropAndSpin extends CoordinatorNodeQueues {
45
45
  }
46
46
  setProduct(productNode) {
47
47
  super.setProduct(productNode);
48
- let queue = this.getAnimatorQueue(productNode, true);
48
+ const queue = this.getAnimatorQueue(productNode, true);
49
+ if (queue === undefined) {
50
+ throw new Error("No queue unexpected");
51
+ }
49
52
  const animator = new AnimatorSpin(productNode, {
50
53
  translationVector: productNode.boundingBox.center,
51
54
  easing: EasingFunctions.easeInOutQuad,
@@ -56,17 +59,19 @@ export class CoordinatorDropAndSpin extends CoordinatorNodeQueues {
56
59
  queue.add(animator);
57
60
  }
58
61
  prepareForEnter(node, _isNewProduct) {
59
- return __awaiter(this, void 0, void 0, function* () {
60
- const queue = this.getAnimatorQueue(node, true);
61
- const adjustToWorldMatrix = node.worldOriginalMatrix.getRotationMatrix().transpose();
62
- const animator = new AnimatorPointToPoint(node, {
63
- easing: EasingFunctions.easeOutCubic,
64
- duration: this._config.enterDuration,
65
- startPosition: Vector3.TransformCoordinates(new Vector3(0, this._config.distance, 0), adjustToWorldMatrix),
66
- }, "enter");
67
- animator.apply0();
68
- queue.add(animator);
69
- });
62
+ const queue = this.getAnimatorQueue(node, true);
63
+ if (queue === undefined) {
64
+ throw new Error("No queue unexpected");
65
+ }
66
+ const adjustToWorldMatrix = node.worldOriginalMatrix.getRotationMatrix().transpose();
67
+ const animator = new AnimatorPointToPoint(node, {
68
+ easing: EasingFunctions.easeOutCubic,
69
+ duration: this._config.enterDuration,
70
+ startPosition: Vector3.TransformCoordinates(new Vector3(0, this._config.distance, 0), adjustToWorldMatrix),
71
+ }, "enter");
72
+ animator.apply0();
73
+ queue.add(animator);
74
+ return Promise.resolve();
70
75
  }
71
76
  prepareForExit(node) {
72
77
  return __awaiter(this, void 0, void 0, function* () {
@@ -2,7 +2,7 @@ import { Observable } from "@configura/web-utilities";
2
2
  import { SingleProductView } from "../../view/SingleProductView.js";
3
3
  import { SingleProductViewPhaseEvent } from "../../view/SingleProductViewConfiguration.js";
4
4
  import { Coordinator } from "./Coordinator.js";
5
- export declare class CoordinatorIdentity extends Coordinator<{}> {
5
+ export declare class CoordinatorIdentity extends Coordinator<Record<string, unknown>> {
6
6
  protected view: SingleProductView;
7
7
  protected phaseObservable: Observable<SingleProductViewPhaseEvent>;
8
8
  constructor(view: SingleProductView, phaseObservable: Observable<SingleProductViewPhaseEvent>);
@@ -8,5 +8,7 @@ export class CoordinatorIdentity extends Coordinator {
8
8
  willTick(_now, _delta) {
9
9
  return false;
10
10
  }
11
- tick(_now, _delta) { }
11
+ tick(_now, _delta) {
12
+ // Do nothing
13
+ }
12
14
  }
@@ -4,7 +4,7 @@ import { SingleProductViewPhaseEvent } from "../../view/SingleProductViewConfigu
4
4
  import { AnimatableObject } from "../AnimatableObject.js";
5
5
  import { AnimatorQueue } from "../animator/AnimatorQueue.js";
6
6
  import { Coordinator, CoordinatorConfig } from "./Coordinator.js";
7
- export declare type CoordinatorNodeQueuesConfig = CoordinatorConfig & {};
7
+ export declare type CoordinatorNodeQueuesConfig = CoordinatorConfig;
8
8
  export declare const defaultConfig: CoordinatorNodeQueuesConfig;
9
9
  export declare abstract class CoordinatorNodeQueues<Config extends CoordinatorNodeQueuesConfig> extends Coordinator<Config> {
10
10
  protected animationQueues: AnimatorQueue[];
@@ -12,7 +12,7 @@ export declare abstract class CoordinatorNodeQueues<Config extends CoordinatorNo
12
12
  protected constructor(view: SingleProductView, phaseObservable: Observable<SingleProductViewPhaseEvent>, config: Config);
13
13
  getAnimatorQueue(node: AnimatableObject, orCreate?: boolean): AnimatorQueue | undefined;
14
14
  removeAnimatorQueue(queue: AnimatorQueue): void;
15
- protected run(): false | undefined;
15
+ protected run(): void;
16
16
  willTick(now: number, delta: number): boolean;
17
17
  tick(now: number, delta: number): void;
18
18
  }
@@ -24,7 +24,7 @@ export class CoordinatorNodeQueues extends Coordinator {
24
24
  }
25
25
  run() {
26
26
  if (this.productNode === undefined) {
27
- return false;
27
+ return;
28
28
  }
29
29
  if (this.isFirstRun) {
30
30
  this.isFirstRun = false;
@@ -1,12 +1,3 @@
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
1
  import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
11
2
  import { AnimatorPointToPoint } from "../animator/AnimatorPointToPoint.js";
12
3
  import { EasingFunctions } from "../animator/EasingFunctions.js";
@@ -22,19 +13,23 @@ export class CoordinatorPulseBounce extends CoordinatorPulse {
22
13
  super(view, phaseObservable, Object.assign(Object.assign({}, defaultConfig), config));
23
14
  }
24
15
  _prepare(node, _isNewProduct) {
25
- return __awaiter(this, void 0, void 0, function* () {
26
- const queue = this.getAnimatorQueue(node, true);
27
- const height = this._config.height *
28
- (this.productNode === undefined ? 1 : Math.pow(this.productNode.boundingBox.spaceDiagonal, 2));
29
- const adjustToWorldMatrix = node.worldOriginalMatrix.getRotationMatrix().transpose();
30
- const animator = new AnimatorPointToPoint(node, {
31
- easing: EasingFunctions.makeMirrored(EasingFunctions.easeInSine),
32
- duration: this._config.duration,
33
- delay: this._config.delay,
34
- startPosition: Vector3.TransformCoordinates(new Vector3(0, 0, 0), adjustToWorldMatrix),
35
- endPosition: Vector3.TransformCoordinates(new Vector3(0, height, 0), adjustToWorldMatrix),
36
- });
37
- queue.add(animator);
16
+ const queue = this.getAnimatorQueue(node, true);
17
+ if (queue === undefined) {
18
+ throw new Error("No queue unexpected");
19
+ }
20
+ const height = this._config.height *
21
+ (this.productNode === undefined
22
+ ? 1
23
+ : Math.pow(this.productNode.boundingBox.spaceDiagonal, 2));
24
+ const adjustToWorldMatrix = node.worldOriginalMatrix.getRotationMatrix().transpose();
25
+ const animator = new AnimatorPointToPoint(node, {
26
+ easing: EasingFunctions.makeMirrored(EasingFunctions.easeInSine),
27
+ duration: this._config.duration,
28
+ delay: this._config.delay,
29
+ startPosition: Vector3.TransformCoordinates(new Vector3(0, 0, 0), adjustToWorldMatrix),
30
+ endPosition: Vector3.TransformCoordinates(new Vector3(0, height, 0), adjustToWorldMatrix),
38
31
  });
32
+ queue.add(animator);
33
+ return Promise.resolve();
39
34
  }
40
35
  }
@@ -1,12 +1,3 @@
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
1
  import { AnimatorHighlight, defaultConfig as animatorHighlightDefaultConfig, } from "../animator/AnimatorHighlight.js";
11
2
  import { EasingFunctions } from "../animator/EasingFunctions.js";
12
3
  import { CoordinatorPulse, defaultConfig as baseDefaultConfig, } from "./CoordinatorPulse.js";
@@ -21,14 +12,18 @@ export class CoordinatorPulseHighlight extends CoordinatorPulse {
21
12
  super(view, phaseObservable, Object.assign(Object.assign({}, defaultConfig), config));
22
13
  }
23
14
  _prepare(node, _isNewProduct) {
24
- return __awaiter(this, void 0, void 0, function* () {
25
- const queue = this.getAnimatorQueue(node, true);
26
- const width = this._config.width *
27
- (this.productNode === undefined ? 1 : Math.pow(this.productNode.boundingBox.spaceDiagonal, 2));
28
- const config = Object.assign(Object.assign({}, this._config), { width, easing: EasingFunctions.makeMirrored(EasingFunctions.easeInQuart), startPosition: 0 });
29
- const animator = new AnimatorHighlight(node, config);
30
- animator.apply0();
31
- queue.add(animator);
32
- });
15
+ const queue = this.getAnimatorQueue(node, true);
16
+ if (queue === undefined) {
17
+ throw new Error("No queue unexpected");
18
+ }
19
+ const width = this._config.width *
20
+ (this.productNode === undefined
21
+ ? 1
22
+ : Math.pow(this.productNode.boundingBox.spaceDiagonal, 2));
23
+ const config = Object.assign(Object.assign({}, this._config), { width, easing: EasingFunctions.makeMirrored(EasingFunctions.easeInQuart), startPosition: 0 });
24
+ const animator = new AnimatorHighlight(node, config);
25
+ animator.apply0();
26
+ queue.add(animator);
27
+ return Promise.resolve();
33
28
  }
34
29
  }
@@ -1,12 +1,3 @@
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
1
  import { AnimatorScale } from "../animator/AnimatorScale.js";
11
2
  import { EasingFunctions } from "../animator/EasingFunctions.js";
12
3
  import { CoordinatorPulse, defaultConfig as baseDefaultConfig, } from "./CoordinatorPulse.js";
@@ -21,10 +12,12 @@ export class CoordinatorPulseInflate extends CoordinatorPulse {
21
12
  super(view, phaseObservable, Object.assign(Object.assign({}, defaultConfig), config));
22
13
  }
23
14
  _prepare(node, _isNewProduct) {
24
- return __awaiter(this, void 0, void 0, function* () {
25
- const queue = this.getAnimatorQueue(node, true);
26
- const animator = new AnimatorScale(node, Object.assign(Object.assign({}, this._config), { easing: EasingFunctions.sinBounce(1), startPosition: 1, endPosition: this._config.size, translationVector: node.boundingBox.center }));
27
- queue.add(animator);
28
- });
15
+ const queue = this.getAnimatorQueue(node, true);
16
+ if (queue === undefined) {
17
+ throw new Error("No queue unexpected");
18
+ }
19
+ const animator = new AnimatorScale(node, Object.assign(Object.assign({}, this._config), { easing: EasingFunctions.sinBounce(1), startPosition: 1, endPosition: this._config.size, translationVector: node.boundingBox.center }));
20
+ queue.add(animator);
21
+ return Promise.resolve();
29
22
  }
30
23
  }
@@ -1,3 +1,5 @@
1
+ // Disable eslint since this (mostly) isn't our code
2
+ /* eslint-disable */
1
3
  import { ArcRotateCameraPointersInput } from "@babylonjs/core/Cameras/Inputs/arcRotateCameraPointersInput.js";
2
4
  import "@babylonjs/core/Engines/Extensions/engine.webVR.js"; // isInVRExclusivePointerMode
3
5
  import { PointerEventTypes, } from "@babylonjs/core/Events/pointerEvents.js";
@@ -1,4 +1,4 @@
1
1
  import { Camera } from "@babylonjs/core/Cameras/camera.js";
2
2
  export declare type GradingApplier = (camera: Camera) => void;
3
- export declare const getDefaultGradingApplier: () => (camera: Camera) => void;
3
+ export declare const getDefaultGradingApplier: () => GradingApplier;
4
4
  //# sourceMappingURL=GradingApplier.d.ts.map
@@ -18,7 +18,7 @@ export const getDefaultGradingApplier = () => (camera) => {
18
18
  // PBR we really should be using "hdr" to do things the right way, see this discussion:
19
19
  // https://forum.babylonjs.com/t/enabling-hdr-in-defaultpipeline-disables-aa/14656/9
20
20
  //
21
- var pipeline = new DefaultRenderingPipeline("defaultPipeline", false, scene, [camera]);
21
+ const pipeline = new DefaultRenderingPipeline("defaultPipeline", false, scene, [camera]);
22
22
  // FXAA is not enabled since it causes excessive blur in detailed textures
23
23
  // pipeline.fxaaEnabled = true;
24
24
  // This affects anti-aliasing, more samples is better but also slower.
@@ -40,7 +40,7 @@ export const getDefaultGradingApplier = () => (camera) => {
40
40
  // We add a bit of extra contrast to make the image more appealing. This is highly subjective.
41
41
  pipeline.imageProcessing.contrast = 1.2;
42
42
  // The ACES color correction is quite desaturating, add back a bit of punch to the colors.
43
- var curve = new ColorCurves();
43
+ const curve = new ColorCurves();
44
44
  curve.midtonesSaturation = 5;
45
45
  curve.highlightsSaturation = 15;
46
46
  pipeline.imageProcessing.colorCurves = curve;
@@ -280,7 +280,11 @@ export class CfgStretchData {
280
280
  }
281
281
  get hash() {
282
282
  if (this._hash === undefined) {
283
- this._hash = hashCode(`${this.detailLevel}-${this.measureParam}-${this.sp.asArray()}-${this.ep.asArray()}-${this.originalSpToEpLength}-${this.sections.map((section) => `${section.startAlongness}-${section.endAlongness}-${section.move}-${section.sizeChange}`)}`);
283
+ this._hash = hashCode(`${this.detailLevel}-${this.measureParam}-${this.sp.asArray().join(",")}-${this.ep
284
+ .asArray()
285
+ .join(",")}-${this.originalSpToEpLength}-${this.sections
286
+ .map((section) => `${section.startAlongness}-${section.endAlongness}-${section.move ? "Y" : "N"}-${section.sizeChange}`)
287
+ .join(",")}`);
284
288
  }
285
289
  return this._hash;
286
290
  }
@@ -227,7 +227,7 @@ function getApplyImageConversionsFunc(logger, renderEnvironment) {
227
227
  // Wrap the pure image load promise with an normal map derive promise
228
228
  gmv.im = renderEnvironment.derivedNormalMapCache.get(
229
229
  // The derivation depends on gm.amount, include it in the key. See WRD-664.
230
- textureUrl.value + "_scale_" + gm.amount, () => __awaiter(this, void 0, void 0, function* () {
230
+ `${textureUrl.value}_scale_${gm.amount}`, () => __awaiter(this, void 0, void 0, function* () {
231
231
  let image = yield gmv.im;
232
232
  if (image !== undefined) {
233
233
  image = deriveNormalMapFromHeightMap(image, gm.amount, logger);
@@ -60,7 +60,7 @@ function symComponentToGeometry(logger, renderEnvironment, component, stretchDat
60
60
  stretchDatasHash: stretchDatas.reduce((acc, stretchData) => acc + stretchData.hash, 0),
61
61
  uvMapperHash: (_a = uvMapper === null || uvMapper === void 0 ? void 0 : uvMapper.env) === null || _a === void 0 ? void 0 : _a.hash,
62
62
  };
63
- return renderEnvironment.geometryCache.get(identifierObject, () => __awaiter(this, void 0, void 0, function* () {
63
+ return renderEnvironment.geometryCache.get(identifierObject, () => {
64
64
  let mesh = undefined;
65
65
  if (component instanceof SymMesh) {
66
66
  mesh = component.mesh(logger, renderEnvironment.symMeshEnv);
@@ -76,10 +76,10 @@ function symComponentToGeometry(logger, renderEnvironment, component, stretchDat
76
76
  }
77
77
  if (mesh === undefined) {
78
78
  logger.error("SymComponent did not return a mesh", component);
79
- return undefined;
79
+ return Promise.resolve(undefined);
80
80
  }
81
- return new GeometryCacheEntry(CfgGeometry.fromATriMeshF(logger, "(Geo) " + component.id, mesh, renderEnvironment.scene, stretchDatas, uvMapper), mesh.doubleSided, mesh.lowerLeftTextureOrigin);
82
- }));
81
+ return Promise.resolve(new GeometryCacheEntry(CfgGeometry.fromATriMeshF(logger, "(Geo) " + component.id, mesh, renderEnvironment.scene, stretchDatas, uvMapper), mesh.doubleSided, mesh.lowerLeftTextureOrigin));
82
+ });
83
83
  });
84
84
  }
85
85
  export class CfgDeferredMeshNode extends CfgTransformNode {
@@ -113,7 +113,7 @@ export class CfgDeferredMeshNode extends CfgTransformNode {
113
113
  }
114
114
  let doubleSided = false;
115
115
  let backToFront = false;
116
- let flipTexture = !this._lowerLeftTextureOrigin;
116
+ const flipTexture = !this._lowerLeftTextureOrigin;
117
117
  if (this._meshDoubleSided || this._material.isDoubleSided()) {
118
118
  // Double sided can be set both by the mesh and the material, but only the material
119
119
  // controls it during rendering. Ensure we are using a material that is double sided.
@@ -205,7 +205,7 @@ export class CfgDeferredMeshNode extends CfgTransformNode {
205
205
  if (entry === undefined) {
206
206
  return undefined;
207
207
  }
208
- let geo = entry.geometry;
208
+ const geo = entry.geometry;
209
209
  if (geo === undefined) {
210
210
  return undefined;
211
211
  }
@@ -237,7 +237,7 @@ export class CfgDeferredMeshNode extends CfgTransformNode {
237
237
  this._materialLoadedPromise = this.loadMaterial();
238
238
  if (animatorCoordinator !== undefined && mtrlWithMetaData !== undefined) {
239
239
  const c = animatorCoordinator.coordinator;
240
- c.prepareForMaterialChange.bind(c)(this, animatorCoordinator.isNewProduct);
240
+ yield c.prepareForMaterialChange.bind(c)(this, animatorCoordinator.isNewProduct);
241
241
  }
242
242
  return this._materialLoadedPromise;
243
243
  });
@@ -279,7 +279,8 @@ export class CfgDeferredMeshNode extends CfgTransformNode {
279
279
  this._materialMetaData = meta;
280
280
  this._materialIsDirty = true;
281
281
  if (material && material.isTransparent) {
282
- this.startSplitGeo();
282
+ // Let this not block
283
+ void this.startSplitGeo();
283
284
  }
284
285
  });
285
286
  }
@@ -29,7 +29,7 @@ export declare class CfgProductNode extends CfgTransformNode implements Animatab
29
29
  private _originalMatrixWithModelTransform;
30
30
  private _anchorTarget;
31
31
  private _stretchedAnchorPointMatrix;
32
- readonly anchorRef: CfgAnchorRef | undefined;
32
+ anchorRef: CfgAnchorRef | undefined;
33
33
  private constructor();
34
34
  get cfgClassName(): string;
35
35
  destroy(): void;
@@ -40,6 +40,7 @@ export declare class CfgProductNode extends CfgTransformNode implements Animatab
40
40
  */
41
41
  private scheduleForRemoval;
42
42
  isDestroyed(): boolean;
43
+ private _refreshTransformAndAnchoring;
43
44
  /**
44
45
  * The passed function is recursively applied on every descendant CfgProductNode in the tree.
45
46
  * This node is included. Destroyed products are not included.
@@ -108,7 +109,7 @@ export declare class CfgProductNode extends CfgTransformNode implements Animatab
108
109
  setAnchorTarget(anchorTarget: CfgAnchorTargetNode | undefined): void;
109
110
  refreshStretch(): void;
110
111
  get originalMatrix(): Matrix;
111
- protected initTransform(): void;
112
+ protected refreshTransform(): void;
112
113
  _applyDebugSymRoots(symRootPromises: Promise<CfgSymRootNode | undefined>[]): Promise<void>;
113
114
  _addDebugMtrlApplication(debugMtrlApplication: CfgMtrlApplication): Promise<void>;
114
115
  get boundingBox(): CfgBoundingBox;
@@ -52,18 +52,15 @@ export class CfgProductNode extends CfgTransformNode {
52
52
  return result;
53
53
  };
54
54
  this.key = _product.key;
55
+ /* eslint-disable */
55
56
  // Useful debug tool:
56
57
  if (false) {
57
58
  window.product = this;
58
- console.log(`Use "window.product" to access "${this.key}" product node.`);
59
+ window[this.key] = this;
60
+ console.log(`Use "window.product" or 'window["${this.key}"]' to access "${this.key}" product node.`);
59
61
  }
60
- this.anchorRef = CfgAnchorRef.make(this._product._internal.anchor);
61
- const modelTransform = _product.transform;
62
- if (modelTransform !== undefined) {
63
- const modelSymTransform = modelTransformToSymTransform(modelTransform);
64
- this._modelMatrix = symTransformToMatrix(modelSymTransform.transform());
65
- }
66
- this.initTransform();
62
+ /* eslint-enable */
63
+ this._refreshTransformAndAnchoring();
67
64
  }
68
65
  static make(renderEnvironment, product) {
69
66
  return new this(renderEnvironment, product);
@@ -92,6 +89,16 @@ export class CfgProductNode extends CfgTransformNode {
92
89
  isDestroyed() {
93
90
  return this._destroyed;
94
91
  }
92
+ _refreshTransformAndAnchoring() {
93
+ const product = this._product._internal;
94
+ const modelTransform = product.transform;
95
+ if (modelTransform !== undefined) {
96
+ const modelSymTransform = modelTransformToSymTransform(modelTransform);
97
+ this._modelMatrix = symTransformToMatrix(modelSymTransform.transform());
98
+ }
99
+ this.anchorRef = CfgAnchorRef.make(product.anchor);
100
+ this.refreshTransform();
101
+ }
95
102
  /**
96
103
  * This function will apply either of tree passed functions on the additional products/ in the
97
104
  * passed CfgProduct and the additional products in the CfgProductNode.
@@ -141,7 +148,13 @@ export class CfgProductNode extends CfgTransformNode {
141
148
  return __awaiter(this, void 0, void 0, function* () {
142
149
  const product = this._product;
143
150
  const rootNodeSources = product._internal.rootNodeSources || [];
144
- const updateRootNodeSources = rootNodeSources.slice();
151
+ // Duplicate filter
152
+ const updateRootNodeSources = rootNodeSources.reduce((a, c) => {
153
+ if (a.every((s) => !isSameRootNodeSource(s, c))) {
154
+ a.push(c);
155
+ }
156
+ return a;
157
+ }, []);
145
158
  const allSymRootLoadings = this._symRootLoadings;
146
159
  let i = allSymRootLoadings.length;
147
160
  while (i--) {
@@ -184,7 +197,12 @@ export class CfgProductNode extends CfgTransformNode {
184
197
  .filter((symRoot) => {
185
198
  const loadInProgressIndex = allSymRootLoadings.findIndex((symRootLoadInProgress) => symRoot.isSameIdentifierTransformAndAnchor(symRootLoadInProgress.rootNodeSource));
186
199
  if (loadInProgressIndex === -1) {
187
- // This node no longer shall be added
200
+ // This node no longer needs to be added...
201
+ if (!symRoot.parent) {
202
+ // ...and was never added as a child
203
+ symRoot.destroy();
204
+ symRoot.dispose();
205
+ }
188
206
  return false;
189
207
  }
190
208
  // We'll add this, so it moves from "loading" to being a proper child
@@ -223,6 +241,7 @@ export class CfgProductNode extends CfgTransformNode {
223
241
  additionalProductLoadPromises.push(additionalProductNode.loadGeo(coordinatorWithMeta));
224
242
  },
225
243
  both: (_additionalProduct, additionalProductNode) => {
244
+ additionalProductNode._refreshTransformAndAnchoring();
226
245
  additionalProductLoadPromises.push(additionalProductNode.loadGeo(coordinatorWithMeta));
227
246
  },
228
247
  });
@@ -353,7 +372,8 @@ export class CfgProductNode extends CfgTransformNode {
353
372
  // will not be ready unless it is applied. So we wait after applying.
354
373
  yield p._awaitAllMeshMaterialsReady();
355
374
  }))()));
356
- this.flushScheduledForRemove(animationCoordinator);
375
+ // Not blocking on this
376
+ void this.flushScheduledForRemove(animationCoordinator);
357
377
  });
358
378
  }
359
379
  /**
@@ -380,8 +400,7 @@ export class CfgProductNode extends CfgTransformNode {
380
400
  const updated = updatedStretchedAnchorPointMatrix(this.anchorRef, this._anchorTarget, this._stretchedAnchorPointMatrix);
381
401
  if (updated !== undefined) {
382
402
  this._stretchedAnchorPointMatrix = updated;
383
- this._originalMatrixWithModelTransform = undefined; // Reset the matrix
384
- this.initTransform();
403
+ this.refreshTransform();
385
404
  }
386
405
  // anchoredToAnchors is sorted so that anchors always are before what
387
406
  // is anchored to them. That way we know that if we refreshStretch on
@@ -413,7 +432,8 @@ export class CfgProductNode extends CfgTransformNode {
413
432
  }
414
433
  return this._originalMatrixWithModelTransform;
415
434
  }
416
- initTransform() {
435
+ refreshTransform() {
436
+ this._originalMatrixWithModelTransform = undefined; // Reset the matrix
417
437
  this.setPreTransformMatrix(this.originalMatrix);
418
438
  }
419
439
  _applyDebugSymRoots(symRootPromises) {
@@ -435,7 +455,7 @@ export class CfgProductNode extends CfgTransformNode {
435
455
  return __awaiter(this, void 0, void 0, function* () {
436
456
  this._debugMtrlApplications.push(debugMtrlApplication);
437
457
  yield this._aggregateMaterialsPushToChildrenAndLoad();
438
- this.applyMaterials();
458
+ yield this.applyMaterials();
439
459
  this._renderEnvironment.scheduleRerender();
440
460
  });
441
461
  }
@@ -502,7 +522,7 @@ export class CfgProductNode extends CfgTransformNode {
502
522
  const body = document.getElementsByTagName("body")[0];
503
523
  body.appendChild(fileUpload);
504
524
  fileUpload.addEventListener("change", (event) => {
505
- (() => __awaiter(this, void 0, void 0, function* () {
525
+ void (() => __awaiter(this, void 0, void 0, function* () {
506
526
  const files = fileUpload.files;
507
527
  if (files !== null) {
508
528
  const mtrlApplications = yield Promise.all(Array.from(files)
@@ -194,7 +194,7 @@ export class CfgSymNode extends CfgTransformNode {
194
194
  return __awaiter(this, void 0, void 0, function* () {
195
195
  const promises = [];
196
196
  if (this._deferredMesh !== undefined) {
197
- let mtrlWithMetaData = this.findMaterial(areasToMaterials);
197
+ const mtrlWithMetaData = this.findMaterial(areasToMaterials);
198
198
  promises.push(this._deferredMesh.setMaterialAndLoad(mtrlWithMetaData, animatorCoordinator));
199
199
  }
200
200
  for (const symNodeChild of this._symNodeChildren) {
@@ -7,12 +7,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { Matrix } from "@babylonjs/core/Maths/math.vector.js";
11
10
  import { InspectableType } from "@babylonjs/core/Misc/iInspectable.js";
12
11
  import { isModel, } from "@configura/web-api";
13
12
  import { SymGfxMode } from "@configura/web-core/dist/cm/format/cmsym/components/SymComponent.js";
14
13
  import { loadSymFile, makeSymFromDex, } from "@configura/web-core/dist/cm/format/cmsym/SymNode.js";
15
14
  import { DetailLevel } from "@configura/web-core/dist/cm/geometry/DetailMask.js";
15
+ import { Point } from "@configura/web-core/dist/cm/geometry/Point.js";
16
16
  import { readFileToArrayBuffer } from "@configura/web-utilities";
17
17
  import { CfgStretchData } from "../geometry/stretch/CfgStretchData.js";
18
18
  import { CfgAnchorRef, updatedStretchedAnchorPointMatrix, } from "../utilities/anchor/anchor.js";
@@ -44,7 +44,7 @@ function getBestMatchingDetailLevel(logger, symNode, allowedLevels) {
44
44
  }
45
45
  const detailLevel = detailMask.getBestMatch(allowedLevels);
46
46
  if (detailLevel === undefined) {
47
- logger.warn("No matching DetailLevel found", `available:${Array.from(detailMask.detailSet().values())}`, `allowed:${allowedLevels}`);
47
+ logger.warn("No matching DetailLevel found", `available:${Array.from(detailMask.detailSet().values()).join(", ")}`, `allowed:${allowedLevels instanceof Array ? allowedLevels.join(", ") : allowedLevels}`);
48
48
  return DetailLevel.undefined;
49
49
  }
50
50
  return detailLevel || DetailLevel.undefined;
@@ -149,20 +149,29 @@ export class CfgSymRootNode extends CfgSymNode {
149
149
  this._originalMatrixWithModelTransform = undefined;
150
150
  }
151
151
  get originalMatrix() {
152
+ var _a, _b, _c;
152
153
  if (this._originalMatrixWithModelTransform === undefined) {
153
- let originalMatrix = super.originalMatrix;
154
- let modelMatrix = Matrix.Identity();
154
+ const matrix = super.originalMatrix.clone();
155
155
  const modelTransform = this.modelTransform;
156
156
  if (modelTransform !== undefined) {
157
157
  const modelSymTransform = modelTransformToSymTransform(modelTransform);
158
- modelMatrix = symTransformToMatrix(modelSymTransform.transform());
158
+ const modelMatrix = symTransformToMatrix(modelSymTransform.transform());
159
+ // The pivot point needs to compensate for any translation stored in the CmSym
160
+ // file. The same type of compensation is done in SymTransform#totalTransform.
161
+ let pivot = (_b = (_a = this._symNode.symTransform()) === null || _a === void 0 ? void 0 : _a.pivot) !== null && _b !== void 0 ? _b : new Point(0, 0, 0);
162
+ const pos = (_c = this._symNode.symTransform()) === null || _c === void 0 ? void 0 : _c.pos;
163
+ if (pos !== undefined) {
164
+ pivot = pivot.add(pos);
165
+ }
166
+ matrix.addTranslationFromFloats(-pivot.x, -pivot.y, -pivot.z);
167
+ matrix.multiplyToRef(modelMatrix, matrix);
168
+ matrix.addTranslationFromFloats(pivot.x, pivot.y, pivot.z);
159
169
  }
160
- originalMatrix = originalMatrix.multiply(modelMatrix);
161
170
  const stretchedAnchorPointMatrix = this._stretchedAnchorPointMatrix;
162
171
  if (stretchedAnchorPointMatrix !== undefined) {
163
- originalMatrix = originalMatrix.multiply(stretchedAnchorPointMatrix);
172
+ matrix.multiplyToRef(stretchedAnchorPointMatrix, matrix);
164
173
  }
165
- this._originalMatrixWithModelTransform = originalMatrix;
174
+ this._originalMatrixWithModelTransform = matrix;
166
175
  }
167
176
  return this._originalMatrixWithModelTransform;
168
177
  }
@@ -5,7 +5,7 @@ import "@babylonjs/core/Misc/dds.js"; // Needed for environment map
5
5
  import { Scene } from "@babylonjs/core/scene.js";
6
6
  const DEFAULT_ENV_URL = "https://catalogueapi-demo.configura.com/envmap/default.env";
7
7
  export function getDefaultScene(engine, envUrl) {
8
- var scene = new Scene(engine);
8
+ const scene = new Scene(engine);
9
9
  // If the alpha component of the clearColor is set to 0, then the color components MUST also be
10
10
  // set to 0. Otherwise the color components will sneak into transparent objects in the scene.
11
11
  //
@@ -14,7 +14,7 @@ export function getDefaultScene(engine, envUrl) {
14
14
  // zero, no matter what X is. A color like "1, 0, 0, 0" is thus not an valid premultiplied
15
15
  // color and the results is per the WebGL specs undefined.
16
16
  scene.clearColor = new Color4(0, 0, 0, 0).toLinearSpace();
17
- var hdrTexture = CubeTexture.CreateFromPrefilteredData(envUrl || DEFAULT_ENV_URL, scene);
17
+ const hdrTexture = CubeTexture.CreateFromPrefilteredData(envUrl || DEFAULT_ENV_URL, scene);
18
18
  hdrTexture.gammaSpace = false;
19
19
  scene.environmentTexture = hdrTexture;
20
20
  scene.environmentIntensity = 0.55;
@@ -8,7 +8,7 @@ export declare class CfgBoundingBox {
8
8
  */
9
9
  private _isEmpty;
10
10
  reConstruct(minimum: Vector3, maximum: Vector3): CfgBoundingBox;
11
- copyFrom(otherBoundingBox: CfgBoundingBox): CfgBoundingBox;
11
+ copyFrom(source: CfgBoundingBox): CfgBoundingBox;
12
12
  clone(): CfgBoundingBox;
13
13
  get center(): Vector3;
14
14
  translate(vec: Vector3): CfgBoundingBox;
@@ -15,9 +15,9 @@ export class CfgBoundingBox {
15
15
  this._isEmpty = false;
16
16
  return this;
17
17
  }
18
- copyFrom(otherBoundingBox) {
19
- this.reConstruct(otherBoundingBox.minimum, otherBoundingBox.maximum);
20
- this._isEmpty = otherBoundingBox.isEmpty;
18
+ copyFrom(source) {
19
+ this.reConstruct(source.minimum, source.maximum);
20
+ this._isEmpty = source.isEmpty;
21
21
  return this;
22
22
  }
23
23
  clone() {
@@ -79,7 +79,7 @@ export function makeAnchoredToAnchorMap(nodes, targetCandidateComparer) {
79
79
  const unplaced = Array.from(anchoredToAnchorMap);
80
80
  // Step 2: Build a sorted map so that parents are before their children
81
81
  const result = [];
82
- while (true) {
82
+ for (;;) {
83
83
  const candidate = unplaced.pop();
84
84
  if (candidate === undefined) {
85
85
  //done
@@ -10,10 +10,10 @@ export declare function toColor3(object: Color3 | ColorF | Color | string | numb
10
10
  * in: r,g,b in [0,1], out: h in [0,360) and s,l in [0,1]
11
11
  * Original source: https://stackoverflow.com/a/54071699/1488048
12
12
  */
13
- export declare function rgb2hsl(r: number, g: number, b: number): number[];
13
+ export declare function rgb2hsl(r: number, g: number, b: number): [number, number, number];
14
14
  /**
15
15
  * input: h in [0,360] and s,v in [0,1] - output: r,g,b in [0,1]
16
16
  * Original source: https://stackoverflow.com/a/54014428/1488048
17
17
  */
18
- export declare function hsl2rgb(h: number, s: number, l: number): number[];
18
+ export declare function hsl2rgb(h: number, s: number, l: number): [number, number, number];
19
19
  //# sourceMappingURL=utilitiesColor.d.ts.map
@@ -33,8 +33,10 @@ export function toColor3(object) {
33
33
  * Original source: https://stackoverflow.com/a/54071699/1488048
34
34
  */
35
35
  export function rgb2hsl(r, g, b) {
36
- let a = Math.max(r, g, b), n = a - Math.min(r, g, b), f = 1 - Math.abs(a + a - n - 1);
37
- let h = n && (a === r ? (g - b) / n : a === g ? 2 + (b - r) / n : 4 + (r - g) / n);
36
+ const a = Math.max(r, g, b);
37
+ const n = a - Math.min(r, g, b);
38
+ const f = 1 - Math.abs(a + a - n - 1);
39
+ const h = n && (a === r ? (g - b) / n : a === g ? 2 + (b - r) / n : 4 + (r - g) / n);
38
40
  return [60 * (h < 0 ? h + 6 : h), f ? n / f : 0, (a + a - n) / 2];
39
41
  }
40
42
  /**
@@ -42,7 +44,7 @@ export function rgb2hsl(r, g, b) {
42
44
  * Original source: https://stackoverflow.com/a/54014428/1488048
43
45
  */
44
46
  export function hsl2rgb(h, s, l) {
45
- let a = s * Math.min(l, 1 - l);
46
- let f = (n, k = (n + h / 30) % 12) => l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
47
+ const a = s * Math.min(l, 1 - l);
48
+ const f = (n, k = (n + h / 30) % 12) => l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
47
49
  return [f(0), f(8), f(4)];
48
50
  }
@@ -156,11 +156,12 @@ export class BaseView {
156
156
  this._hideInspector();
157
157
  }
158
158
  else {
159
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
159
160
  if (!this._scene.debugLayer.BJSINSPECTOR) {
160
161
  console.warn("@babylonjs/inspector has to be loaded before the Inspector can be shown.");
161
162
  return;
162
163
  }
163
- this._scene.debugLayer.show({
164
+ void this._scene.debugLayer.show({
164
165
  globalRoot: target,
165
166
  enableClose: false,
166
167
  });
@@ -208,11 +209,12 @@ export class BaseView {
208
209
  }
209
210
  this._cameraConfigurationObservable.listen(listener);
210
211
  break;
211
- case "renderEnv":
212
+ case "renderEnv": {
212
213
  const l = listener;
213
214
  this._renderEnvironmentObservable.listen(l);
214
215
  l(this._renderEnvironment);
215
216
  break;
217
+ }
216
218
  case "error":
217
219
  this._errorObservable.listen(listener);
218
220
  break;
@@ -220,7 +222,7 @@ export class BaseView {
220
222
  this._loadingObservable.listen(listener);
221
223
  break;
222
224
  default:
223
- throw Error(`Unknown event-type ${event}`);
225
+ throw Error(`Unknown event-type ${event.toString()}`);
224
226
  }
225
227
  }
226
228
  removeEventListener(event, listener) {
@@ -241,7 +243,7 @@ export class BaseView {
241
243
  this._loadingObservable.stopListen(listener);
242
244
  break;
243
245
  default:
244
- throw Error(`Unknown event-type ${event}`);
246
+ throw Error(`Unknown event-type ${event.toString()}`);
245
247
  }
246
248
  }
247
249
  scheduleRerender(dumpNextFrameToImage) {
@@ -284,14 +286,18 @@ export class BaseView {
284
286
  }
285
287
  resizeViewport(width, height) {
286
288
  this._viewportSize = [width, height];
287
- this._canvas.style.width = Math.floor(width) + "px";
288
- this._canvas.style.height = Math.floor(height) + "px";
289
+ this._canvas.style.width = `${Math.floor(width)}px`;
290
+ this._canvas.style.height = `${Math.floor(height)}px`;
289
291
  this._engine.resize();
290
292
  this.handleSizing(false);
291
293
  this.scheduleRerender();
292
294
  }
293
295
  // Exists to be overridden
294
- handleSizing(_force) { }
296
+ handleSizing(_force) {
297
+ // Do nothing
298
+ }
295
299
  // Exists to be overridden
296
- refreshCameraNearFar() { }
300
+ refreshCameraNearFar() {
301
+ // Do nothing
302
+ }
297
303
  }
@@ -1,6 +1,7 @@
1
1
  import { Vector3 } from "@babylonjs/core/Maths/math.vector.js";
2
2
  import { EventListener, Observable } from "@configura/web-utilities";
3
3
  import { CfgOrbitalCamera } from "../camera/CfgOrbitalCamera.js";
4
+ import { CfgOrbitalCameraControlProps } from "../camera/CfgOrbitalCameraControlProps.js";
4
5
  import { EngineCreator } from "../engine/EngineCreator.js";
5
6
  import { LightRigCreator } from "../light/LightRigCreator.js";
6
7
  import { DummyMaterialCreator } from "../material/DummyMaterialCreator.js";
@@ -25,9 +26,9 @@ export declare class SingleProductDefaultCameraView<T extends SingleProductDefau
25
26
  removeEventListener<K extends keyof T>(event: K, listener: EventListener<T, K>): void;
26
27
  get orbitalCameraConfiguration(): OrbitalCameraConfigurationProps;
27
28
  protected notifyCameraListeners(): void;
28
- get cameraControlObservable(): Observable<import("../index.js").CfgOrbitalCameraControlProps>;
29
+ get cameraControlObservable(): Observable<CfgOrbitalCameraControlProps>;
29
30
  protected get contentCenter(): Vector3;
30
- protected handleSizing(force: boolean): false | undefined;
31
+ protected handleSizing(force: boolean): void;
31
32
  protected refreshCameraNearFar(): void;
32
33
  protected getNeededFrameRender(time: number): boolean;
33
34
  }
@@ -117,7 +117,7 @@ export class SingleProductDefaultCameraView extends SingleProductView {
117
117
  handleSizing(force) {
118
118
  super.handleSizing(force);
119
119
  if (this._viewportSize === undefined) {
120
- return false;
120
+ return;
121
121
  }
122
122
  const currentProductNode = this.currentProductNode;
123
123
  const boundingBox = currentProductNode === undefined
@@ -27,7 +27,7 @@ export class SingleProductView extends BaseView {
27
27
  this._currentPhase = phase;
28
28
  };
29
29
  this.clearProduct = () => {
30
- let currentProductNode = this._currentProductNode;
30
+ const currentProductNode = this._currentProductNode;
31
31
  if (currentProductNode !== undefined) {
32
32
  this.notifyPhaseChange(SingleProductViewPhase.RemovePreviousProduct);
33
33
  this.scheduleForRemoval(currentProductNode);
@@ -42,7 +42,7 @@ export class SingleProductView extends BaseView {
42
42
  const stopLoading = () => {
43
43
  this._loadingObservable.stopChildLoading(loadingToken);
44
44
  };
45
- (() => __awaiter(this, void 0, void 0, function* () {
45
+ void (() => __awaiter(this, void 0, void 0, function* () {
46
46
  let isNewProduct = false;
47
47
  let currentProductNode = this._currentProductNode;
48
48
  if (currentProductNode === undefined ||
@@ -89,7 +89,8 @@ export class SingleProductView extends BaseView {
89
89
  ]);
90
90
  this.notifyPhaseChange(SingleProductViewPhase.ApplyGeo);
91
91
  yield currentProductNode.applyGeo(animationCoordinator);
92
- this.flushScheduledForRemove(animationCoordinator);
92
+ // We don't have to wait for this
93
+ void this.flushScheduledForRemove(animationCoordinator);
93
94
  if (abortSignal.aborted) {
94
95
  this.notifyPhaseChange(SingleProductViewPhase.Aborted);
95
96
  return;
@@ -189,7 +190,7 @@ export class SingleProductView extends BaseView {
189
190
  return;
190
191
  }
191
192
  const promises = [];
192
- while (true) {
193
+ for (;;) {
193
194
  const productNode = this._scheduledForRemoval.shift();
194
195
  if (productNode === undefined) {
195
196
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@configura/babylon-view",
3
- "version": "1.6.1-alpha.7",
3
+ "version": "1.6.1",
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": "1.6.1-alpha.7",
20
- "@configura/web-utilities": "1.6.1-alpha.7"
19
+ "@configura/web-core": "1.6.1",
20
+ "@configura/web-utilities": "1.6.1"
21
21
  },
22
22
  "devDependencies": {
23
- "@configura/web-api": "1.6.1-alpha.7",
23
+ "@configura/web-api": "1.6.1",
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": "b5ff49b200d294f18c4c0aff4f69b0296cff3cdf"
30
+ "gitHead": "bffef8762f32d8629a89837cafc20d34702409a3"
31
31
  }