x_ite 8.7.2 → 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 (99) hide show
  1. package/.vscode/tasks.json +0 -18
  2. package/build/bin/bump.pl +2 -0
  3. package/build/bin/version.pl +16 -0
  4. package/dist/LICENSE.md +2 -16
  5. package/dist/assets/components/Annotation.js +13 -13
  6. package/dist/assets/components/Annotation.min.js +1 -1
  7. package/dist/assets/components/CADGeometry.js +13 -13
  8. package/dist/assets/components/CADGeometry.min.js +1 -1
  9. package/dist/assets/components/CubeMapTexturing.js +25 -25
  10. package/dist/assets/components/CubeMapTexturing.min.js +1 -1
  11. package/dist/assets/components/DIS.js +13 -13
  12. package/dist/assets/components/DIS.min.js +1 -1
  13. package/dist/assets/components/EventUtilities.js +9 -9
  14. package/dist/assets/components/EventUtilities.min.js +1 -1
  15. package/dist/assets/components/Geometry2D.js +19 -19
  16. package/dist/assets/components/Geometry2D.min.js +1 -1
  17. package/dist/assets/components/Geospatial.js +33 -33
  18. package/dist/assets/components/Geospatial.min.js +1 -1
  19. package/dist/assets/components/HAnim.js +18 -18
  20. package/dist/assets/components/HAnim.min.js +1 -1
  21. package/dist/assets/components/KeyDeviceSensor.js +8 -8
  22. package/dist/assets/components/KeyDeviceSensor.min.js +1 -1
  23. package/dist/assets/components/Layout.js +27 -27
  24. package/dist/assets/components/Layout.min.js +1 -1
  25. package/dist/assets/components/NURBS.js +24 -24
  26. package/dist/assets/components/NURBS.min.js +1 -1
  27. package/dist/assets/components/ParticleSystems.js +22 -22
  28. package/dist/assets/components/ParticleSystems.min.js +1 -1
  29. package/dist/assets/components/Picking.js +20 -20
  30. package/dist/assets/components/Picking.min.js +1 -1
  31. package/dist/assets/components/RigidBodyPhysics.js +18 -18
  32. package/dist/assets/components/RigidBodyPhysics.min.js +1 -1
  33. package/dist/assets/components/Scripting.js +28 -28
  34. package/dist/assets/components/Scripting.min.js +1 -1
  35. package/dist/assets/components/Text.js +24 -24
  36. package/dist/assets/components/Text.min.js +1 -1
  37. package/dist/assets/components/TextureProjector.js +14 -14
  38. package/dist/assets/components/TextureProjector.min.js +1 -1
  39. package/dist/assets/components/Texturing3D.js +31 -31
  40. package/dist/assets/components/Texturing3D.min.js +1 -1
  41. package/dist/assets/components/VolumeRendering.js +19 -19
  42. package/dist/assets/components/VolumeRendering.min.js +1 -1
  43. package/dist/assets/components/X_ITE.js +9 -9
  44. package/dist/assets/components/X_ITE.min.js +1 -1
  45. package/dist/x_ite.css +1 -1
  46. package/dist/x_ite.js +1939 -2168
  47. package/dist/x_ite.min.js +1 -1
  48. package/dist/x_ite.zip +0 -0
  49. package/docs/_config.yml +2 -2
  50. package/docs/_posts/getting-started.md +2 -0
  51. package/docs/_posts/reference/field-services-and-objects.md +1 -1
  52. package/package.json +3 -3
  53. package/src/bookmarks.js +3 -2
  54. package/src/standard/Math/Algorithm.js +18 -0
  55. package/src/x_ite/Base/FieldArray.js +3 -2
  56. package/src/x_ite/Base/FieldDefinitionArray.js +3 -2
  57. package/src/x_ite/Base/X3DArrayField.js +43 -7
  58. package/src/x_ite/Base/X3DInfoArray.js +69 -12
  59. package/src/x_ite/Base/X3DObject.js +10 -0
  60. package/src/x_ite/Base/X3DObjectArrayField.js +20 -21
  61. package/src/x_ite/Base/X3DTypedArrayField.js +86 -178
  62. package/src/x_ite/Browser/Core/BrowserOptions.js +2 -2
  63. package/src/x_ite/Browser/Core/RenderingProperties.js +1 -1
  64. package/src/x_ite/Browser/Core/X3DCoreContext.js +22 -6
  65. package/src/x_ite/Browser/DOMIntegration.js +5 -5
  66. package/src/x_ite/Browser/VERSION.js +1 -1
  67. package/src/x_ite/Browser/X3DBrowser.js +8 -10
  68. package/src/x_ite/Components/Core/X3DNode.js +0 -10
  69. package/src/x_ite/Components/Core/X3DPrototypeInstance.js +4 -4
  70. package/src/x_ite/Components/Picking/X3DPickSensorNode.js +2 -2
  71. package/src/x_ite/Configuration/ComponentInfo.js +2 -3
  72. package/src/x_ite/Configuration/ComponentInfoArray.js +2 -2
  73. package/src/x_ite/Configuration/ProfileInfoArray.js +2 -2
  74. package/src/x_ite/Configuration/UnitInfoArray.js +15 -1
  75. package/src/x_ite/Execution/BindableList.js +1 -1
  76. package/src/x_ite/Execution/ExportedNodesArray.js +4 -3
  77. package/src/x_ite/Execution/ImportedNodesArray.js +4 -3
  78. package/src/x_ite/Execution/NamedNodesArray.js +16 -2
  79. package/src/x_ite/Execution/X3DScene.js +2 -2
  80. package/src/x_ite/Fields/ArrayFields.js +13 -9
  81. package/src/x_ite/Fields/SFColor.js +4 -4
  82. package/src/x_ite/Fields/SFDouble.js +2 -2
  83. package/src/x_ite/Fields/SFFloat.js +2 -2
  84. package/src/x_ite/Fields/SFImage.js +11 -2
  85. package/src/x_ite/Fields/SFMatrixPrototypeTemplate.js +1 -1
  86. package/src/x_ite/Fields/SFNode.js +5 -1
  87. package/src/x_ite/Fields/SFRotation.js +8 -8
  88. package/src/x_ite/Fields/SFTime.js +1 -1
  89. package/src/x_ite/Fields/SFVecPrototypeTemplate.js +1 -1
  90. package/src/x_ite/InputOutput/FileLoader.js +3 -3
  91. package/src/x_ite/InputOutput/Generator.js +7 -7
  92. package/src/x_ite/Parser/JSONParser.js +4 -23
  93. package/src/x_ite/Parser/XMLParser.js +23 -29
  94. package/src/x_ite/Prototype/ExternProtoDeclarationArray.js +3 -2
  95. package/src/x_ite/Prototype/ProtoDeclarationArray.js +4 -3
  96. package/src/x_ite/Routing/RouteArray.js +3 -2
  97. package/src/x_ite/X3D.js +1 -1
  98. package/src/x_ite/X3DCanvasElement.js +0 -24
  99. package/src/x_ite.js +1 -1
@@ -799,8 +799,6 @@ X3DNode .prototype = Object .assign (Object .create (X3DBaseNode .prototype),
799
799
  },
800
800
  toJSONStream: function (generator)
801
801
  {
802
- try
803
- {
804
802
  const sharedNode = generator .IsSharedNode (this);
805
803
 
806
804
  generator .EnterScope ();
@@ -900,9 +898,6 @@ X3DNode .prototype = Object .assign (Object .create (X3DBaseNode .prototype),
900
898
  {
901
899
  if (sourceText .length !== 1)
902
900
  sourceText = null;
903
-
904
- if (sourceText && ! sourceText [0] .match (/^\s*(?:ecmascript|javascript|vrmlscript)\:/s))
905
- sourceText = null;
906
901
  }
907
902
 
908
903
 
@@ -1277,11 +1272,6 @@ X3DNode .prototype = Object .assign (Object .create (X3DBaseNode .prototype),
1277
1272
  generator .string += '}';
1278
1273
 
1279
1274
  generator .LeaveScope ();
1280
- }
1281
- catch (error)
1282
- {
1283
- console .log (error)
1284
- }
1285
1275
  },
1286
1276
  dispose: function ()
1287
1277
  {
@@ -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
 
@@ -56,10 +56,9 @@ function ComponentInfo ({ name, level, title, providerUrl, external = false, dep
56
56
  level: { value: level, enumerable: true },
57
57
  title: { value: title, enumerable: true },
58
58
  providerUrl: { value: providerUrl || URLs .getProviderUrl (external && name), enumerable: true },
59
+ external: { value: external },
60
+ dependencies: { value: dependencies },
59
61
  });
60
-
61
- $.data (this, "external", external)
62
- $.data (this, "dependencies", dependencies)
63
62
  }
64
63
 
65
64
  ComponentInfo .prototype = Object .assign (Object .create (X3DObject .prototype),
@@ -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
  },
@@ -671,7 +671,7 @@ X3DScene .prototype = Object .assign (Object .create (X3DExecutionContext .proto
671
671
  generator .string += ':';
672
672
  generator .string += generator .TidySpace ();
673
673
  generator .string += '"';
674
- generator .string += this .getSpecificationVersion ();
674
+ generator .string += LATEST_VERSION;
675
675
  generator .string += '"';
676
676
  generator .string += ',';
677
677
  generator .string += generator .TidyBreak ();
@@ -83,9 +83,9 @@ const
83
83
 
84
84
  const _cloneCount = Symbol ();
85
85
 
86
- function MFNode (value)
86
+ function MFNode (... args)
87
87
  {
88
- return X3DObjectArrayField .call (this, arguments);
88
+ return X3DObjectArrayField .call (this, args);
89
89
  }
90
90
 
91
91
  MFNode .prototype = Object .assign (Object .create (X3DObjectArrayField .prototype),
@@ -419,9 +419,9 @@ MFNode .prototype = Object .assign (Object .create (X3DObjectArrayField .prototy
419
419
  for (const key of Reflect .ownKeys (MFNode .prototype))
420
420
  Object .defineProperty (MFNode .prototype, key, { enumerable: false });
421
421
 
422
- function MFString (value)
422
+ function MFString (... args)
423
423
  {
424
- return X3DObjectArrayField .call (this, arguments);
424
+ return X3DObjectArrayField .call (this, args);
425
425
  }
426
426
 
427
427
  MFString .prototype = Object .assign (Object .create (X3DObjectArrayField .prototype),
@@ -480,11 +480,15 @@ MFString .prototype = Object .assign (Object .create (X3DObjectArrayField .proto
480
480
  for (const key of Reflect .ownKeys (MFString .prototype))
481
481
  Object .defineProperty (MFString .prototype, key, { enumerable: false });
482
482
 
483
+ /**
484
+ * MFImage
485
+ */
486
+
483
487
  function MFImageTemplate (TypeName, Type, SingleType, ValueType, ArrayType, Components)
484
488
  {
485
- function ArrayField (value)
489
+ function ArrayField (... args)
486
490
  {
487
- return X3DObjectArrayField .call (this, arguments);
491
+ return X3DObjectArrayField .call (this, args);
488
492
  }
489
493
 
490
494
  ArrayField .prototype = Object .assign (Object .create (X3DObjectArrayField .prototype),
@@ -524,9 +528,9 @@ function MFImageTemplate (TypeName, Type, SingleType, ValueType, ArrayType, Comp
524
528
 
525
529
  function TypedArrayTemplate (TypeName, Type, SingleType, ValueType, ArrayType, Components)
526
530
  {
527
- function ArrayField (value)
531
+ function ArrayField (... args)
528
532
  {
529
- return X3DTypedArrayField .call (this, arguments);
533
+ return X3DTypedArrayField .call (this, args);
530
534
  }
531
535
 
532
536
  ArrayField .prototype = Object .assign (Object .create (X3DTypedArrayField .prototype),
@@ -564,7 +568,7 @@ function TypedArrayTemplate (TypeName, Type, SingleType, ValueType, ArrayType, C
564
568
  return ArrayField;
565
569
  }
566
570
 
567
- function Value (value) { return value; }
571
+ const Value = (value) => value;
568
572
 
569
573
  const ArrayFields =
570
574
  {
@@ -134,11 +134,11 @@ SFColor .prototype = Object .assign (Object .create (X3DField .prototype),
134
134
 
135
135
  for (let i = 0; i < last; ++ i)
136
136
  {
137
- generator .string += generator .Precision (value [i]);
137
+ generator .string += generator .FloatFormat (value [i]);
138
138
  generator .string += generator .TidySpace ();
139
139
  }
140
140
 
141
- generator .string += generator .Precision (value [last]);
141
+ generator .string += generator .FloatFormat (value [last]);
142
142
  },
143
143
  toVRMLStream: function (generator)
144
144
  {
@@ -166,12 +166,12 @@ SFColor .prototype = Object .assign (Object .create (X3DField .prototype),
166
166
 
167
167
  for (let i = 0; i < last; ++ i)
168
168
  {
169
- generator .string += generator .JSONNumber (generator .Precision (value [i]));
169
+ generator .string += generator .JSONNumber (generator .FloatFormat (value [i]));
170
170
  generator .string += ',';
171
171
  generator .string += generator .TidySpace ();
172
172
  }
173
173
 
174
- generator .string += generator .JSONNumber (generator .Precision (value [last]));
174
+ generator .string += generator .JSONNumber (generator .FloatFormat (value [last]));
175
175
  },
176
176
  });
177
177
 
@@ -81,7 +81,7 @@ SFDouble .prototype = Object .assign (Object .create (X3DField .prototype),
81
81
  {
82
82
  const category = generator .Unit (this .getUnit ());
83
83
 
84
- generator .string += generator .DoublePrecision (generator .ToUnit (category, this .getValue ()));
84
+ generator .string += generator .DoubleFormat (generator .ToUnit (category, this .getValue ()));
85
85
  },
86
86
  toVRMLStream: function (generator)
87
87
  {
@@ -99,7 +99,7 @@ SFDouble .prototype = Object .assign (Object .create (X3DField .prototype),
99
99
  {
100
100
  const category = generator .Unit (this .getUnit ());
101
101
 
102
- generator .string += generator .JSONNumber (generator .DoublePrecision (generator .ToUnit (category, this .getValue ())));
102
+ generator .string += generator .JSONNumber (generator .DoubleFormat (generator .ToUnit (category, this .getValue ())));
103
103
  },
104
104
  });
105
105
 
@@ -81,7 +81,7 @@ SFFloat .prototype = Object .assign (Object .create (X3DField .prototype),
81
81
  {
82
82
  const category = generator .Unit (this .getUnit ());
83
83
 
84
- generator .string += generator .Precision (generator .ToUnit (category, this .getValue ()));
84
+ generator .string += generator .FloatFormat (generator .ToUnit (category, this .getValue ()));
85
85
  },
86
86
  toVRMLStream: function (generator)
87
87
  {
@@ -99,7 +99,7 @@ SFFloat .prototype = Object .assign (Object .create (X3DField .prototype),
99
99
  {
100
100
  const category = generator .Unit (this .getUnit ());
101
101
 
102
- generator .string += generator .JSONNumber (generator .Precision (generator .ToUnit (category, this .getValue ())));
102
+ generator .string += generator .JSONNumber (generator .FloatFormat (generator .ToUnit (category, this .getValue ())));
103
103
  },
104
104
  });
105
105
 
@@ -134,6 +134,8 @@ Image .prototype =
134
134
  * SFImage
135
135
  */
136
136
 
137
+ const _set_size = Symbol ();
138
+
137
139
  function SFImage (width, height, comp, array)
138
140
  {
139
141
  const MFInt32 = ArrayFields .MFInt32;
@@ -146,16 +148,23 @@ function SFImage (width, height, comp, array)
146
148
  X3DField .call (this, new Image (0, 0, 0, new MFInt32 ()));
147
149
 
148
150
  this .getValue () .getArray () .addParent (this);
149
- this .addInterest ("set_size__", this);
151
+ this .addInterest (_set_size, this);
150
152
  }
151
153
 
152
154
  SFImage .prototype = Object .assign (Object .create (X3DField .prototype),
153
155
  {
154
156
  constructor: SFImage,
155
- set_size__: function ()
157
+ [_set_size]: function ()
156
158
  {
157
159
  this .getValue () .getArray () .length = this .width * this .height;
158
160
  },
161
+ [Symbol .iterator]: function* ()
162
+ {
163
+ yield this .width;
164
+ yield this .height;
165
+ yield this .comp;
166
+ yield this .array;
167
+ },
159
168
  copy: function ()
160
169
  {
161
170
  return new SFImage (this .getValue () .copy ());
@@ -49,7 +49,7 @@ import X3DField from "../Base/X3DField.js";
49
49
 
50
50
  function SFMatrixPrototypeTemplate (TypeName, Type, Matrix, SFVec, double)
51
51
  {
52
- const _formatter = double ? "DoublePrecision" : "Precision";
52
+ const _formatter = double ? "DoubleFormat" : "FloatFormat";
53
53
 
54
54
  return Object .assign (Object .create (X3DField .prototype),
55
55
  {
@@ -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
  },
@@ -369,6 +369,10 @@ SFNode .prototype = Object .assign (Object .create (X3DField .prototype),
369
369
  {
370
370
  this [_target] .getValue () .setUserData (key, value);
371
371
  },
372
+ removeNodeUserData: function (key)
373
+ {
374
+ this [_target] .getValue () .removeUserData (key);
375
+ },
372
376
  valueOf: function ()
373
377
  {
374
378
  const
@@ -155,13 +155,13 @@ SFRotation .prototype = Object .assign (Object .create (X3DField .prototype),
155
155
  {
156
156
  const rotation = this .getValue ();
157
157
 
158
- generator .string += generator .DoublePrecision (rotation .x);
158
+ generator .string += generator .DoubleFormat (rotation .x);
159
159
  generator .string += generator .TidySpace ();
160
- generator .string += generator .DoublePrecision (rotation .y);
160
+ generator .string += generator .DoubleFormat (rotation .y);
161
161
  generator .string += generator .TidySpace ();
162
- generator .string += generator .DoublePrecision (rotation .z);
162
+ generator .string += generator .DoubleFormat (rotation .z);
163
163
  generator .string += generator .TidySpace ();
164
- generator .string += generator .DoublePrecision (generator .ToUnit ("angle", rotation .angle));
164
+ generator .string += generator .DoubleFormat (generator .ToUnit ("angle", rotation .angle));
165
165
  },
166
166
  toVRMLStream: function (generator)
167
167
  {
@@ -185,16 +185,16 @@ SFRotation .prototype = Object .assign (Object .create (X3DField .prototype),
185
185
  {
186
186
  const rotation = this .getValue ();
187
187
 
188
- generator .string += generator .JSONNumber (generator .DoublePrecision (rotation .x));
188
+ generator .string += generator .JSONNumber (generator .DoubleFormat (rotation .x));
189
189
  generator .string += ',';
190
190
  generator .string += generator .TidySpace ();
191
- generator .string += generator .JSONNumber (generator .DoublePrecision (rotation .y));
191
+ generator .string += generator .JSONNumber (generator .DoubleFormat (rotation .y));
192
192
  generator .string += ',';
193
193
  generator .string += generator .TidySpace ();
194
- generator .string += generator .JSONNumber (generator .DoublePrecision (rotation .z));
194
+ generator .string += generator .JSONNumber (generator .DoubleFormat (rotation .z));
195
195
  generator .string += ',';
196
196
  generator .string += generator .TidySpace ();
197
- generator .string += generator .JSONNumber (generator .DoublePrecision (generator .ToUnit ("angle", rotation .angle)));
197
+ generator .string += generator .JSONNumber (generator .DoubleFormat (generator .ToUnit ("angle", rotation .angle)));
198
198
  },
199
199
  });
200
200
 
@@ -95,7 +95,7 @@ SFTime .prototype = Object .assign (Object .create (X3DField .prototype),
95
95
  },
96
96
  toJSONStreamValue: function (generator)
97
97
  {
98
- generator .string += generator .JSONNumber (generator .DoublePrecision (this .getValue ()));
98
+ generator .string += generator .JSONNumber (generator .DoubleFormat (this .getValue ()));
99
99
  },
100
100
  });
101
101
 
@@ -49,7 +49,7 @@ import X3DField from "../Base/X3DField.js";
49
49
 
50
50
  function SFVecPrototypeTemplate (TypeName, Type, ValueType, double)
51
51
  {
52
- const _formatter = double ? "DoublePrecision" : "Precision";
52
+ const _formatter = double ? "DoubleFormat" : "FloatFormat";
53
53
 
54
54
  return Object .assign (Object .create (X3DField .prototype),
55
55
  {
@@ -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 = [ ];
@@ -243,7 +243,7 @@ FileLoader .prototype = Object .assign (Object .create (X3DObject .prototype),
243
243
  if (result [3] === "base64")
244
244
  data = atob (data);
245
245
  else
246
- data = decodeURIComponent (data);
246
+ data = unescape (data); // Don't use decodeURIComponent!
247
247
 
248
248
  this .callback (data);
249
249
  return;
@@ -231,23 +231,23 @@ Generator .prototype =
231
231
 
232
232
  return "";
233
233
  },
234
- Precision: function (value)
234
+ FloatFormat: function (value)
235
235
  {
236
236
  if (Number .isFinite (value))
237
237
  {
238
238
  const exponent = Math .log10 (Math .abs (value));
239
239
 
240
240
  if ((this .precision > exponent && exponent >= -4) || value === 0)
241
- return this .floatFormat (Math .fround (value));
241
+ return this .floatFormat (value);
242
242
 
243
- return this .floatExponentialFormat (Math .fround (value)) .toLowerCase ();
243
+ return this .floatExponentialFormat (value) .toLowerCase ();
244
244
  }
245
245
  else
246
246
  {
247
247
  return String (value);
248
248
  }
249
249
  },
250
- DoublePrecision: function (value)
250
+ DoubleFormat: function (value)
251
251
  {
252
252
  if (Number .isFinite (value))
253
253
  {
@@ -267,13 +267,13 @@ Generator .prototype =
267
267
  {
268
268
  this .executionContextStack .push (executionContext);
269
269
 
270
- if (! this .names .has (executionContext))
270
+ if (!this .names .has (executionContext))
271
271
  this .names .set (executionContext, Object .assign (new Set (), { index: 0 }));
272
272
 
273
- if (! this .importedNodesIndex .has (executionContext))
273
+ if (!this .importedNodesIndex .has (executionContext))
274
274
  this .importedNodesIndex .set (executionContext, new Set ());
275
275
 
276
- if (! this .exportedNodesIndex .has (executionContext))
276
+ if (!this .exportedNodesIndex .has (executionContext))
277
277
  this .exportedNodesIndex .set (executionContext, new Set ());
278
278
  },
279
279
  PopExecutionContext: function ()
@@ -167,7 +167,7 @@ JSONParser .prototype = Object .assign (Object .create (X3DParser .prototype),
167
167
  {
168
168
  console .error ("Trouble creating element for", key);
169
169
 
170
- child = document .createElement(key);
170
+ child = document .createElement (key);
171
171
  }
172
172
  }
173
173
 
@@ -178,28 +178,9 @@ JSONParser .prototype = Object .assign (Object .create (X3DParser .prototype),
178
178
  },
179
179
  createCDATA: function (document, element, str)
180
180
  {
181
- /**
182
- * a way to create a CDATA function or script in HTML, by using a DOM parser.
183
- */
184
-
185
- let y = str .trim ()
186
- .replace (/\\"/g, "\\\"")
187
- .replace (/&lt;/g, "<")
188
- .replace (/&gt;/g, ">")
189
- .replace (/&amp;/g, "&");
190
-
191
- do
192
- {
193
- str = y;
194
- y = str .replace (/'([^'\r\n]*)\n([^']*)'/g, "'$1\\n$2'");
195
- }
196
- while (y !== str);
197
-
198
181
  const
199
- domParser = new DOMParser(),
200
- cdataStr = "<script> <![CDATA[ " + y + " ]]> </script>", // has to be wrapped into an element
201
- scriptDoc = domParser .parseFromString (cdataStr, "application/xml"),
202
- cdata = scriptDoc .children [0] .childNodes [1]; // space after script is childNode[0]
182
+ docu = new DOMParser () .parseFromString ("<xml></xml>", "application/xml"),
183
+ cdata = docu .createCDATASection (str);
203
184
 
204
185
  element .appendChild (cdata);
205
186
  },
@@ -230,7 +211,7 @@ JSONParser .prototype = Object .assign (Object .create (X3DParser .prototype),
230
211
  }
231
212
  else if (key === "#sourceCode" || key === "@sourceCode" || key === "#sourceText")
232
213
  {
233
- this .createCDATA (document, element, object [key] .join ("\r\n") + "\r\n");
214
+ this .createCDATA (document, element, object [key] .join ("\n"));
234
215
  }
235
216
  else
236
217
  {