@configura/babylon-view 1.5.0-alpha.0 → 1.6.0-iotest.0

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.
@@ -52,6 +52,7 @@ export declare type StretchSection = {
52
52
  export declare class CfgStretchData {
53
53
  readonly detailLevel: DetailLevel;
54
54
  readonly measureParam: string;
55
+ readonly stretchSymNodeId: string;
55
56
  readonly originalReferenceLength: number | undefined;
56
57
  readonly sp: Vector3;
57
58
  readonly ep: Vector3;
@@ -68,6 +69,7 @@ export declare class CfgStretchData {
68
69
  *
69
70
  * @param detailLevel
70
71
  * @param measureParam Name of the parameter controlling the stretch
72
+ * @param stretchSymNodeId Id of the SymNode. This is used for anchoring.
71
73
  * @param originalReferenceLength Server-side calculated original referenceLength. We do not
72
74
  * actually use this for anything, but it can be handy for debug.
73
75
  * @param sp Start Point, the start anchor of the stretch line.
@@ -80,6 +80,7 @@ export class CfgStretchData {
80
80
  *
81
81
  * @param detailLevel
82
82
  * @param measureParam Name of the parameter controlling the stretch
83
+ * @param stretchSymNodeId Id of the SymNode. This is used for anchoring.
83
84
  * @param originalReferenceLength Server-side calculated original referenceLength. We do not
84
85
  * actually use this for anything, but it can be handy for debug.
85
86
  * @param sp Start Point, the start anchor of the stretch line.
@@ -91,9 +92,10 @@ export class CfgStretchData {
91
92
  * @param normalNormalized Normalized version of normal
92
93
  * @param sections The slices the model is sliced into
93
94
  */
94
- constructor(detailLevel, measureParam, originalReferenceLength, sp, ep, spToEpLength, originalSpToEpLength, normal, normalNormalized, sections) {
95
+ constructor(detailLevel, measureParam, stretchSymNodeId, originalReferenceLength, sp, ep, spToEpLength, originalSpToEpLength, normal, normalNormalized, sections) {
95
96
  this.detailLevel = detailLevel;
96
97
  this.measureParam = measureParam;
98
+ this.stretchSymNodeId = stretchSymNodeId;
97
99
  this.originalReferenceLength = originalReferenceLength;
98
100
  this.sp = sp;
99
101
  this.ep = ep;
@@ -114,6 +116,10 @@ export class CfgStretchData {
114
116
  if (measureParam === undefined) {
115
117
  throw new Error("No measureParam");
116
118
  }
119
+ const stretchSymNodeId = symNode.id;
120
+ if (stretchSymNodeId !== measureParam) {
121
+ logger.warn(`measureParam (${measureParam}) has different ID from parent symNode (${stretchSymNodeId})`);
122
+ }
117
123
  const children = symNode.children(logger, true, true);
118
124
  let sp;
119
125
  let ep;
@@ -206,7 +212,7 @@ export class CfgStretchData {
206
212
  throw new Error("Dividers for detail level missing");
207
213
  }
208
214
  const processedSections = CfgStretchData.processSections(sections, detailLevel, detailLevelGfxMode, dividerNameToPos, sp, spToEpLength, normalizedNormal);
209
- return new this(detailLevel, measureParam, originalLength, sp, ep, spToEpLength, spToEpLength, normal, normalizedNormal, processedSections);
215
+ return new this(detailLevel, measureParam, stretchSymNodeId, originalLength, sp, ep, spToEpLength, spToEpLength, normal, normalizedNormal, processedSections);
210
216
  }
211
217
  static processSections(sections, detailLevel, detailLevelGfxMode, dividerNameToPos, sp, spToEpLength, normalizedNormal) {
212
218
  // The morph target shall morph to making the morphed thing
@@ -291,7 +297,7 @@ export class CfgStretchData {
291
297
  const sp = Vector3.TransformCoordinates(this.sp, matrix);
292
298
  const ep = Vector3.TransformCoordinates(this.ep, matrix);
293
299
  const { spToEpLength, normal, normalizedNormal } = calculateNormals(sp, ep);
294
- return new CfgStretchData(this.detailLevel, this.measureParam, this.originalReferenceLength, sp, ep, spToEpLength, this.spToEpLength, normal, normalizedNormal, this.sections);
300
+ return new CfgStretchData(this.detailLevel, this.measureParam, this.stretchSymNodeId, this.originalReferenceLength, sp, ep, spToEpLength, this.spToEpLength, normal, normalizedNormal, this.sections);
295
301
  }
296
302
  /**
297
303
  * Calculates the translation of a point which moves it from its original position to where it
@@ -24,9 +24,13 @@ export declare const getAnchorTargetPriorityComparer: (measureDefinitions: CfgMe
24
24
  * clear CfgAnchorRef exists, which including only what is relevant for when used for anchoring.
25
25
  */
26
26
  export declare class CfgAnchorRef {
27
- readonly measureParamCode: string;
27
+ readonly stretchSymNodeId: string;
28
28
  readonly toSp: boolean;
29
29
  static make(m: MeasureParam | undefined): CfgAnchorRef | undefined;
30
+ /**
31
+ * The name stretchSymNodeId might seem confusing. And it is. Turns out CET is implemented so
32
+ * that it bases its anchoring on symNode Id containing the stretch. Not the measureParamId.
33
+ */
30
34
  private constructor();
31
35
  equal(other: CfgAnchorRef): boolean;
32
36
  }
@@ -49,8 +49,12 @@ export const getAnchorTargetPriorityComparer = (measureDefinitions) => (measureP
49
49
  * clear CfgAnchorRef exists, which including only what is relevant for when used for anchoring.
50
50
  */
51
51
  export class CfgAnchorRef {
52
- constructor(measureParamCode, toSp) {
53
- this.measureParamCode = measureParamCode;
52
+ /**
53
+ * The name stretchSymNodeId might seem confusing. And it is. Turns out CET is implemented so
54
+ * that it bases its anchoring on symNode Id containing the stretch. Not the measureParamId.
55
+ */
56
+ constructor(stretchSymNodeId, toSp) {
57
+ this.stretchSymNodeId = stretchSymNodeId;
54
58
  this.toSp = toSp;
55
59
  }
56
60
  static make(m) {
@@ -71,7 +75,7 @@ export class CfgAnchorRef {
71
75
  return new CfgAnchorRef(code, isSp);
72
76
  }
73
77
  equal(other) {
74
- return this.measureParamCode === other.measureParamCode && this.toSp === other.toSp;
78
+ return this.stretchSymNodeId === other.stretchSymNodeId && this.toSp === other.toSp;
75
79
  }
76
80
  }
77
81
  /** Gets the coordinates of the anchor point relative the anchor target. */
@@ -82,9 +86,9 @@ export function getRawAnchorPoint(anchorTarget, anchorRef) {
82
86
  if (anchorRef === undefined) {
83
87
  throw new Error("AnchorTo not set even though we got an anchorTarget");
84
88
  }
85
- const { measureParamCode, toSp } = anchorRef;
89
+ const { stretchSymNodeId, toSp } = anchorRef;
86
90
  const { stretchDatas } = anchorTarget;
87
- const targetStretchData = stretchDatas.find((stretchData) => measureParamCode === stretchData.measureParam);
91
+ const targetStretchData = stretchDatas.find((stretchData) => stretchSymNodeId === stretchData.stretchSymNodeId);
88
92
  if (targetStretchData === undefined) {
89
93
  throw new Error("No target stretch data for measureParamCode found");
90
94
  }
@@ -11,11 +11,11 @@
11
11
  */
12
12
  export declare function makeAnchoredToAnchorMap<A extends {
13
13
  anchorRef: {
14
- measureParamCode: string;
14
+ stretchSymNodeId: string;
15
15
  } | undefined;
16
16
  }, T extends {
17
17
  stretchDatas: {
18
- measureParam: string;
18
+ stretchSymNodeId: string;
19
19
  }[];
20
20
  }>(nodes: (A | T)[], targetCandidateComparer: (measureParamCode: string, l: T, r: T) => number): Map<A, T>;
21
21
  //# sourceMappingURL=anchorMap.d.ts.map
@@ -27,7 +27,7 @@ export function makeAnchoredToAnchorMap(nodes, targetCandidateComparer) {
27
27
  if (anchorRef === undefined) {
28
28
  continue;
29
29
  }
30
- const measureParam = anchorRef.measureParamCode;
30
+ const stretchSymNodeId = anchorRef.stretchSymNodeId;
31
31
  const targetCandidates = nodes
32
32
  .filter((n) => {
33
33
  // Ignore self
@@ -38,13 +38,13 @@ export function makeAnchoredToAnchorMap(nodes, targetCandidateComparer) {
38
38
  return false;
39
39
  }
40
40
  // Can we anchor to this node?
41
- return n.stretchDatas.some((stretchData) => measureParam === stretchData.measureParam);
41
+ return n.stretchDatas.some((stretchData) => stretchSymNodeId === stretchData.stretchSymNodeId);
42
42
  })
43
43
  .map((t, i) => ({ t, i }))
44
44
  .sort((l, r) => {
45
45
  // As sort is not stable in JS-versions older than EcmaScript 2019 we add the
46
46
  // array original index to have as a fallback when there is a draw
47
- const comp = targetCandidateComparer(anchorRef.measureParamCode, l.t, r.t);
47
+ const comp = targetCandidateComparer(anchorRef.stretchSymNodeId, l.t, r.t);
48
48
  if (comp === 0) {
49
49
  return l.i - r.i;
50
50
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@configura/babylon-view",
3
- "version": "1.5.0-alpha.0",
3
+ "version": "1.6.0-iotest.0",
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.5.0-alpha.0",
20
- "@configura/web-utilities": "^1.5.0-alpha.0"
19
+ "@configura/web-core": "1.6.0-iotest.0",
20
+ "@configura/web-utilities": "1.6.0-iotest.0"
21
21
  },
22
22
  "devDependencies": {
23
- "@configura/web-api": "^1.5.0-alpha.0",
23
+ "@configura/web-api": "1.6.0-iotest.0",
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": "6e24920b36ac225b17fcb519c0f4b7c6af924fbd"
30
+ "gitHead": "afcb290fa6c4a3f87ab1b4ac781bd704acaa0ad9"
31
31
  }