@configura/babylon-view 1.6.1-alpha.0 → 1.6.1-alpha.4

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
  });
@@ -378,11 +383,10 @@ export class CfgProductNode extends CfgTransformNode {
378
383
  this._anchorTarget = anchorTarget;
379
384
  }
380
385
  refreshStretch() {
381
- const updated = updatedStretchedAnchorPointMatrix(this.anchorRef, this._anchorTarget, this._stretchedAnchorPointMatrix, true);
386
+ const updated = updatedStretchedAnchorPointMatrix(this.anchorRef, this._anchorTarget, this._stretchedAnchorPointMatrix);
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) {
@@ -193,7 +193,7 @@ export class CfgSymRootNode extends CfgSymNode {
193
193
  }
194
194
  refreshStretch() {
195
195
  super.refreshStretch();
196
- const updated = updatedStretchedAnchorPointMatrix(this.anchorRef, this._anchorTarget, this._stretchedAnchorPointMatrix, false);
196
+ const updated = updatedStretchedAnchorPointMatrix(this.anchorRef, this._anchorTarget, this._stretchedAnchorPointMatrix);
197
197
  if (updated === undefined) {
198
198
  return;
199
199
  }
@@ -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() {
@@ -45,12 +45,7 @@ export declare function getRawAnchorPoint(anchorTarget: CfgAnchorTargetNode | un
45
45
  *
46
46
  * Application of anchoring happens from anchor tree root and out, so that originalMatrix of
47
47
  * anchorTarget will already have any anchoring and stretch applied.
48
- *
49
- * @param ignoreTargetTransformation If true, ignore anchorTarget's originalMatrix. This is a
50
- * workaround for that CET (as of this writing) somewhat unexpectedly mostly does not apply the
51
- * transformation when anchoring Additional Products. We have noticed some cases when it actually
52
- * apply the transform as you would expect. When the bug is solved this should be removed.
53
48
  */
54
- export declare function getStretchedAnchorPointMatrix(anchorRef: CfgAnchorRef | undefined, anchorTarget: CfgAnchorTargetNode | undefined, ignoreTargetTransformation: boolean): Matrix | undefined;
55
- export declare function updatedStretchedAnchorPointMatrix(anchorRef: CfgAnchorRef | undefined, anchorTarget: CfgAnchorTargetNode | undefined, currentStretchedAnchorPointMatrix: Matrix | undefined, ignoreTargetTransformation: boolean): Matrix | undefined;
49
+ export declare function getStretchedAnchorPointMatrix(anchorRef: CfgAnchorRef | undefined, anchorTarget: CfgAnchorTargetNode | undefined): Matrix | undefined;
50
+ export declare function updatedStretchedAnchorPointMatrix(anchorRef: CfgAnchorRef | undefined, anchorTarget: CfgAnchorTargetNode | undefined, currentStretchedAnchorPointMatrix: Matrix | undefined): Matrix | undefined;
56
51
  //# sourceMappingURL=anchor.d.ts.map
@@ -103,13 +103,8 @@ export function getRawAnchorPoint(anchorTarget, anchorRef) {
103
103
  *
104
104
  * Application of anchoring happens from anchor tree root and out, so that originalMatrix of
105
105
  * anchorTarget will already have any anchoring and stretch applied.
106
- *
107
- * @param ignoreTargetTransformation If true, ignore anchorTarget's originalMatrix. This is a
108
- * workaround for that CET (as of this writing) somewhat unexpectedly mostly does not apply the
109
- * transformation when anchoring Additional Products. We have noticed some cases when it actually
110
- * apply the transform as you would expect. When the bug is solved this should be removed.
111
106
  */
112
- export function getStretchedAnchorPointMatrix(anchorRef, anchorTarget, ignoreTargetTransformation) {
107
+ export function getStretchedAnchorPointMatrix(anchorRef, anchorTarget) {
113
108
  const rawAnchorPoint = getRawAnchorPoint(anchorTarget, anchorRef);
114
109
  if (rawAnchorPoint === undefined || anchorTarget === undefined) {
115
110
  return undefined;
@@ -118,15 +113,13 @@ export function getStretchedAnchorPointMatrix(anchorRef, anchorTarget, ignoreTar
118
113
  const stretchedAnchorPoint = toStretchedPoint(rawAnchorPoint, anchorTarget.stretchDatas, anchorTarget.cfgProductNode.product.configuration._internal
119
114
  .stretchReferenceLengthsByMeasureParamCode);
120
115
  // Sometimes, apply the anchorTarget matrix, as if the point was a child to the anchorTarget.
121
- const anchorTargetMatrixApplied = ignoreTargetTransformation
122
- ? stretchedAnchorPoint
123
- : Vector3.TransformCoordinates(stretchedAnchorPoint, anchorTarget.originalMatrix);
116
+ const anchorTargetMatrixApplied = Vector3.TransformCoordinates(stretchedAnchorPoint, anchorTarget.originalMatrix);
124
117
  // We use translation as when we anchor things we do not change their orientation,
125
118
  // we only move them to snap to this point
126
119
  return Matrix.Identity().setTranslation(anchorTargetMatrixApplied);
127
120
  }
128
- export function updatedStretchedAnchorPointMatrix(anchorRef, anchorTarget, currentStretchedAnchorPointMatrix, ignoreTargetTransformation) {
129
- const stretchedAnchorPointMatrix = getStretchedAnchorPointMatrix(anchorRef, anchorTarget, ignoreTargetTransformation);
121
+ export function updatedStretchedAnchorPointMatrix(anchorRef, anchorTarget, currentStretchedAnchorPointMatrix) {
122
+ const stretchedAnchorPointMatrix = getStretchedAnchorPointMatrix(anchorRef, anchorTarget);
130
123
  if (currentStretchedAnchorPointMatrix === undefined &&
131
124
  stretchedAnchorPointMatrix === undefined) {
132
125
  return undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@configura/babylon-view",
3
- "version": "1.6.1-alpha.0",
3
+ "version": "1.6.1-alpha.4",
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.0",
20
- "@configura/web-utilities": "^1.6.1-alpha.0"
19
+ "@configura/web-core": "1.6.1-alpha.4",
20
+ "@configura/web-utilities": "1.6.1-alpha.4"
21
21
  },
22
22
  "devDependencies": {
23
- "@configura/web-api": "^1.6.1-alpha.0",
23
+ "@configura/web-api": "1.6.1-alpha.4",
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": "aa99963ec2c2e4ab4ef1795e7ad6204fef31da75"
30
+ "gitHead": "e4dc2f02eff0ea5b4b69fa14e3ae456f505b3e58"
31
31
  }