@configura/babylon-view 1.6.1-alpha.1 → 1.6.1-alpha.2

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.
@@ -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;
@@ -58,13 +58,7 @@ export class CfgProductNode extends CfgTransformNode {
58
58
  window[this.key] = this;
59
59
  console.log(`Use "window.product" or 'window["${this.key}"]' to access "${this.key}" product node.`);
60
60
  }
61
- this.anchorRef = CfgAnchorRef.make(this._product._internal.anchor);
62
- const modelTransform = _product.transform;
63
- if (modelTransform !== undefined) {
64
- const modelSymTransform = modelTransformToSymTransform(modelTransform);
65
- this._modelMatrix = symTransformToMatrix(modelSymTransform.transform());
66
- }
67
- this.initTransform();
61
+ this._refreshTransformAndAnchoring();
68
62
  }
69
63
  static make(renderEnvironment, product) {
70
64
  return new this(renderEnvironment, product);
@@ -93,6 +87,16 @@ export class CfgProductNode extends CfgTransformNode {
93
87
  isDestroyed() {
94
88
  return this._destroyed;
95
89
  }
90
+ _refreshTransformAndAnchoring() {
91
+ const product = this._product._internal;
92
+ const modelTransform = product.transform;
93
+ if (modelTransform !== undefined) {
94
+ const modelSymTransform = modelTransformToSymTransform(modelTransform);
95
+ this._modelMatrix = symTransformToMatrix(modelSymTransform.transform());
96
+ }
97
+ this.anchorRef = CfgAnchorRef.make(product.anchor);
98
+ this.refreshTransform();
99
+ }
96
100
  /**
97
101
  * This function will apply either of tree passed functions on the additional products/ in the
98
102
  * passed CfgProduct and the additional products in the CfgProductNode.
@@ -224,6 +228,7 @@ export class CfgProductNode extends CfgTransformNode {
224
228
  additionalProductLoadPromises.push(additionalProductNode.loadGeo(coordinatorWithMeta));
225
229
  },
226
230
  both: (_additionalProduct, additionalProductNode) => {
231
+ additionalProductNode._refreshTransformAndAnchoring();
227
232
  additionalProductLoadPromises.push(additionalProductNode.loadGeo(coordinatorWithMeta));
228
233
  },
229
234
  });
@@ -381,8 +386,7 @@ export class CfgProductNode extends CfgTransformNode {
381
386
  const updated = updatedStretchedAnchorPointMatrix(this.anchorRef, this._anchorTarget, this._stretchedAnchorPointMatrix, true);
382
387
  if (updated !== undefined) {
383
388
  this._stretchedAnchorPointMatrix = updated;
384
- this._originalMatrixWithModelTransform = undefined; // Reset the matrix
385
- this.initTransform();
389
+ this.refreshTransform();
386
390
  }
387
391
  // anchoredToAnchors is sorted so that anchors always are before what
388
392
  // is anchored to them. That way we know that if we refreshStretch on
@@ -414,7 +418,8 @@ export class CfgProductNode extends CfgTransformNode {
414
418
  }
415
419
  return this._originalMatrixWithModelTransform;
416
420
  }
417
- initTransform() {
421
+ refreshTransform() {
422
+ this._originalMatrixWithModelTransform = undefined; // Reset the matrix
418
423
  this.setPreTransformMatrix(this.originalMatrix);
419
424
  }
420
425
  _applyDebugSymRoots(symRootPromises) {
@@ -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() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@configura/babylon-view",
3
- "version": "1.6.1-alpha.1",
3
+ "version": "1.6.1-alpha.2",
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.1",
20
- "@configura/web-utilities": "^1.6.1-alpha.1"
19
+ "@configura/web-core": "1.6.1-alpha.2",
20
+ "@configura/web-utilities": "1.6.1-alpha.2"
21
21
  },
22
22
  "devDependencies": {
23
- "@configura/web-api": "^1.6.1-alpha.1",
23
+ "@configura/web-api": "1.6.1-alpha.2",
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": "afaf1e342f0648246a1dcb6f7bc636d4d1979bec"
30
+ "gitHead": "e4b98f07293de3363e402a343194a9931d00732a"
31
31
  }