x_ite 8.7.1 → 8.7.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 (86) hide show
  1. package/.vscode/tasks.json +0 -18
  2. package/Makefile +4 -1
  3. package/build/bin/bump.pl +16 -0
  4. package/build/bin/version.pl +32 -13
  5. package/dist/LICENSE.md +2 -16
  6. package/dist/assets/components/Annotation.js +13 -13
  7. package/dist/assets/components/Annotation.min.js +1 -1
  8. package/dist/assets/components/CADGeometry.js +13 -13
  9. package/dist/assets/components/CADGeometry.min.js +1 -1
  10. package/dist/assets/components/CubeMapTexturing.js +25 -25
  11. package/dist/assets/components/CubeMapTexturing.min.js +1 -1
  12. package/dist/assets/components/DIS.js +13 -13
  13. package/dist/assets/components/DIS.min.js +1 -1
  14. package/dist/assets/components/EventUtilities.js +9 -9
  15. package/dist/assets/components/EventUtilities.min.js +1 -1
  16. package/dist/assets/components/Geometry2D.js +19 -19
  17. package/dist/assets/components/Geometry2D.min.js +1 -1
  18. package/dist/assets/components/Geospatial.js +33 -33
  19. package/dist/assets/components/Geospatial.min.js +1 -1
  20. package/dist/assets/components/HAnim.js +18 -18
  21. package/dist/assets/components/HAnim.min.js +1 -1
  22. package/dist/assets/components/KeyDeviceSensor.js +8 -8
  23. package/dist/assets/components/KeyDeviceSensor.min.js +1 -1
  24. package/dist/assets/components/Layout.js +27 -27
  25. package/dist/assets/components/Layout.min.js +1 -1
  26. package/dist/assets/components/NURBS.js +24 -24
  27. package/dist/assets/components/NURBS.min.js +1 -1
  28. package/dist/assets/components/ParticleSystems.js +22 -22
  29. package/dist/assets/components/ParticleSystems.min.js +1 -1
  30. package/dist/assets/components/Picking.js +18 -18
  31. package/dist/assets/components/Picking.min.js +1 -1
  32. package/dist/assets/components/RigidBodyPhysics.js +18 -18
  33. package/dist/assets/components/RigidBodyPhysics.min.js +1 -1
  34. package/dist/assets/components/Scripting.js +28 -28
  35. package/dist/assets/components/Scripting.min.js +1 -1
  36. package/dist/assets/components/Text.js +24 -24
  37. package/dist/assets/components/Text.min.js +1 -1
  38. package/dist/assets/components/TextureProjector.js +14 -14
  39. package/dist/assets/components/TextureProjector.min.js +1 -1
  40. package/dist/assets/components/Texturing3D.js +30 -30
  41. package/dist/assets/components/Texturing3D.min.js +1 -1
  42. package/dist/assets/components/VolumeRendering.js +19 -19
  43. package/dist/assets/components/VolumeRendering.min.js +1 -1
  44. package/dist/assets/components/X_ITE.js +9 -9
  45. package/dist/assets/components/X_ITE.min.js +1 -1
  46. package/dist/x_ite.css +1 -1
  47. package/dist/x_ite.js +1265 -1611
  48. package/dist/x_ite.min.js +1 -1
  49. package/dist/x_ite.zip +0 -0
  50. package/docs/_config.yml +2 -2
  51. package/docs/_posts/getting-started.md +2 -0
  52. package/package.json +2 -2
  53. package/src/assets/shaders/webgl1/include/Fragment.glsl.js +4 -2
  54. package/src/assets/shaders/webgl2/include/Fragment.glsl.js +4 -2
  55. package/src/bookmarks.js +3 -2
  56. package/src/standard/Math/Algorithm.js +18 -0
  57. package/src/x_ite/Base/X3DArrayField.js +19 -7
  58. package/src/x_ite/Base/X3DObject.js +5 -0
  59. package/src/x_ite/Base/X3DObjectArrayField.js +20 -21
  60. package/src/x_ite/Base/X3DTypedArrayField.js +86 -178
  61. package/src/x_ite/Browser/Core/BrowserOptions.js +2 -2
  62. package/src/x_ite/Browser/Core/RenderingProperties.js +1 -1
  63. package/src/x_ite/Browser/Core/X3DCoreContext.js +22 -6
  64. package/src/x_ite/Browser/DOMIntegration.js +5 -5
  65. package/src/x_ite/Browser/VERSION.js +1 -1
  66. package/src/x_ite/Browser/X3DBrowser.js +5 -7
  67. package/src/x_ite/Components/Core/X3DNode.js +0 -10
  68. package/src/x_ite/Configuration/ComponentInfo.js +2 -3
  69. package/src/x_ite/Execution/X3DScene.js +1 -1
  70. package/src/x_ite/Fields/ArrayFields.js +13 -9
  71. package/src/x_ite/Fields/SFColor.js +4 -4
  72. package/src/x_ite/Fields/SFDouble.js +2 -2
  73. package/src/x_ite/Fields/SFFloat.js +2 -2
  74. package/src/x_ite/Fields/SFImage.js +11 -2
  75. package/src/x_ite/Fields/SFMatrixPrototypeTemplate.js +1 -1
  76. package/src/x_ite/Fields/SFNode.js +4 -0
  77. package/src/x_ite/Fields/SFRotation.js +8 -8
  78. package/src/x_ite/Fields/SFTime.js +1 -1
  79. package/src/x_ite/Fields/SFVecPrototypeTemplate.js +1 -1
  80. package/src/x_ite/InputOutput/FileLoader.js +1 -1
  81. package/src/x_ite/InputOutput/Generator.js +7 -7
  82. package/src/x_ite/Parser/JSONParser.js +4 -23
  83. package/src/x_ite/Parser/XMLParser.js +5 -11
  84. package/src/x_ite/X3D.js +1 -1
  85. package/src/x_ite/X3DCanvasElement.js +0 -24
  86. package/src/x_ite.js +1 -1
@@ -50,9 +50,13 @@ import Algorithm from "../../standard/Math/Algorithm.js";
50
50
 
51
51
  const
52
52
  _target = Symbol (),
53
+ _proxy = Symbol (),
53
54
  _cache = Symbol (),
54
55
  _tmp = Symbol (),
55
- _length = Symbol ();
56
+ _length = Symbol (),
57
+ _insert = Symbol (),
58
+ _erase = Symbol (),
59
+ _grow = Symbol ();
56
60
 
57
61
  const handler =
58
62
  {
@@ -87,26 +91,8 @@ const handler =
87
91
  {
88
92
  // Return reference to index.
89
93
 
90
- const value = target [_cache] [index];
91
-
92
- if (value)
93
- {
94
- return value;
95
- }
96
- else
97
- {
98
- const
99
- value = new valueType (),
100
- internalValue = value .getValue (),
101
- i = index * components;
102
-
103
- value .addEvent = addEvent .bind (target, i, components, internalValue);
104
- value .getValue = getValue .bind (target, i, components, internalValue);
105
-
106
- target [_cache] [index] = value;
107
-
108
- return value;
109
- }
94
+ return target [_cache] [index]
95
+ ?? (target [_cache] [index] = createValue (target, index, components, valueType));
110
96
  }
111
97
  }
112
98
  else
@@ -134,7 +120,9 @@ const handler =
134
120
 
135
121
  if (components === 1)
136
122
  {
137
- array [index] = value;
123
+ const valueType = target .getValueType ();
124
+
125
+ array [index] = valueType (value);
138
126
  }
139
127
  else
140
128
  {
@@ -176,11 +164,14 @@ const handler =
176
164
  },
177
165
  };
178
166
 
179
- function X3DTypedArrayField (value)
167
+ function X3DTypedArrayField (args)
180
168
  {
181
169
  X3DArrayField .call (this, new (this .getArrayType ()) (16));
182
170
 
171
+ const proxy = new Proxy (this, handler);
172
+
183
173
  this [_target] = this;
174
+ this [_proxy] = proxy;
184
175
 
185
176
  if (this .getComponents () > 1)
186
177
  {
@@ -188,12 +179,9 @@ function X3DTypedArrayField (value)
188
179
  this [_tmp] = [ ]; // Array with components size.
189
180
  }
190
181
 
191
- if (value [0] instanceof Array)
192
- value = value [0];
193
-
194
- X3DTypedArrayField .prototype .push .apply (this, value);
182
+ X3DTypedArrayField .prototype .push .call (this, ... args);
195
183
 
196
- return new Proxy (this, handler);
184
+ return proxy;
197
185
  }
198
186
 
199
187
  X3DTypedArrayField .prototype = Object .assign (Object .create (X3DArrayField .prototype),
@@ -222,29 +210,13 @@ X3DTypedArrayField .prototype = Object .assign (Object .create (X3DArrayField .p
222
210
  {
223
211
  // Return reference to index.
224
212
 
213
+ const cache = target [_cache];
214
+
225
215
  for (let index = 0; index < length; ++ index)
226
216
  {
227
- const value = target [_cache] [index];
228
-
229
- if (value)
230
- {
231
- yield value;
232
- }
233
- else
234
- {
235
- const
236
- value = new valueType (),
237
- internalValue = value .getValue (),
238
- i = index * components;
239
-
240
- value .addEvent = addEvent .bind (target, i, components, internalValue);
241
- value .getValue = getValue .bind (target, i, components, internalValue);
242
-
243
- target [_cache] [index] = value;
244
-
245
- yield value;
246
- }
247
- }
217
+ yield cache [index]
218
+ ?? (cache [index] = createValue (target, index, components, valueType));
219
+ }
248
220
  }
249
221
  },
250
222
  getTarget: function ()
@@ -269,19 +241,20 @@ X3DTypedArrayField .prototype = Object .assign (Object .create (X3DArrayField .p
269
241
  },
270
242
  equals: function (other)
271
243
  {
272
- if (this === other)
273
- return true;
274
-
275
244
  const
276
- target = this [_target],
277
- length = target [_length];
245
+ target = this [_target],
246
+ otherTarget = other [_target],
247
+ length = target [_length];
248
+
249
+ if (target === otherTarget)
250
+ return true;
278
251
 
279
- if (length !== other [_length])
252
+ if (length !== otherTarget [_length])
280
253
  return false;
281
254
 
282
255
  const
283
256
  a = target .getValue (),
284
- b = other .getValue ();
257
+ b = otherTarget .getValue ();
285
258
 
286
259
  for (let i = 0, l = length * target .getComponents (); i < l; ++ i)
287
260
  {
@@ -323,7 +296,7 @@ X3DTypedArrayField .prototype = Object .assign (Object .create (X3DArrayField .p
323
296
 
324
297
  if (array .length < otherArray .length)
325
298
  {
326
- array = target .grow (otherArray .length);
299
+ array = target [_grow] (otherArray .length);
327
300
 
328
301
  array .set (otherArray);
329
302
 
@@ -365,13 +338,16 @@ X3DTypedArrayField .prototype = Object .assign (Object .create (X3DArrayField .p
365
338
  components = target .getComponents (),
366
339
  length = target [_length],
367
340
  argumentsLength = arguments .length,
368
- array = target .grow ((length + argumentsLength) * components);
341
+ array = target [_grow] ((length + argumentsLength) * components);
369
342
 
370
343
  array .copyWithin (argumentsLength * components, 0, length * components);
371
344
 
372
345
  if (components === 1)
373
346
  {
374
- array .set (arguments, 0);
347
+ const valueType = target .getValueType ();
348
+
349
+ for (let a = 0; a < argumentsLength; ++ a)
350
+ array [a] = valueType (arguments [a]);
375
351
  }
376
352
  else
377
353
  {
@@ -390,7 +366,7 @@ X3DTypedArrayField .prototype = Object .assign (Object .create (X3DArrayField .p
390
366
 
391
367
  target .addEvent ();
392
368
 
393
- return array .length;
369
+ return target [_length];
394
370
  },
395
371
  shift: function ()
396
372
  {
@@ -436,11 +412,14 @@ X3DTypedArrayField .prototype = Object .assign (Object .create (X3DArrayField .p
436
412
  components = target .getComponents (),
437
413
  length = target [_length],
438
414
  argumentsLength = arguments .length,
439
- array = target .grow ((length + argumentsLength) * components);
415
+ array = target [_grow] ((length + argumentsLength) * components);
440
416
 
441
417
  if (components === 1)
442
418
  {
443
- array .set (arguments, length);
419
+ const valueType = target .getValueType ();
420
+
421
+ for (let a = 0, i = length; a < argumentsLength; ++ a, ++ i)
422
+ array [i] = valueType (arguments [a]);
444
423
  }
445
424
  else
446
425
  {
@@ -498,7 +477,7 @@ X3DTypedArrayField .prototype = Object .assign (Object .create (X3DArrayField .p
498
477
  return value;
499
478
  }
500
479
  },
501
- splice: function (index, deleteCount)
480
+ splice: function (index, deleteCount, ... insertValues)
502
481
  {
503
482
  const
504
483
  target = this [_target],
@@ -510,23 +489,23 @@ X3DTypedArrayField .prototype = Object .assign (Object .create (X3DArrayField .p
510
489
  if (index + deleteCount > length)
511
490
  deleteCount = length - index;
512
491
 
513
- const result = target .erase (index, index + deleteCount);
492
+ const result = target [_erase] (index, index + deleteCount);
514
493
 
515
- if (arguments .length > 2)
516
- target .spliceInsert (index, Array .prototype .splice .call (arguments, 2));
494
+ if (insertValues .length)
495
+ target [_insert] (index, insertValues);
517
496
 
518
497
  target .addEvent ();
519
498
 
520
499
  return result;
521
500
  },
522
- spliceInsert: function (index, other)
501
+ [_insert]: function (index, other)
523
502
  {
524
503
  const
525
504
  target = this [_target],
526
505
  components = target .getComponents (),
527
506
  length = target [_length],
528
507
  otherLength = other .length,
529
- array = target .grow ((length + otherLength) * components);
508
+ array = target [_grow] ((length + otherLength) * components);
530
509
 
531
510
  index *= components;
532
511
 
@@ -534,7 +513,10 @@ X3DTypedArrayField .prototype = Object .assign (Object .create (X3DArrayField .p
534
513
 
535
514
  if (components === 1)
536
515
  {
537
- array .set (other, index);
516
+ const valueType = target .getValueType ();
517
+
518
+ for (let a = 0, i = index; a < otherLength; ++ a, ++ i)
519
+ array [i] = valueType (other [a]);
538
520
  }
539
521
  else
540
522
  {
@@ -549,59 +531,31 @@ X3DTypedArrayField .prototype = Object .assign (Object .create (X3DArrayField .p
549
531
 
550
532
  target [_length] += otherLength;
551
533
  },
552
- insert: function (index, other, first, last)
534
+ [_erase]: function (first, last)
553
535
  {
554
536
  const
555
537
  target = this [_target],
556
- length = target [_length],
557
- otherArray = other .getValue (),
538
+ array = target .getValue (),
558
539
  components = target .getComponents (),
559
540
  difference = last - first,
560
- array = target .grow ((length + difference) * components);
561
-
562
- index *= components;
563
- first *= components;
564
- last *= components;
565
-
566
- array .copyWithin (index + difference * components, index, length * components);
567
-
568
- for (; first < last; ++ index, ++ first)
569
- array [index] = otherArray [first];
570
-
571
- target [_length] += difference;
572
-
573
- target .addEvent ();
574
- },
575
- erase: function (first, last)
576
- {
577
- const
578
- target = this [_target],
579
- array = target .getValue (),
580
- components = target .getComponents (),
581
- difference = last - first,
582
- length = target [_length],
583
- newLength = length - difference,
584
- values = target .create (),
585
- valuesArray = values .grow (difference * components);
541
+ length = target [_length],
542
+ newLength = length - difference,
543
+ values = target [_proxy] .slice (first, last);
586
544
 
587
545
  first *= components;
588
546
  last *= components;
589
547
 
590
- for (let v = 0, f = first; f < last; ++ v, ++ f)
591
- valuesArray [v] = array [f];
592
-
593
548
  array .copyWithin (first, last, length * components);
594
549
  array .fill (0, newLength * components, length * components);
595
550
 
596
551
  target [_length] = newLength;
597
- values [_length] = difference;
598
552
 
599
553
  if (components > 1)
600
554
  target [_cache] .length = newLength;
601
555
 
602
556
  target .addEvent ();
603
557
 
604
- return values .slice ();
558
+ return values;
605
559
  },
606
560
  resize: function (newLength, value, silently)
607
561
  {
@@ -624,7 +578,7 @@ X3DTypedArrayField .prototype = Object .assign (Object .create (X3DArrayField .p
624
578
  }
625
579
  else if (newLength > length)
626
580
  {
627
- array = target .grow (newLength * components);
581
+ array = target [_grow] (newLength * components);
628
582
 
629
583
  if (value !== undefined)
630
584
  {
@@ -652,7 +606,7 @@ X3DTypedArrayField .prototype = Object .assign (Object .create (X3DArrayField .p
652
606
 
653
607
  return array;
654
608
  },
655
- grow: function (length)
609
+ [_grow]: function (length)
656
610
  {
657
611
  const
658
612
  target = this [_target],
@@ -687,72 +641,6 @@ X3DTypedArrayField .prototype = Object .assign (Object .create (X3DArrayField .p
687
641
 
688
642
  return newArray;
689
643
  },
690
- includes: function (searchElement, fromIndex)
691
- {
692
- const
693
- target = this [_target],
694
- components = target .getComponents (),
695
- length = target [_length];
696
-
697
- if (components === 1)
698
- {
699
- return Array .prototype .includes .call (this, searchElement, fromIndex);
700
- }
701
- else
702
- {
703
- for (let i = fromIndex === undefined ? 0 : fromIndex; i < length; ++ i)
704
- {
705
- if (this [i] .equals (searchElement))
706
- return true;
707
- }
708
-
709
- return false;
710
- }
711
- },
712
- indexOf: function (searchElement, fromIndex)
713
- {
714
- const
715
- target = this [_target],
716
- components = target .getComponents (),
717
- length = target [_length];
718
-
719
- if (components === 1)
720
- {
721
- return Array .prototype .indexOf .call (this, searchElement, fromIndex);
722
- }
723
- else
724
- {
725
- for (let i = fromIndex === undefined ? 0 : fromIndex; i < length; ++ i)
726
- {
727
- if (this [i] .equals (searchElement))
728
- return i;
729
- }
730
-
731
- return -1;
732
- }
733
- },
734
- lastIndexOf: function (searchElement, fromIndex)
735
- {
736
- const
737
- target = this [_target],
738
- components = target .getComponents (),
739
- length = target [_length];
740
-
741
- if (components === 1)
742
- {
743
- return Array .prototype .lastIndexOf .call (this, searchElement, fromIndex);
744
- }
745
- else
746
- {
747
- for (let i = fromIndex === undefined ? length - 1 : fromIndex; i >= 0; -- i)
748
- {
749
- if (this [i] .equals (searchElement))
750
- return i;
751
- }
752
-
753
- return -1;
754
- }
755
- },
756
644
  reverse: function ()
757
645
  {
758
646
  const
@@ -782,7 +670,7 @@ X3DTypedArrayField .prototype = Object .assign (Object .create (X3DArrayField .p
782
670
  {
783
671
  const
784
672
  i1 = i + c,
785
- i2 = length - (components - i - c - 1) - 1,
673
+ i2 = length - i - 1 - (components - c - 1),
786
674
  t = array [i1];
787
675
 
788
676
  array [i1] = array [i2];
@@ -793,9 +681,9 @@ X3DTypedArrayField .prototype = Object .assign (Object .create (X3DArrayField .p
793
681
 
794
682
  target .addEvent ();
795
683
 
796
- return this;
684
+ return target [_proxy];
797
685
  },
798
- sort: function (compareFunction)
686
+ sort: function (compareFn)
799
687
  {
800
688
  const
801
689
  target = this [_target],
@@ -805,11 +693,18 @@ X3DTypedArrayField .prototype = Object .assign (Object .create (X3DArrayField .p
805
693
 
806
694
  if (components === 1)
807
695
  {
808
- target .set (array .subarray (0, length) .sort (compareFunction));
696
+ const valueType = target .getValueType ();
697
+
698
+ const cmp = compareFn
699
+ ? (a, b) => compareFn (valueType (a), valueType (b))
700
+ : Algorithm .cmp;
701
+
702
+ target .set (array .subarray (0, length) .sort (cmp));
809
703
  }
810
704
  else
811
705
  {
812
- const result = this .map (value => value .copy ()) .sort (compareFunction !== undefined ? compareFunction : function (a, b)
706
+ const result = Array .prototype .map .call (target [_proxy], value => value .copy ())
707
+ .sort (compareFn ?? ((a, b) =>
813
708
  {
814
709
  for (let c = 0; c < components; ++ c)
815
710
  {
@@ -821,7 +716,7 @@ X3DTypedArrayField .prototype = Object .assign (Object .create (X3DArrayField .p
821
716
  }
822
717
 
823
718
  return 0;
824
- });
719
+ }));
825
720
 
826
721
  for (let i = 0; i < length; ++ i)
827
722
  {
@@ -834,7 +729,7 @@ X3DTypedArrayField .prototype = Object .assign (Object .create (X3DArrayField .p
834
729
 
835
730
  target .addEvent ();
836
731
 
837
- return this;
732
+ return target [_proxy];
838
733
  },
839
734
  toStream: function (generator)
840
735
  {
@@ -1080,6 +975,19 @@ Object .defineProperty (X3DTypedArrayField .prototype, "length",
1080
975
 
1081
976
  // Getter/Setter functions to reference a value for a given index.
1082
977
 
978
+ function createValue (target, index, components, valueType)
979
+ {
980
+ const
981
+ value = new valueType (),
982
+ internalValue = value .getValue (),
983
+ i = index * components;
984
+
985
+ value .addEvent = addEvent .bind (target, i, components, internalValue);
986
+ value .getValue = getValue .bind (target, i, components, internalValue);
987
+
988
+ return value;
989
+ }
990
+
1083
991
  function getValue (index, components, value)
1084
992
  {
1085
993
  const array = this .getValue ();
@@ -84,10 +84,10 @@ BrowserOptions .prototype = Object .assign (Object .create (X3DBaseNode .prototy
84
84
  new X3DFieldDefinition (X3DConstants .inputOutput, "Shading", new Fields .SFString ("GOURAUD")),
85
85
  new X3DFieldDefinition (X3DConstants .inputOutput, "MotionBlur", new Fields .SFBool ()),
86
86
  new X3DFieldDefinition (X3DConstants .inputOutput, "Cache", new Fields .SFBool (true)),
87
- new X3DFieldDefinition (X3DConstants .inputOutput, "ContentScale", new Fields .SFFloat (1)),
87
+ new X3DFieldDefinition (X3DConstants .inputOutput, "ContentScale", new Fields .SFDouble (1)),
88
88
  new X3DFieldDefinition (X3DConstants .inputOutput, "ContextMenu", new Fields .SFBool (true)),
89
89
  new X3DFieldDefinition (X3DConstants .inputOutput, "Debug", new Fields .SFBool ()),
90
- new X3DFieldDefinition (X3DConstants .inputOutput, "Gravity", new Fields .SFFloat (9.80665)),
90
+ new X3DFieldDefinition (X3DConstants .inputOutput, "Gravity", new Fields .SFDouble (9.80665)),
91
91
  new X3DFieldDefinition (X3DConstants .inputOutput, "LogarithmicDepthBuffer", new Fields .SFBool ()),
92
92
  new X3DFieldDefinition (X3DConstants .inputOutput, "Notifications", new Fields .SFBool (true)),
93
93
  new X3DFieldDefinition (X3DConstants .inputOutput, "Multisampling", new Fields .SFInt32 (4)),
@@ -69,7 +69,7 @@ RenderingProperties .prototype = Object .assign (Object .create (X3DBaseNode .pr
69
69
  new X3DFieldDefinition (X3DConstants .outputOnly, "Antialiased", new Fields .SFBool (true)),
70
70
  new X3DFieldDefinition (X3DConstants .outputOnly, "ColorDepth", new Fields .SFInt32 ()),
71
71
  new X3DFieldDefinition (X3DConstants .outputOnly, "TextureMemory", new Fields .SFDouble ()),
72
- new X3DFieldDefinition (X3DConstants .outputOnly, "ContentScale", new Fields .SFFloat (1)),
72
+ new X3DFieldDefinition (X3DConstants .outputOnly, "ContentScale", new Fields .SFDouble (1)),
73
73
  new X3DFieldDefinition (X3DConstants .outputOnly, "LogarithmicDepthBuffer", new Fields .SFBool ()),
74
74
  new X3DFieldDefinition (X3DConstants .outputOnly, "MaxSamples", new Fields .SFInt32 ()),
75
75
  new X3DFieldDefinition (X3DConstants .outputOnly, "Multisampling", new Fields .SFInt32 (4)),
@@ -53,6 +53,7 @@ import BrowserProperties from "./BrowserProperties.js";
53
53
  import RenderingProperties from "./RenderingProperties.js";
54
54
  import Notification from "./Notification.js";
55
55
  import ContextMenu from "./ContextMenu.js";
56
+ import URLs from "../Networking/URLs.js";
56
57
  import Scene from "../../Execution/Scene.js";
57
58
  import DataStorage from "../../../standard/Utility/DataStorage.js";
58
59
  import Vector3 from "../../../standard/Math/Numbers/Vector3.js";
@@ -88,28 +89,44 @@ function X3DCoreContext (element)
88
89
  // Get canvas & context.
89
90
 
90
91
  const
91
- shadow = element .data ("shadow"),
92
92
  browser = $("<div></div>") .addClass ("x_ite-private-browser") .attr ("tabindex", 0),
93
93
  surface = $("<div></div>") .addClass ("x_ite-private-surface") .appendTo (browser),
94
94
  splashScreen = $("<div></div>") .hide () .addClass ("x_ite-private-splash-screen") .appendTo (browser),
95
95
  spinner = $("<div></div>") .addClass ("x_ite-private-spinner") .appendTo (splashScreen),
96
96
  progress = $("<div></div>") .addClass ("x_ite-private-progress") .appendTo (splashScreen);
97
97
 
98
+ if (element .prop ("nodeName") .toLowerCase () === "x3d-canvas")
99
+ {
100
+ const
101
+ shadow = $(element [0] .attachShadow ({ mode: "open", delegatesFocus: true })),
102
+ link = $("<link/>");
103
+
104
+ link
105
+ .on ("load", () => browser .show ())
106
+ .attr ("rel", "stylesheet")
107
+ .attr ("type", "text/css")
108
+ .attr ("href", new URL ("x_ite.css", URLs .getScriptUrl ()) .href);
109
+
110
+ this [_shadow] = shadow
111
+ .append (link)
112
+ .append (browser .hide ());
113
+ }
114
+ else
115
+ {
116
+ this [_shadow] = element .prepend (browser);
117
+ }
118
+
98
119
  $("<div></div>") .addClass ("x_ite-private-x_ite") .html (this .getName () + "<span class='x_ite-private-x3d'>X3D</span>") .appendTo (progress);
99
120
  $("<div></div>") .addClass ("x_ite-private-progressbar") .appendTo (progress) .append ($("<div></div>"));
100
121
  $("<div></div>") .addClass ("x_ite-private-spinner-text") .appendTo (progress);
101
122
 
102
123
  this [_instanceId] = ++ instanceId;
103
124
  this [_element] = element;
104
- this [_shadow] = shadow ? shadow .append (browser .hide ()) : this [_element] .prepend (browser);
105
125
  this [_surface] = surface;
106
126
  this [_canvas] = $("<canvas></canvas>") .addClass ("x_ite-private-canvas") .prependTo (surface);
107
127
  this [_context] = Context .create (this [_canvas] [0], WEBGL_LATEST_VERSION, element .attr ("preserveDrawingBuffer") === "true");
108
128
  this [_splashScreen] = splashScreen;
109
129
 
110
- if (shadow)
111
- element .data ("loaded") .then (function () { browser .show (); });
112
-
113
130
  this [_localStorage] = new DataStorage (localStorage, "X_ITE.X3DBrowser(" + this [_instanceId] + ").");
114
131
  this [_mobile] = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i .test (navigator .userAgent);
115
132
 
@@ -318,7 +335,6 @@ X3DCoreContext .prototype =
318
335
  this .setBrowserOption ("Notifications", this .parseBooleanAttribute (newValue, true));
319
336
  break;
320
337
  }
321
- case "onerror":
322
338
  case "oninitialized":
323
339
  case "onshutdown":
324
340
  {
@@ -228,7 +228,7 @@ class DOMIntegration
228
228
 
229
229
  const node = $.data (element, "node");
230
230
 
231
- if (! node)
231
+ if (!node)
232
232
  return;
233
233
 
234
234
  node .dispose ();
@@ -249,7 +249,7 @@ class DOMIntegration
249
249
  {
250
250
  const node = $.data (element, "node");
251
251
 
252
- if (! node)
252
+ if (!node)
253
253
  return;
254
254
 
255
255
  node ._loadState .addInterest ("appendInlineChildElement", this, element);
@@ -338,7 +338,7 @@ class DOMIntegration
338
338
 
339
339
  const node = $.data (element, "node");
340
340
 
341
- if (! node)
341
+ if (!node)
342
342
  return;
343
343
 
344
344
  for (const field of node .getFields ())
@@ -347,7 +347,7 @@ class DOMIntegration
347
347
 
348
348
  bindFieldCallback (field, element)
349
349
  {
350
- if (! field .isOutput ())
350
+ if (!field .isOutput ())
351
351
  return;
352
352
 
353
353
  field .addInterest ("fieldCallback", this, element);
@@ -360,7 +360,7 @@ class DOMIntegration
360
360
  {
361
361
  const node = $.data (element, "node");
362
362
 
363
- if (! node)
363
+ if (!node)
364
364
  return;
365
365
 
366
366
  const event = new CustomEvent (field .getName (),
@@ -45,4 +45,4 @@
45
45
  *
46
46
  ******************************************************************************/
47
47
 
48
- export default "8.7.1";
48
+ export default "8.7.3";
@@ -81,11 +81,9 @@ function X3DBrowser (element)
81
81
  {
82
82
  element = $(element);
83
83
 
84
- if (element .data ("browser"))
84
+ if (element .prop ("browser"))
85
85
  throw new Error ("Couldn't create browser, element has already a browser.");
86
86
 
87
- element .data ("browser", this);
88
-
89
87
  X3DBrowserContext .call (this, element);
90
88
 
91
89
  this [_browserCallbacks] = new Map ();
@@ -205,8 +203,8 @@ X3DBrowser .prototype = Object .assign (Object .create (X3DBrowserContext .proto
205
203
  level: Algorithm .clamp (level || component .level, 1, component .level),
206
204
  title: component .title,
207
205
  providerUrl: component .providerUrl,
208
- external: $.data (component, "external"),
209
- dependencies: $.data (component, "dependencies"),
206
+ external: component .external,
207
+ dependencies: component .dependencies,
210
208
  });
211
209
  }
212
210
 
@@ -229,9 +227,9 @@ X3DBrowser .prototype = Object .assign (Object .create (X3DBrowserContext .proto
229
227
 
230
228
  const component = browser .getSupportedComponents () .get (name);
231
229
 
232
- await loadComponents (browser, $.data (component, "dependencies"), seen);
230
+ await loadComponents (browser, component .dependencies, seen);
233
231
 
234
- if (!$.data (component, "external"))
232
+ if (!component .external)
235
233
  return;
236
234
 
237
235
  if (Features .NODE_ENV)
@@ -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
  {