x_ite 8.7.3 → 8.7.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.
Files changed (71) hide show
  1. package/build/bin/bump.pl +2 -0
  2. package/dist/assets/components/Annotation.js +13 -13
  3. package/dist/assets/components/Annotation.min.js +1 -1
  4. package/dist/assets/components/CADGeometry.js +13 -13
  5. package/dist/assets/components/CADGeometry.min.js +1 -1
  6. package/dist/assets/components/CubeMapTexturing.js +25 -25
  7. package/dist/assets/components/CubeMapTexturing.min.js +1 -1
  8. package/dist/assets/components/DIS.js +13 -13
  9. package/dist/assets/components/DIS.min.js +1 -1
  10. package/dist/assets/components/EventUtilities.js +9 -9
  11. package/dist/assets/components/EventUtilities.min.js +1 -1
  12. package/dist/assets/components/Geometry2D.js +19 -19
  13. package/dist/assets/components/Geometry2D.min.js +1 -1
  14. package/dist/assets/components/Geospatial.js +33 -33
  15. package/dist/assets/components/Geospatial.min.js +1 -1
  16. package/dist/assets/components/HAnim.js +18 -18
  17. package/dist/assets/components/HAnim.min.js +1 -1
  18. package/dist/assets/components/KeyDeviceSensor.js +8 -8
  19. package/dist/assets/components/KeyDeviceSensor.min.js +1 -1
  20. package/dist/assets/components/Layout.js +27 -27
  21. package/dist/assets/components/Layout.min.js +1 -1
  22. package/dist/assets/components/NURBS.js +24 -24
  23. package/dist/assets/components/NURBS.min.js +1 -1
  24. package/dist/assets/components/ParticleSystems.js +22 -22
  25. package/dist/assets/components/ParticleSystems.min.js +1 -1
  26. package/dist/assets/components/Picking.js +20 -20
  27. package/dist/assets/components/Picking.min.js +1 -1
  28. package/dist/assets/components/RigidBodyPhysics.js +18 -18
  29. package/dist/assets/components/RigidBodyPhysics.min.js +1 -1
  30. package/dist/assets/components/Scripting.js +28 -28
  31. package/dist/assets/components/Scripting.min.js +1 -1
  32. package/dist/assets/components/Text.js +24 -24
  33. package/dist/assets/components/Text.min.js +1 -1
  34. package/dist/assets/components/TextureProjector.js +14 -14
  35. package/dist/assets/components/TextureProjector.min.js +1 -1
  36. package/dist/assets/components/Texturing3D.js +31 -31
  37. package/dist/assets/components/Texturing3D.min.js +1 -1
  38. package/dist/assets/components/VolumeRendering.js +19 -19
  39. package/dist/assets/components/VolumeRendering.min.js +1 -1
  40. package/dist/assets/components/X_ITE.js +9 -9
  41. package/dist/assets/components/X_ITE.min.js +1 -1
  42. package/dist/x_ite.css +1 -1
  43. package/dist/x_ite.js +465 -344
  44. package/dist/x_ite.min.js +1 -1
  45. package/dist/x_ite.zip +0 -0
  46. package/docs/_config.yml +1 -1
  47. package/docs/_posts/reference/field-services-and-objects.md +1 -1
  48. package/package.json +2 -2
  49. package/src/x_ite/Base/FieldArray.js +3 -2
  50. package/src/x_ite/Base/FieldDefinitionArray.js +3 -2
  51. package/src/x_ite/Base/X3DArrayField.js +27 -3
  52. package/src/x_ite/Base/X3DInfoArray.js +69 -12
  53. package/src/x_ite/Base/X3DObject.js +5 -0
  54. package/src/x_ite/Browser/VERSION.js +1 -1
  55. package/src/x_ite/Browser/X3DBrowser.js +3 -3
  56. package/src/x_ite/Components/Core/X3DPrototypeInstance.js +4 -4
  57. package/src/x_ite/Components/Picking/X3DPickSensorNode.js +2 -2
  58. package/src/x_ite/Configuration/ComponentInfoArray.js +2 -2
  59. package/src/x_ite/Configuration/ProfileInfoArray.js +2 -2
  60. package/src/x_ite/Configuration/UnitInfoArray.js +15 -1
  61. package/src/x_ite/Execution/BindableList.js +1 -1
  62. package/src/x_ite/Execution/ExportedNodesArray.js +4 -3
  63. package/src/x_ite/Execution/ImportedNodesArray.js +4 -3
  64. package/src/x_ite/Execution/NamedNodesArray.js +16 -2
  65. package/src/x_ite/Execution/X3DScene.js +1 -1
  66. package/src/x_ite/Fields/SFNode.js +1 -1
  67. package/src/x_ite/InputOutput/FileLoader.js +2 -2
  68. package/src/x_ite/Parser/XMLParser.js +18 -18
  69. package/src/x_ite/Prototype/ExternProtoDeclarationArray.js +3 -2
  70. package/src/x_ite/Prototype/ProtoDeclarationArray.js +4 -3
  71. package/src/x_ite/Routing/RouteArray.js +3 -2
package/dist/x_ite.zip CHANGED
Binary file
package/docs/_config.yml CHANGED
@@ -20,7 +20,7 @@ timezone:
20
20
  # ↓ --------------------------
21
21
 
22
22
  title: X_ITE X3D Browser # the main title
23
- version: 8.7.3 # x_ite latest version
23
+ version: 8.7.4 # x_ite latest version
24
24
  size: 290 # size in kb
25
25
  x3d_latest_version: 4.0 # x3d latest version
26
26
 
@@ -814,7 +814,7 @@ Returns true if the passed MF* *array* of the same type is equals to this object
814
814
 
815
815
  #### Other Array functions
816
816
 
817
- Common Array functions like `at`, `concat`, `entries`, `every`, `fill`, `filter`, `find`, `findIndex`, `findLast`, `findLastIndex`, `flat`, `flatMap`, `forEach`, `includes`, `indexOf`, `join`, `keys`, `lastIndexOf`, `map`, `pop`, `push`, `reduce`, `reduceRight`, `reverse`, `shift`, `slice`, `some`, `sort`, `splice`, `unshift`, `values` are also available.
817
+ Common Array functions like `at`, `entries`, `every`, `fill`, `filter`, `find`, `findIndex`, `findLast`, `findLastIndex`, `forEach`, `includes`, `indexOf`, `join`, `keys`, `lastIndexOf`, `map`, `pop`, `push`, `reduce`, `reduceRight`, `reverse`, `shift`, `slice`, `some`, `sort`, `splice`, `toReversed`, `toSorted`, `toSpliced`, `unshift`, `values`, `with` are also available.
818
818
 
819
819
  ## MFBool Object
820
820
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x_ite",
3
- "version": "8.7.3",
3
+ "version": "8.7.4",
4
4
  "description": "X_ITE X3D Browser, view and manipulate X3D and VRML scenes in HTML.",
5
5
  "homepage": "https://create3000.github.io/x_ite/",
6
6
  "author": "Holger Seelig <holger.seelig@gmail.com>",
@@ -59,7 +59,7 @@
59
59
  "css-element-queries": "^1.2.3",
60
60
  "dicom-parser": "^1.8.21",
61
61
  "jpeg-js": "^0.4.4",
62
- "jpeg-lossless-decoder-js": "2.0.4",
62
+ "jpeg-lossless-decoder-js": "^2.0.7",
63
63
  "jquery": "^3.7.0",
64
64
  "jquery-fullscreen-plugin": "^1.1.5",
65
65
  "jquery-mousewheel": "^3.1.13",
@@ -46,10 +46,11 @@
46
46
  ******************************************************************************/
47
47
 
48
48
  import X3DInfoArray from "./X3DInfoArray.js";
49
+ import X3DField from "./X3DField.js";
49
50
 
50
- function FieldArray ()
51
+ function FieldArray (values)
51
52
  {
52
- return X3DInfoArray .call (this);
53
+ return X3DInfoArray .call (this, values, X3DField);
53
54
  }
54
55
 
55
56
  FieldArray .prototype = Object .assign (Object .create (X3DInfoArray .prototype),
@@ -45,11 +45,12 @@
45
45
  *
46
46
  ******************************************************************************/
47
47
 
48
- import X3DInfoArray from "./X3DInfoArray.js";
48
+ import X3DInfoArray from "./X3DInfoArray.js";
49
+ import X3DFieldDefinition from "./X3DFieldDefinition.js"
49
50
 
50
51
  function FieldDefinitionArray (values)
51
52
  {
52
- return X3DInfoArray .call (this, values);
53
+ return X3DInfoArray .call (this, values, X3DFieldDefinition);
53
54
  }
54
55
 
55
56
  FieldDefinitionArray .prototype = Object .assign (Object .create (X3DInfoArray .prototype),
@@ -64,7 +64,7 @@ X3DArrayField .prototype = Object .assign (Object .create (X3DField .prototype),
64
64
  fill: Array .prototype .fill,
65
65
  filter: function (callbackFn, thisArg)
66
66
  {
67
- return new (this .getTarget () .constructor) (... Array .prototype .filter .call (this, callbackFn, thisArg));
67
+ return new (this .constructor) (... Array .prototype .filter .call (this, callbackFn, thisArg));
68
68
  },
69
69
  find: Array .prototype .find,
70
70
  findIndex: Array .prototype .findIndex,
@@ -80,18 +80,42 @@ X3DArrayField .prototype = Object .assign (Object .create (X3DField .prototype),
80
80
  lastIndexOf: Array .prototype .lastIndexOf,
81
81
  map: function (callbackFn, thisArg)
82
82
  {
83
- return new (this .getTarget () .constructor) (... Array .prototype .map .call (this, callbackFn, thisArg));
83
+ return new (this .constructor) (... Array .prototype .map .call (this, callbackFn, thisArg));
84
84
  },
85
85
  reduce: Array .prototype .reduce,
86
86
  reduceRight: Array .prototype .reduceRight,
87
87
  reverse: Array .prototype .reverse,
88
88
  slice: function (start, end)
89
89
  {
90
- return new (this .getTarget () .constructor) (... Array .prototype .slice .call (this, start, end));
90
+ return new (this .constructor) (... Array .prototype .slice .call (this, start, end));
91
91
  },
92
92
  some: Array .prototype .some,
93
93
  sort: Array .prototype .sort,
94
+ toReversed: function ()
95
+ {
96
+ return this .copy () .reverse ();
97
+ },
98
+ toSorted: function (compareFn)
99
+ {
100
+ return this .copy () .sort (compareFn);
101
+ },
102
+ toSpliced: function (start, deleteCount, ... insertValues)
103
+ {
104
+ const copy = this .copy ();
105
+
106
+ copy .splice (start, deleteCount, ... insertValues);
107
+
108
+ return copy;
109
+ },
94
110
  values: Array .prototype .values,
111
+ with: function (index, value)
112
+ {
113
+ const copy = this .copy ();
114
+
115
+ copy [index] = value;
116
+
117
+ return copy;
118
+ },
95
119
  });
96
120
 
97
121
  for (const key of Reflect .ownKeys (X3DArrayField .prototype))
@@ -108,16 +108,20 @@ const handler =
108
108
  },
109
109
  };
110
110
 
111
- function X3DInfoArray (values)
111
+ function X3DInfoArray (values, ValueType)
112
112
  {
113
- this [_array] = [ ];
114
- this [_index] = new Map ();
115
- this [Symbol .iterator] = this [_array] [Symbol .iterator];
113
+ this [_array] = [ ];
114
+ this [_index] = new Map ();
116
115
 
117
116
  if (values)
118
117
  {
119
118
  for (const value of values)
119
+ {
120
+ if (!(value instanceof ValueType))
121
+ throw new TypeError (`Wrong type in construction of ${this .getTypeName ()}.`);
122
+
120
123
  this .add (value .name, value);
124
+ }
121
125
  }
122
126
 
123
127
  return new Proxy (this, handler);
@@ -125,11 +129,19 @@ function X3DInfoArray (values)
125
129
 
126
130
  X3DInfoArray .prototype = {
127
131
  constructor: X3DInfoArray,
132
+ [Symbol .iterator]: function* ()
133
+ {
134
+ yield* this [_array];
135
+ },
136
+ copy: function ()
137
+ {
138
+ return new (this .constructor) (this [_array]);
139
+ },
128
140
  equals: function (array)
129
141
  {
130
142
  const
131
143
  a = this [_array],
132
- b = array [_array] || array,
144
+ b = array [_array],
133
145
  length = a .length;
134
146
 
135
147
  if (a === b)
@@ -165,6 +177,8 @@ X3DInfoArray .prototype = {
165
177
  },
166
178
  update: function (oldKey, newKey, value)
167
179
  {
180
+ // TODO: update alias.
181
+
168
182
  const oldValue = this [_index] .get (oldKey);
169
183
 
170
184
  if (oldKey !== newKey)
@@ -187,6 +201,8 @@ X3DInfoArray .prototype = {
187
201
  },
188
202
  remove: function (key)
189
203
  {
204
+ // TODO: remove alias.
205
+
190
206
  const value = this [_index] .get (key);
191
207
 
192
208
  if (value === undefined)
@@ -200,29 +216,65 @@ X3DInfoArray .prototype = {
200
216
  this [_array] .splice (index, 1);
201
217
  },
202
218
  at: Array .prototype .at,
203
- concat: Array .prototype .concat,
219
+ // concat: Array .prototype .concat,
220
+ // copyWithin: Array.prototype.copyWithin,
204
221
  entries: Array .prototype .entries,
205
222
  every: Array .prototype .every,
206
- fill: Array .prototype .fill,
207
- filter: Array .prototype .filter,
223
+ // fill: Array .prototype .fill,
224
+ filter: function (callbackFn, thisArg)
225
+ {
226
+ return new (this .constructor) (Array .prototype .filter .call (this, callbackFn, thisArg));
227
+ },
208
228
  find: Array .prototype .find,
209
229
  findIndex: Array .prototype .findIndex,
210
230
  findLast: Array .prototype .findLast,
211
231
  findLastIndex: Array .prototype .findLastIndex,
212
- flat: Array .prototype .flat,
213
- flatMap: Array .prototype .flatMap,
232
+ // flat: Array .prototype .flat,
233
+ // flatMap: Array .prototype .flatMap,
214
234
  forEach: Array .prototype .forEach,
215
235
  includes: Array .prototype .includes,
216
236
  indexOf: Array .prototype .indexOf,
217
237
  join: Array .prototype .join,
218
238
  keys: Array .prototype .keys,
219
239
  lastIndexOf: Array .prototype .lastIndexOf,
220
- map: Array .prototype .map,
240
+ map: function (callbackFn, thisArg)
241
+ {
242
+ return new (this .constructor) (Array .prototype .map .call (this, callbackFn, thisArg));
243
+ },
221
244
  reduce: Array .prototype .reduce,
222
245
  reduceRight: Array .prototype .reduceRight,
223
- slice: Array .prototype .slice,
246
+ // reverse: Array .prototype .reverse,
247
+ slice: function (start, end)
248
+ {
249
+ return new (this .constructor) (Array .prototype .slice .call (this, start, end));
250
+ },
224
251
  some: Array .prototype .some,
252
+ // sort: Array .prototype .sort,
253
+ toReversed: function ()
254
+ {
255
+ return new (this .constructor) ([... this] .reverse ());
256
+ },
257
+ toSorted: function (compareFn)
258
+ {
259
+ return new (this .constructor) ([... this] .sort (compareFn));
260
+ },
261
+ toSpliced: function (start, deleteCount, ... insertValues)
262
+ {
263
+ const array = [... this];
264
+
265
+ array .splice (start, deleteCount, ... insertValues)
266
+
267
+ return new (this .constructor) (array);
268
+ },
225
269
  values: Array .prototype .values,
270
+ with: function (index, value)
271
+ {
272
+ const array = [... this];
273
+
274
+ array [index] = value;
275
+
276
+ return new (this .constructor) (array);
277
+ },
226
278
  toString: function (options = Object .prototype)
227
279
  {
228
280
  const generator = new Generator (options);
@@ -309,4 +361,9 @@ Object .defineProperty (X3DInfoArray .prototype, "length",
309
361
  get: function () { return this [_array] .length; },
310
362
  });
311
363
 
364
+ Object .defineProperty (X3DInfoArray .prototype, Symbol .toStringTag,
365
+ {
366
+ get: function () { return this .getTypeName (); },
367
+ });
368
+
312
369
  export default X3DInfoArray;
@@ -197,6 +197,11 @@ X3DObject .prototype =
197
197
  for (const key of Reflect .ownKeys (X3DObject .prototype))
198
198
  Object .defineProperty (X3DObject .prototype, key, { enumerable: false });
199
199
 
200
+ Object .defineProperty (X3DObject .prototype, Symbol .toStringTag,
201
+ {
202
+ get: function () { return this .getTypeName (); },
203
+ });
204
+
200
205
  Object .assign (X3DObject,
201
206
  {
202
207
  getId: (function ()
@@ -45,4 +45,4 @@
45
45
  *
46
46
  ******************************************************************************/
47
47
 
48
- export default "8.7.3";
48
+ export default "8.7.4";
@@ -216,9 +216,9 @@ X3DBrowser .prototype = Object .assign (Object .create (X3DBrowserContext .proto
216
216
  },
217
217
  loadComponents: (function ()
218
218
  {
219
- function loadComponents (browser, components, seen)
219
+ function loadComponents (browser, componentNames, seen)
220
220
  {
221
- return Promise .all (components .map (name => loadComponent (browser, name, seen)))
221
+ return Promise .all (componentNames .map (name => loadComponent (browser, name, seen)))
222
222
  }
223
223
 
224
224
  async function loadComponent (browser, name, seen)
@@ -244,7 +244,7 @@ X3DBrowser .prototype = Object .assign (Object .create (X3DBrowserContext .proto
244
244
  return this .loadComponents (argument .components);
245
245
 
246
246
  if (argument instanceof ComponentInfoArray)
247
- return this .loadComponents (argument .map (({name}) => name));
247
+ return this .loadComponents ([... argument] .map (({name}) => name));
248
248
 
249
249
  if (argument instanceof ComponentInfo)
250
250
  return this .loadComponents ([argument .name]);
@@ -59,7 +59,7 @@ const
59
59
  function X3DPrototypeInstance (executionContext, protoNode)
60
60
  {
61
61
  this [_protoNode] = protoNode;
62
- this [_protoFields] = new Map (protoNode .getFields () .map (f => [f, f .getName ()]));
62
+ this [_protoFields] = new Map ([... protoNode .getFields ()] .map (f => [f, f .getName ()]));
63
63
  this [_fieldDefinitions] = protoNode .getFieldDefinitions ();
64
64
  this [_body] = null;
65
65
 
@@ -197,14 +197,14 @@ X3DPrototypeInstance .prototype = Object .assign (Object .create (X3DNode .proto
197
197
 
198
198
  const
199
199
  oldProtoFields = this [_protoFields],
200
- oldFields = new Map (this .getFields () .map (f => [f .getName (), f]));
200
+ oldFields = new Map ([... this .getFields ()] .map (f => [f .getName (), f]));
201
201
 
202
202
  for (const field of oldFields .values ())
203
203
  this .removeField (field .getName ());
204
204
 
205
205
  // Add new fields.
206
206
 
207
- this [_protoFields] = new Map (this [_protoNode] .getFields () .map (f => [f, f .getName ()]));
207
+ this [_protoFields] = new Map ([... this [_protoNode] .getFields ()] .map (f => [f, f .getName ()]));
208
208
 
209
209
  for (const fieldDefinition of this .getFieldDefinitions ())
210
210
  this .addField (fieldDefinition);
@@ -268,7 +268,7 @@ X3DPrototypeInstance .prototype = Object .assign (Object .create (X3DNode .proto
268
268
 
269
269
  // Get field from new proto node.
270
270
 
271
- this [_protoFields] = new Map (protoNode .getFields () .map (f => [f, f .getName ()]));
271
+ this [_protoFields] = new Map ([... protoNode .getFields ()] .map (f => [f, f .getName ()]));
272
272
  this [_fieldDefinitions] = protoNode .getFieldDefinitions ();
273
273
  }
274
274
 
@@ -238,7 +238,7 @@ X3DPickSensorNode .prototype = Object .assign (Object .create (X3DSensorNode .pr
238
238
 
239
239
  var instance = geometryNode .getExecutionContext ();
240
240
 
241
- if (instance .getType () .indexOf (X3DConstants .X3DPrototypeInstance) !== -1 && instance .getExecutionContext () === executionContext)
241
+ if (instance .getType () .includes (X3DConstants .X3DPrototypeInstance) && instance .getExecutionContext () === executionContext)
242
242
  return instance;
243
243
 
244
244
  var pickingHierarchy = target .pickingHierarchy;
@@ -252,7 +252,7 @@ X3DPickSensorNode .prototype = Object .assign (Object .create (X3DSensorNode .pr
252
252
 
253
253
  var instance = node .getExecutionContext ();
254
254
 
255
- if (instance .getType () .indexOf (X3DConstants .X3DPrototypeInstance) !== -1 && instance .getExecutionContext () === executionContext)
255
+ if (instance .getType () .includes (X3DConstants .X3DPrototypeInstance) && instance .getExecutionContext () === executionContext)
256
256
  return instance;
257
257
  }
258
258
 
@@ -45,12 +45,12 @@
45
45
  *
46
46
  ******************************************************************************/
47
47
 
48
- import ComponentInfo from "./ComponentInfo.js";
49
48
  import X3DInfoArray from "../Base/X3DInfoArray.js";
49
+ import ComponentInfo from "./ComponentInfo.js";
50
50
 
51
51
  function ComponentInfoArray (values)
52
52
  {
53
- return X3DInfoArray .call (this, values);
53
+ return X3DInfoArray .call (this, values, ComponentInfo);
54
54
  }
55
55
 
56
56
  ComponentInfoArray .prototype = Object .assign (Object .create (X3DInfoArray .prototype),
@@ -45,13 +45,13 @@
45
45
  *
46
46
  ******************************************************************************/
47
47
 
48
+ import X3DInfoArray from "../Base/X3DInfoArray.js";
48
49
  import ComponentInfoArray from "./ComponentInfoArray.js";
49
50
  import ProfileInfo from "./ProfileInfo.js";
50
- import X3DInfoArray from "../Base/X3DInfoArray.js";
51
51
 
52
52
  function ProfileInfoArray (values)
53
53
  {
54
- return X3DInfoArray .call (this, values);
54
+ return X3DInfoArray .call (this, values, X3DInfoArray);
55
55
  }
56
56
 
57
57
  ProfileInfoArray .prototype = Object .assign (Object .create (X3DInfoArray .prototype),
@@ -46,10 +46,24 @@
46
46
  ******************************************************************************/
47
47
 
48
48
  import X3DInfoArray from "../Base/X3DInfoArray.js";
49
+ import UnitInfo from "./UnitInfo.js"
49
50
 
50
51
  function UnitInfoArray (values)
51
52
  {
52
- return X3DInfoArray .call (this, values);
53
+ const proxy = X3DInfoArray .call (this);
54
+
55
+ if (values)
56
+ {
57
+ for (const value of values)
58
+ {
59
+ if (!(value instanceof UnitInfo))
60
+ throw new TypeError (`Wrong type in construction of ${this .getTypeName ()}.`);
61
+
62
+ this .add (value .category, value);
63
+ }
64
+ }
65
+
66
+ return proxy;
53
67
  }
54
68
 
55
69
  UnitInfoArray .prototype = Object .assign (Object .create (X3DInfoArray .prototype),
@@ -151,7 +151,7 @@ BindableList .prototype = Object .assign (Object .create (X3DBaseNode .prototype
151
151
 
152
152
  for (const node of this .nodes)
153
153
  {
154
- if (collectedNodes .indexOf (node) === -1)
154
+ if (!collectedNodes .includes (node))
155
155
  removedNodes .push (node);
156
156
  }
157
157
 
@@ -45,11 +45,12 @@
45
45
  *
46
46
  ******************************************************************************/
47
47
 
48
- import X3DInfoArray from "../Base/X3DInfoArray.js";
48
+ import X3DInfoArray from "../Base/X3DInfoArray.js";
49
+ import X3DExportedNode from "./X3DExportedNode.js"
49
50
 
50
- function ExportedNodesArray (array)
51
+ function ExportedNodesArray (values)
51
52
  {
52
- return X3DInfoArray .call (this, array);
53
+ return X3DInfoArray .call (this, values, X3DExportedNode);
53
54
  }
54
55
 
55
56
  ExportedNodesArray .prototype = Object .assign (Object .create (X3DInfoArray .prototype),
@@ -45,11 +45,12 @@
45
45
  *
46
46
  ******************************************************************************/
47
47
 
48
- import X3DInfoArray from "../Base/X3DInfoArray.js";
48
+ import X3DInfoArray from "../Base/X3DInfoArray.js";
49
+ import X3DImportedNode from "./X3DImportedNode.js"
49
50
 
50
- function ImportedNodesArray (array)
51
+ function ImportedNodesArray (values)
51
52
  {
52
- return X3DInfoArray .call (this, array);
53
+ return X3DInfoArray .call (this, values, X3DImportedNode);
53
54
  }
54
55
 
55
56
  ImportedNodesArray .prototype = Object .assign (Object .create (X3DInfoArray .prototype),
@@ -46,10 +46,24 @@
46
46
  ******************************************************************************/
47
47
 
48
48
  import X3DInfoArray from "../Base/X3DInfoArray.js";
49
+ import X3DBaseNode from "../Base/X3DBaseNode.js"
49
50
 
50
- function NamedNodesArray (array)
51
+ function NamedNodesArray (values)
51
52
  {
52
- return X3DInfoArray .call (this, array);
53
+ const proxy = X3DInfoArray .call (this);
54
+
55
+ if (values)
56
+ {
57
+ for (const value of values)
58
+ {
59
+ if (!(value instanceof X3DBaseNode))
60
+ throw new TypeError (`Wrong type in construction of ${this .getTypeName ()}.`);
61
+
62
+ this .add (value .getName (), value);
63
+ }
64
+ }
65
+
66
+ return proxy;
53
67
  }
54
68
 
55
69
  NamedNodesArray .prototype = Object .assign (Object .create (X3DInfoArray .prototype),
@@ -295,7 +295,7 @@ X3DScene .prototype = Object .assign (Object .create (X3DExecutionContext .proto
295
295
  const values = this [_metadata] .get (name);
296
296
 
297
297
  if (values)
298
- return values .slice ();
298
+ return Array .from (values);
299
299
 
300
300
  return undefined;
301
301
  },
@@ -284,7 +284,7 @@ SFNode .prototype = Object .assign (Object .create (X3DField .prototype),
284
284
  value = target .getValue ();
285
285
 
286
286
  if (value)
287
- return value .getType () .slice ();
287
+ return Array .from (value .getType ());
288
288
 
289
289
  throw new Error ("SFNode.getNodeType: node is null.");
290
290
  },
@@ -64,13 +64,13 @@ const foreign = {
64
64
 
65
65
  const defaultParameter = new Fields .MFString ();
66
66
 
67
- function FileLoader (node, external)
67
+ function FileLoader (node)
68
68
  {
69
69
  X3DObject .call (this);
70
70
 
71
71
  this .node = node;
72
72
  this .browser = node .getBrowser ();
73
- this .external = external === undefined ? this .browser .isExternal () : external;
73
+ this .external = this .browser .isExternal ();
74
74
  this .executionContext = this .external ? node .getExecutionContext () : this .browser .currentScene;
75
75
  this .target = "";
76
76
  this .url = [ ];
@@ -331,10 +331,10 @@ XMLParser .prototype = Object .assign (Object .create (X3DParser .prototype),
331
331
  componentSupportLevel = parseInt (xmlElement .getAttribute ("level"));
332
332
 
333
333
  if (componentNameIdCharacters === null)
334
- return console .warn ("XML Parser Error: Bad component statement: Expected name attribute.");
334
+ return console .warn ("XML Parser Error: Bad component statement. Expected name attribute.");
335
335
 
336
336
  if (componentSupportLevel === null)
337
- return console .warn ("XML Parser Error: Bad component statement: Expected level attribute.");
337
+ return console .warn ("XML Parser Error: Bad component statement. Expected level attribute.");
338
338
 
339
339
  var component = this .getBrowser () .getComponent (componentNameIdCharacters, componentSupportLevel);
340
340
 
@@ -353,13 +353,13 @@ XMLParser .prototype = Object .assign (Object .create (X3DParser .prototype),
353
353
  conversionFactor = xmlElement .getAttribute ("conversionFactor"); //works for html5 as well
354
354
 
355
355
  if (category === null)
356
- return console .warn ("XML Parser Error: Bad unit statement: Expected category attribute.");
356
+ return console .warn ("XML Parser Error: Bad unit statement. Expected category attribute.");
357
357
 
358
358
  if (name === null)
359
- return console .warn ("XML Parser Error: Bad unit statement: Expected name attribute.");
359
+ return console .warn ("XML Parser Error: Bad unit statement. Expected name attribute.");
360
360
 
361
361
  if (conversionFactor === null)
362
- return console .warn ("XML Parser Error: Bad unit statement: Expected conversionFactor attribute.");
362
+ return console .warn ("XML Parser Error: Bad unit statement. Expected conversionFactor attribute.");
363
363
 
364
364
  this .getScene () .updateUnit (category, name, parseFloat (conversionFactor));
365
365
  },
@@ -370,10 +370,10 @@ XMLParser .prototype = Object .assign (Object .create (X3DParser .prototype),
370
370
  metavalue = xmlElement .getAttribute ("content");
371
371
 
372
372
  if (metakey === null)
373
- return console .warn ("XML Parser Error: Bad meta statement: Expected name attribute.");
373
+ return console .warn ("XML Parser Error: Bad meta statement. Expected name attribute.");
374
374
 
375
375
  if (metavalue === null)
376
- return console .warn ("XML Parser Error: Bad meta statement: Expected content attribute.");
376
+ return console .warn ("XML Parser Error: Bad meta statement. Expected content attribute.");
377
377
 
378
378
  this .getScene () .addMetaData (metakey, metavalue);
379
379
  },
@@ -450,19 +450,19 @@ XMLParser .prototype = Object .assign (Object .create (X3DParser .prototype),
450
450
  },
451
451
  externProtoDeclareElement: function (xmlElement)
452
452
  {
453
- var name = xmlElement .getAttribute ("name");
453
+ const name = xmlElement .getAttribute ("name");
454
454
 
455
455
  if (this .id (name))
456
456
  {
457
- var url = xmlElement .getAttribute ("url");
457
+ const url = xmlElement .getAttribute ("url");
458
458
 
459
- if (url === null)
460
- return console .warn ("XML Parser Error: Bad ExternProtoDeclare statement: Expected url attribute.");
459
+ this .parser .setInput (url ?? "");
460
+ this .parser .sfstringValues (this .url);
461
461
 
462
- this .parser .setInput (url);
463
- VRMLParser .prototype .sfstringValues .call (this .parser, this .url);
462
+ if (!this .url .length)
463
+ console .warn ("XML Parser Error: Bad ExternProtoDeclare statement. Expected url attribute with value.");
464
464
 
465
- var externproto = new X3DExternProtoDeclaration (this .getExecutionContext (), this .url);
465
+ const externproto = new X3DExternProtoDeclaration (this .getExecutionContext (), this .url);
466
466
 
467
467
  this .pushParent (externproto);
468
468
  this .protoInterfaceElement (xmlElement);
@@ -654,10 +654,10 @@ XMLParser .prototype = Object .assign (Object .create (X3DParser .prototype),
654
654
  protoFieldName = xmlElement .getAttribute ("protoField");
655
655
 
656
656
  if (nodeFieldName === null)
657
- return console .warn ("XML Parser Error: Bad connect statement: Expected nodeField attribute.");
657
+ return console .warn ("XML Parser Error: Bad connect statement. Expected nodeField attribute.");
658
658
 
659
659
  if (protoFieldName === null)
660
- return console .warn ("XML Parser Error: Bad connect statement: Expected protoField attribute.");
660
+ return console .warn ("XML Parser Error: Bad connect statement. Expected protoField attribute.");
661
661
 
662
662
  try
663
663
  {
@@ -687,7 +687,7 @@ XMLParser .prototype = Object .assign (Object .create (X3DParser .prototype),
687
687
  }
688
688
  catch (error)
689
689
  {
690
- console .warn ("XML Parser Error: Couldn't create IS reference: " + error .message);
690
+ console .warn ("XML Parser Error: Couldn't create IS reference. " + error .message);
691
691
  }
692
692
  },
693
693
  protoInstanceElement: function (xmlElement)
@@ -765,7 +765,7 @@ XMLParser .prototype = Object .assign (Object .create (X3DParser .prototype),
765
765
  }
766
766
  catch (error)
767
767
  {
768
- console .warn ("XML Parser Error: Couldn't assign field value: " + error .message);
768
+ console .warn ("XML Parser Error: Couldn't assign field value. " + error .message);
769
769
  }
770
770
  },
771
771
  nodeElement: function (xmlElement)
@@ -45,11 +45,12 @@
45
45
  *
46
46
  ******************************************************************************/
47
47
 
48
- import X3DInfoArray from "../Base/X3DInfoArray.js";
48
+ import X3DInfoArray from "../Base/X3DInfoArray.js";
49
+ import X3DExternProtoDeclaration from "./X3DExternProtoDeclaration.js"
49
50
 
50
51
  function ExternProtoDeclarationArray (values)
51
52
  {
52
- return X3DInfoArray .call (this, values);
53
+ return X3DInfoArray .call (this, values, X3DExternProtoDeclaration);
53
54
  }
54
55
 
55
56
  ExternProtoDeclarationArray .prototype = Object .assign (Object .create (X3DInfoArray .prototype),