x_ite 8.6.19 → 8.6.20

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 (58) hide show
  1. package/README.md +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 +22 -22
  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 +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 +30 -30
  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 +119 -110
  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/getting-started.md +18 -18
  48. package/docs/_tabs/playground.html +24 -17
  49. package/package.json +1 -1
  50. package/src/x_ite/Browser/Navigation/ExamineViewer.js +3 -0
  51. package/src/x_ite/Browser/Navigation/LookAtViewer.js +3 -0
  52. package/src/x_ite/Browser/Networking/X3DNetworkingContext.js +8 -4
  53. package/src/x_ite/Browser/VERSION.js +1 -1
  54. package/src/x_ite/Browser/X3DBrowser.js +15 -13
  55. package/src/x_ite/Execution/X3DExecutionContext.js +11 -11
  56. package/src/x_ite/InputOutput/FileLoader.js +13 -18
  57. package/src/x_ite/Prototype/X3DExternProtoDeclaration.js +5 -4
  58. package/src/x_ite/Prototype/X3DProtoDeclaration.js +4 -3
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.6.19 # x_ite latest version
23
+ version: 8.6.20 # x_ite latest version
24
24
  size: 290 # size in kb
25
25
  x3d_latest_version: 4.0 # x3d latest version
26
26
 
@@ -542,24 +542,6 @@ There is a ZIP archive available to locally install X_ITE on your server. Compre
542
542
 
543
543
  [Download X_ITE ZIP archive](https://create3000.github.io/code/x_ite/latest/x_ite.zip)
544
544
 
545
- ### You can also get it on NPM
546
-
547
- ```console
548
- $ npm install x_ite
549
- ```
550
-
551
- It can be used in [Electron](https://www.electronjs.org){:target="_blank"} apps in a preload script of the **renderer process** like this:
552
-
553
- ```js
554
- window .addEventListener ("DOMContentLoaded", () =>
555
- {
556
- const X3D = require ("x_ite")
557
- ...
558
- })
559
- ```
560
-
561
- Make sure that contextIsolation is set to **false** when creating a BrowserWindow instance.
562
-
563
545
  ### Using X_ITE with a CDN
564
546
 
565
547
  CDNs can offer a performance benefit by hosting X_ITE on servers spread across the globe. This also offers an advantage that if the visitor to your webpage has already downloaded a copy of X_ITE from the same CDN, it won't have to be re-downloaded. To use the X_ITE CDN, just reference the CSS and JavaScript file in the script element directly from the GitHub CDN or jsDelivr CDN domain.
@@ -596,6 +578,24 @@ If you are in production and everything is working well, then use a fixed versio
596
578
  <script src="https://cdn.jsdelivr.net/npm/x_ite@{{ site.version }}/dist/x_ite.min.js"></script>
597
579
  ```
598
580
 
581
+ ### You can also get it from NPM
582
+
583
+ ```console
584
+ $ npm install x_ite
585
+ ```
586
+
587
+ It can be used in [Electron](https://www.electronjs.org){:target="_blank"} apps in a preload script of the **renderer process** in a way like this:
588
+
589
+ ```js
590
+ window .addEventListener ("DOMContentLoaded", () =>
591
+ {
592
+ const X3D = require ("x_ite")
593
+ ...
594
+ })
595
+ ```
596
+
597
+ Make sure that contextIsolation is set to **false** when creating a BrowserWindow instance.
598
+
599
599
  ## Embedding X_ITE within a Web Page
600
600
 
601
601
  To display your X3D scene in a HTML5 page, first save your scene as X3D XML Encoded file, X3D JSON Encoded file, or as X3D Classic Encoded file, i.e. create a file with the extension .x3d, .x3dj, .x3dv, or .wrl.
@@ -99,9 +99,9 @@ $(function ()
99
99
  `;
100
100
 
101
101
  require .config ({ paths: { "vs": "https://cdn.jsdelivr.net/npm/monaco-editor@latest/min/vs" }});
102
- require (["vs/editor/editor.main"], () =>
102
+ require (["vs/editor/editor.main"], async () =>
103
103
  {
104
- const darkMode = (window .matchMedia && window .matchMedia ("(prefers-color-scheme: dark)") .matches || $("html") .attr ("data-mode") === "dark") && ($("html") .attr ("data-mode") !== "light");
104
+ const darkMode = (window .matchMedia ?.("(prefers-color-scheme: dark)") .matches || $("html") .attr ("data-mode") === "dark") && ($("html") .attr ("data-mode") !== "light");
105
105
 
106
106
  const editor = monaco .editor .create (document .getElementById ("editor"),
107
107
  {
@@ -115,25 +115,29 @@ $(function ()
115
115
  minimap: { enabled: false },
116
116
  });
117
117
 
118
+ const url = new URL (document .location .href) .searchParams .get ("url");
119
+
120
+ if (url)
121
+ {
122
+ const Browser = X3D .getBrowser ();
123
+
124
+ Browser .baseURL = url;
125
+
126
+ await Browser .loadURL (new X3D .MFString (url)) .catch (Function .prototype);
127
+
128
+ const encoding = { XML: "XML", JSON: "JSON", VRML: "VRML" } [Browser .currentScene .encoding] ?? "XML";
129
+
130
+ monaco .editor .setModelLanguage (editor .getModel (), encoding .toLowerCase ());
131
+
132
+ editor .setValue (Browser .currentScene [`to${encoding}String`] ());
133
+ }
134
+
118
135
  editor .getModel () .onDidChangeContent (async (event) =>
119
136
  {
120
137
  const
121
138
  Browser = X3D .getBrowser (),
122
139
  text = editor .getValue (),
123
- url = "data:," + text;
124
-
125
- if (text .match (/<\w+/))
126
- {
127
- monaco .editor .setModelLanguage (editor .getModel (), "xml");
128
- }
129
- else if (text .match (/"\w+"\s*:\s*\{/))
130
- {
131
- monaco .editor .setModelLanguage (editor .getModel (), "json");
132
- }
133
- else if (text .match (/\w+\s*\{/))
134
- {
135
- monaco .editor .setModelLanguage (editor .getModel (), "vrml");
136
- }
140
+ url = "data:," + encodeURIComponent (text);
137
141
 
138
142
  if (Browser .getActiveViewpoint ())
139
143
  {
@@ -153,9 +157,12 @@ $(function ()
153
157
  {
154
158
  await Browser .loadURL (new X3D .MFString (url)) .catch (Function .prototype);
155
159
  }
160
+
161
+ monaco .editor .setModelLanguage (editor .getModel (), Browser .currentScene .encoding .toLowerCase ());
156
162
  });
157
163
 
158
- editor .setValue (box .replace (/ {3}/g, " "));
164
+ if (!url)
165
+ editor .setValue (box .replace (/ {3}/g, " "));
159
166
  });
160
167
  })
161
168
  </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x_ite",
3
- "version": "8.6.19",
3
+ "version": "8.6.20",
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>",
@@ -533,6 +533,9 @@ ExamineViewer .prototype = Object .assign (Object .create (X3DViewer .prototype)
533
533
  event .deltaY = delta;
534
534
  event .zoomFactor = Math .abs (delta) / $(window) .width ();
535
535
 
536
+ event .pageX = (touches [0] .pageX + touches [1] .pageX) / 2;
537
+ event .pageY = (touches [0] .pageY + touches [1] .pageY) / 2;
538
+
536
539
  this .mousewheel (event);
537
540
 
538
541
  break;
@@ -370,6 +370,9 @@ LookAtViewer .prototype = Object .assign (Object .create (X3DViewer .prototype),
370
370
 
371
371
  event .deltaY = delta;
372
372
  event .zoomFactor = Math .abs (delta) / $(window) .width ();
373
+
374
+ event .pageX = (touches [0] .pageX + touches [1] .pageX) / 2;
375
+ event .pageY = (touches [0] .pageY + touches [1] .pageY) / 2;
373
376
 
374
377
  this .mousewheel (event);
375
378
  }
@@ -54,7 +54,7 @@ const
54
54
  _loadingTotal = Symbol (),
55
55
  _loadingObjects = Symbol (),
56
56
  _loading = Symbol (),
57
- _location = Symbol (),
57
+ _baseURL = Symbol (),
58
58
  _defaultScene = Symbol (),
59
59
  _set_loadCount = Symbol ();
60
60
 
@@ -77,7 +77,7 @@ function X3DNetworkingContext ()
77
77
  this [_loadingTotal] = 0;
78
78
  this [_loadingObjects] = new Set ();
79
79
  this [_loading] = false;
80
- this [_location] = getBaseURI (this .getElement () [0]);
80
+ this [_baseURL] = getBaseURI (this .getElement () [0]);
81
81
  }
82
82
 
83
83
  X3DNetworkingContext .prototype =
@@ -90,9 +90,13 @@ X3DNetworkingContext .prototype =
90
90
  {
91
91
  return URLs .getProviderUrl ();
92
92
  },
93
- getLocation: function ()
93
+ getBaseURL: function ()
94
94
  {
95
- return this [_location];
95
+ return this [_baseURL];
96
+ },
97
+ setBaseURL: function (value)
98
+ {
99
+ this [_baseURL] = String (value);
96
100
  },
97
101
  getDefaultScene: function ()
98
102
  {
@@ -45,4 +45,4 @@
45
45
  *
46
46
  ******************************************************************************/
47
47
 
48
- export default "8.6.19";
48
+ export default "8.6.20";
@@ -826,49 +826,51 @@ for (const key of Reflect .ownKeys (X3DBrowser .prototype))
826
826
 
827
827
  Object .defineProperty (X3DBrowser .prototype, "name",
828
828
  {
829
- get: function () { return this .getName (); },
829
+ get: X3DBrowser .prototype .getName,
830
830
  enumerable: true,
831
831
  configurable: false
832
832
  });
833
833
 
834
834
  Object .defineProperty (X3DBrowser .prototype, "version",
835
835
  {
836
- get: function () { return this .getVersion (); },
836
+ get: X3DBrowser .prototype .getVersion,
837
837
  enumerable: true,
838
838
  configurable: false
839
839
  });
840
840
 
841
841
  Object .defineProperty (X3DBrowser .prototype, "providerUrl",
842
842
  {
843
- get: function () { return this .getProviderUrl (); },
843
+ get: X3DBrowser .prototype .getProviderUrl,
844
844
  enumerable: true,
845
845
  configurable: false
846
846
  });
847
847
 
848
848
  Object .defineProperty (X3DBrowser .prototype, "currentFrameRate",
849
849
  {
850
- get: function () { return this .getCurrentFrameRate (); },
850
+ get: X3DBrowser .prototype .getCurrentFrameRate,
851
851
  enumerable: true,
852
852
  configurable: false
853
853
  });
854
854
 
855
855
  Object .defineProperty (X3DBrowser .prototype, "currentSpeed",
856
856
  {
857
- get: function () { return this .getCurrentSpeed (); },
857
+ get: X3DBrowser .prototype .getCurrentSpeed,
858
858
  enumerable: true,
859
859
  configurable: false
860
860
  });
861
861
 
862
862
  Object .defineProperty (X3DBrowser .prototype, "description",
863
863
  {
864
- get: function ()
865
- {
866
- return this .getDescription ();
867
- },
868
- set: function (value)
869
- {
870
- this .setDescription (value);
871
- },
864
+ get: X3DBrowser .prototype .getDescription,
865
+ set: X3DBrowser .prototype .setDescription,
866
+ enumerable: true,
867
+ configurable: false
868
+ });
869
+
870
+ Object .defineProperty (X3DBrowser .prototype, "baseURL",
871
+ {
872
+ get: X3DBrowser .prototype .getBaseURL,
873
+ set: X3DBrowser .prototype .setBaseURL,
872
874
  enumerable: true,
873
875
  configurable: false
874
876
  });
@@ -942,71 +942,71 @@ for (const key of Reflect .ownKeys (X3DExecutionContext .prototype))
942
942
 
943
943
  Object .defineProperty (X3DExecutionContext .prototype, "specificationVersion",
944
944
  {
945
- get: function () { return this .getSpecificationVersion (); },
945
+ get: X3DExecutionContext .prototype .getSpecificationVersion,
946
946
  enumerable: true,
947
947
  configurable: false
948
948
  });
949
949
 
950
950
  Object .defineProperty (X3DExecutionContext .prototype, "encoding",
951
951
  {
952
- get: function () { return this .getEncoding (); },
952
+ get: X3DExecutionContext .prototype .getEncoding,
953
953
  enumerable: true,
954
954
  configurable: false
955
955
  });
956
956
 
957
957
  Object .defineProperty (X3DExecutionContext .prototype, "profile",
958
958
  {
959
- get: function () { return this .getProfile (); },
959
+ get: X3DExecutionContext .prototype .getProfile,
960
960
  enumerable: true,
961
961
  configurable: false
962
962
  });
963
963
 
964
964
  Object .defineProperty (X3DExecutionContext .prototype, "components",
965
965
  {
966
- get: function () { return this .getComponents (); },
966
+ get: X3DExecutionContext .prototype .getComponents,
967
967
  enumerable: true,
968
968
  configurable: false
969
969
  });
970
970
 
971
971
  Object .defineProperty (X3DExecutionContext .prototype, "worldURL",
972
972
  {
973
- get: function () { return this .getWorldURL (); },
973
+ get: X3DExecutionContext .prototype .getWorldURL,
974
974
  enumerable: true,
975
975
  configurable: false
976
976
  });
977
977
 
978
978
  Object .defineProperty (X3DExecutionContext .prototype, "units",
979
979
  {
980
- get: function () { return this .getUnits (); },
980
+ get: X3DExecutionContext .prototype .getUnits,
981
981
  enumerable: true,
982
982
  configurable: false
983
983
  });
984
984
 
985
985
  Object .defineProperty (X3DExecutionContext .prototype, "rootNodes",
986
986
  {
987
- get: function () { return this .getRootNodes (); },
988
- set: function (value) { this .setRootNodes (value); },
987
+ get: X3DExecutionContext .prototype .getRootNodes,
988
+ set: X3DExecutionContext .prototype .setRootNodes,
989
989
  enumerable: true,
990
990
  configurable: false
991
991
  });
992
992
 
993
993
  Object .defineProperty (X3DExecutionContext .prototype, "protos",
994
994
  {
995
- get: function () { return this .getProtoDeclarations (); },
995
+ get: X3DExecutionContext .prototype .getProtoDeclarations,
996
996
  enumerable: true,
997
997
  configurable: false
998
998
  });
999
999
 
1000
1000
  Object .defineProperty (X3DExecutionContext .prototype, "externprotos",
1001
1001
  {
1002
- get: function () { return this .getExternProtoDeclarations (); },
1002
+ get: X3DExecutionContext .prototype .getExternProtoDeclarations,
1003
1003
  enumerable: true,
1004
1004
  configurable: false
1005
1005
  });
1006
1006
 
1007
1007
  Object .defineProperty (X3DExecutionContext .prototype, "routes",
1008
1008
  {
1009
- get: function () { return this .getRoutes (); },
1009
+ get: X3DExecutionContext .prototype .getRoutes,
1010
1010
  enumerable: true,
1011
1011
  configurable: false
1012
1012
  });
@@ -72,11 +72,10 @@ function FileLoader (node, external)
72
72
  this .browser = node .getBrowser ();
73
73
  this .external = external === undefined ? this .browser .isExternal () : external;
74
74
  this .executionContext = this .external ? node .getExecutionContext () : this .browser .currentScene;
75
- this .userAgent = this .browser .getName () + "/" + this .browser .getVersion () + " (X3D Browser; +" + this .browser .getProviderUrl () + ")";
76
75
  this .target = "";
77
76
  this .url = [ ];
78
77
  this .URL = new URL (this .getReferer (), this .getReferer ());
79
- this .fileReader = new FileReader ();
78
+ this .controller = new AbortController ();
80
79
  }
81
80
 
82
81
  FileLoader .prototype = Object .assign (Object .create (X3DObject .prototype),
@@ -84,24 +83,20 @@ FileLoader .prototype = Object .assign (Object .create (X3DObject .prototype),
84
83
  constructor: FileLoader,
85
84
  abort: function ()
86
85
  {
87
- this .callback = Function .prototype;
88
- this .bindViewpoint = Function .prototype;
89
- this .foreign = Function .prototype;
90
- },
91
- isPrivate: function ()
92
- {
93
- return true;
86
+ this .url .length = 0;
87
+
88
+ this .controller .abort ();
94
89
  },
95
- getWorldURL: function ()
90
+ getURL: function ()
96
91
  {
97
92
  return this .URL;
98
93
  },
99
94
  getReferer: function ()
100
95
  {
101
- if (this .node .getTypeName () === "X3DWorld")
96
+ if (this .node instanceof X3DWorld)
102
97
  {
103
98
  if (this .external)
104
- return this .browser .getLocation ();
99
+ return this .browser .getBaseURL ();
105
100
  }
106
101
 
107
102
  return this .executionContext .getWorldURL ();
@@ -199,7 +194,7 @@ FileLoader .prototype = Object .assign (Object .create (X3DObject .prototype),
199
194
  createX3DFromURLAsync: function (callback, data)
200
195
  {
201
196
  if (data === null)
202
- callback (null, this .URL);
197
+ callback (null);
203
198
  else
204
199
  this .createX3DFromString (this .URL, data, callback, this .loadDocumentError .bind (this));
205
200
  },
@@ -248,7 +243,7 @@ FileLoader .prototype = Object .assign (Object .create (X3DObject .prototype),
248
243
  if (result [3] === "base64")
249
244
  data = atob (data);
250
245
  else
251
- data = unescape (data);
246
+ data = decodeURIComponent (data);
252
247
 
253
248
  this .callback (data);
254
249
  return;
@@ -288,7 +283,7 @@ FileLoader .prototype = Object .assign (Object .create (X3DObject .prototype),
288
283
  // Load URL async
289
284
 
290
285
  const
291
- options = { cache: this .node .getCache () ? "default" : "reload" },
286
+ options = { cache: this .node .getCache () ? "default" : "reload", signal: this .controller .signal },
292
287
  response = this .handleErrors (await fetch (this .URL .href, options)),
293
288
  contentType = response .headers .get ("content-type") ?.replace (/;.*$/, "");
294
289
 
@@ -304,10 +299,10 @@ FileLoader .prototype = Object .assign (Object .create (X3DObject .prototype),
304
299
  },
305
300
  handleErrors: function (response)
306
301
  {
307
- if (!response .ok)
308
- throw Error (response .statusText || response .status);
302
+ if (response .ok)
303
+ return response;
309
304
 
310
- return response;
305
+ throw Error (response .statusText || response .status);
311
306
  },
312
307
  loadDocumentError: function (exception)
313
308
  {
@@ -410,21 +410,22 @@ for (const key of Reflect .ownKeys (X3DExternProtoDeclaration .prototype))
410
410
 
411
411
  Object .defineProperty (X3DExternProtoDeclaration .prototype, "name",
412
412
  {
413
- get: function () { return this .getName (); },
413
+ get: X3DExternProtoDeclaration .prototype .getName,
414
414
  enumerable: true,
415
415
  configurable: false
416
416
  });
417
417
 
418
418
  Object .defineProperty (X3DExternProtoDeclaration .prototype, "fields",
419
419
  {
420
- get: function () { return this .getFieldDefinitions (); },
420
+ get: X3DExternProtoDeclaration .prototype .getFieldDefinitions,
421
421
  enumerable: true,
422
422
  configurable: false
423
423
  });
424
424
 
425
425
  Object .defineProperty (X3DExternProtoDeclaration .prototype, "isExternProto",
426
426
  {
427
- get: function () { return true; },
427
+ value: true,
428
+ writable: false,
428
429
  enumerable: true,
429
430
  configurable: false
430
431
  });
@@ -438,7 +439,7 @@ Object .defineProperty (X3DExternProtoDeclaration .prototype, "urls",
438
439
 
439
440
  Object .defineProperty (X3DExternProtoDeclaration .prototype, "loadState",
440
441
  {
441
- get: function () { return this .checkLoadState (); },
442
+ get: X3DExternProtoDeclaration .prototype .checkLoadState,
442
443
  enumerable: true,
443
444
  configurable: false
444
445
  });
@@ -544,21 +544,22 @@ for (const key of Reflect .ownKeys (X3DProtoDeclaration .prototype))
544
544
 
545
545
  Object .defineProperty (X3DProtoDeclaration .prototype, "name",
546
546
  {
547
- get: function () { return this .getName (); },
547
+ get: X3DProtoDeclaration .prototype .getName,
548
548
  enumerable: true,
549
549
  configurable: false
550
550
  });
551
551
 
552
552
  Object .defineProperty (X3DProtoDeclaration .prototype, "fields",
553
553
  {
554
- get: function () { return this .getFieldDefinitions (); },
554
+ get: X3DProtoDeclaration .prototype .getFieldDefinitions,
555
555
  enumerable: true,
556
556
  configurable: false
557
557
  });
558
558
 
559
559
  Object .defineProperty (X3DProtoDeclaration .prototype, "isExternProto",
560
560
  {
561
- get: function () { return false; },
561
+ value: false,
562
+ writable: false,
562
563
  enumerable: true,
563
564
  configurable: false
564
565
  });