x_ite 8.8.1 → 8.8.3

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 (54) hide show
  1. package/Makefile +1 -1
  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 +23 -23
  25. package/dist/assets/components/ParticleSystems.min.js +1 -1
  26. package/dist/assets/components/Picking.js +18 -18
  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 +72 -62
  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 +30 -30
  37. package/dist/assets/components/Texturing3D.min.js +1 -1
  38. package/dist/assets/components/VolumeRendering.js +18 -18
  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 +61 -63
  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 +4 -2
  48. package/package.json +1 -1
  49. package/src/x_ite/Base/X3DBaseNode.js +1 -1
  50. package/src/x_ite/Browser/Scripting/evaluate.js +13 -4
  51. package/src/x_ite/Browser/VERSION.js +1 -1
  52. package/src/x_ite/Browser/X3DBrowser.js +1 -3
  53. package/src/x_ite/Components/Scripting/Script.js +22 -21
  54. package/src/x_ite/Parser/VRMLParser.js +1 -1
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.8.1 # x_ite latest version
23
+ version: 8.8.3 # x_ite latest version
24
24
  size: 283 # size in kb
25
25
  x3d_latest_version: 4.0 # x3d latest version
26
26
 
@@ -391,9 +391,11 @@ The SFNode object corresponds to an X3D SFNode field.
391
391
 
392
392
  ### Instance Creation Method(s)
393
393
 
394
- #### *sfNodeObjectName* = new **SFNode** (*x3dsyntax*)
394
+ #### *sfNodeObjectName* = new **SFNode** (*vrmlSyntax*)
395
395
 
396
- *x3dsyntax* is a UTF-8 string containing the definition of an X3D node.
396
+ *vrmlSyntax* is a UTF-8 string containing the definition of an X3D node.
397
+
398
+ If the specification version is greater than 2.0, SFNode will throw an error when instantiated directly.
397
399
 
398
400
  ### Properties
399
401
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x_ite",
3
- "version": "8.8.1",
3
+ "version": "8.8.3",
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>",
@@ -81,8 +81,8 @@ function X3DBaseNode (executionContext)
81
81
  this [_childObjects] = [ ];
82
82
  this [_live] = true;
83
83
  this [_initialized] = false;
84
- this [_cloneCount] = 0;
85
84
  this [_private] = false;
85
+ this [_cloneCount] = 0;
86
86
 
87
87
  if (this .canUserDefinedFields ())
88
88
  this [_fieldDefinitions] = new FieldDefinitionArray (this [_fieldDefinitions]);
@@ -49,11 +49,20 @@ function evaluate (globalObject, sourceText)
49
49
  {
50
50
  return Function (/* js */ `with (arguments [0])
51
51
  {
52
- delete arguments [0];
53
- arguments .length = 0;
54
- ${sourceText}
52
+ return eval ((() =>
53
+ {
54
+ const sourceText = arguments [1];
55
+
56
+ delete arguments [0];
57
+ delete arguments [1];
58
+
59
+ arguments .length = 0;
60
+
61
+ return sourceText;
62
+ })
63
+ ());
55
64
  }`)
56
- (globalObject);
65
+ (globalObject, sourceText);
57
66
  }
58
67
 
59
68
  export default evaluate;
@@ -45,4 +45,4 @@
45
45
  *
46
46
  ******************************************************************************/
47
47
 
48
- export default "8.8.1";
48
+ export default "8.8.3";
@@ -384,13 +384,11 @@ Object .assign (Object .setPrototypeOf (X3DBrowser .prototype, X3DBrowserContext
384
384
  },
385
385
  createVrmlFromString (vrmlSyntax)
386
386
  {
387
- vrmlSyntax = String (vrmlSyntax);
388
-
389
387
  const
390
388
  currentScene = this .currentScene,
391
389
  external = this .isExternal (),
392
390
  fileLoader = new FileLoader (this .getWorld ()),
393
- scene = fileLoader .createX3DFromString (currentScene .getWorldURL (), vrmlSyntax);
391
+ scene = fileLoader .createX3DFromString (currentScene .getWorldURL (), `#VRML V2.0 utf8\n\n${vrmlSyntax}`);
394
392
 
395
393
  if (!external)
396
394
  {
@@ -167,7 +167,7 @@ Object .assign (Object .setPrototypeOf (Script .prototype, X3DScriptNode .protot
167
167
  }
168
168
  }
169
169
 
170
- sourceText += "\nreturn [" + callbacks .map (function (c)
170
+ sourceText += "\n[" + callbacks .map (function (c)
171
171
  {
172
172
  return `typeof ${c} !== "undefined" ? ${c} : undefined`;
173
173
  })
@@ -176,7 +176,7 @@ Object .assign (Object .setPrototypeOf (Script .prototype, X3DScriptNode .protot
176
176
  this .globalObject = this .getGlobalObject ();
177
177
 
178
178
  const
179
- result = evaluate (this .globalObject, sourceText),
179
+ result = this .evaluate (sourceText),
180
180
  context = new Map ();
181
181
 
182
182
  for (let i = 0; i < callbacks .length; ++ i)
@@ -193,36 +193,37 @@ Object .assign (Object .setPrototypeOf (Script .prototype, X3DScriptNode .protot
193
193
  },
194
194
  evaluate (sourceText)
195
195
  {
196
- return evaluate (this .globalObject, `return (${sourceText})`);
196
+ const browser = this .getBrowser ();
197
+
198
+ browser .getScriptStack () .push (this);
199
+
200
+ try
201
+ {
202
+ return evaluate (this .globalObject, sourceText);
203
+ }
204
+ finally
205
+ {
206
+ browser .getScriptStack () .pop ();
207
+ }
197
208
  },
198
209
  getGlobalObject ()
199
210
  {
200
- const
201
- browser = this .getBrowser (),
202
- executionContext = this .getExecutionContext (),
203
- live = this .getLive ();
211
+ const browser = this .getBrowser ();
204
212
 
205
213
  function SFNode (vrmlSyntax)
206
214
  {
207
- const
208
- scene = browser .createX3DFromString (String (vrmlSyntax)),
209
- rootNodes = scene .getRootNodes ();
215
+ if (browser .currentScene .specificationVersion > 2.0)
216
+ throw new Error ("SFNode cannot be instantiated directly.");
210
217
 
211
- live .addFieldInterest (scene .getLive ());
218
+ const nodes = browser .createVrmlFromString (vrmlSyntax);
212
219
 
213
- scene .setLive (live .getValue ());
214
- scene .setPrivate (executionContext .isPrivate ());
215
- scene .setExecutionContext (executionContext);
216
-
217
- if (rootNodes .length && rootNodes [0])
218
- {
219
- return rootNodes [0];
220
- }
220
+ if (nodes .length && nodes [0])
221
+ return nodes [0];
221
222
 
222
- throw new Error ("SFNode.new: invalid argument, must be 'string' is 'undefined'.");
223
+ throw new Error ("SFNode.new: invalid argument.");
223
224
  }
224
225
 
225
- Object .setPrototypeOf (SFNode .prototype, Fields .SFNode .prototype);
226
+ SFNode .prototype = Fields .SFNode .prototype;
226
227
 
227
228
  const globalObject =
228
229
  {
@@ -359,7 +359,7 @@ Object .assign (Object .setPrototypeOf (VRMLParser .prototype, X3DParser .protot
359
359
  this .getScene () .setProfile (this .getBrowser () .getProfile ("Core"));
360
360
 
361
361
  for (const componentName of VRML)
362
- this .getScene () .addComponent (this .getBrowser () .getComponent (componentName));
362
+ this .getScene () .updateComponent (this .getBrowser () .getComponent (componentName));
363
363
  }
364
364
 
365
365
  if (this .resolve)