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.
- package/.vscode/tasks.json +0 -18
- package/build/bin/bump.pl +2 -0
- package/build/bin/version.pl +16 -0
- package/dist/LICENSE.md +2 -16
- package/dist/assets/components/Annotation.js +13 -13
- package/dist/assets/components/Annotation.min.js +1 -1
- package/dist/assets/components/CADGeometry.js +13 -13
- package/dist/assets/components/CADGeometry.min.js +1 -1
- package/dist/assets/components/CubeMapTexturing.js +25 -25
- package/dist/assets/components/CubeMapTexturing.min.js +1 -1
- package/dist/assets/components/DIS.js +13 -13
- package/dist/assets/components/DIS.min.js +1 -1
- package/dist/assets/components/EventUtilities.js +9 -9
- package/dist/assets/components/EventUtilities.min.js +1 -1
- package/dist/assets/components/Geometry2D.js +19 -19
- package/dist/assets/components/Geometry2D.min.js +1 -1
- package/dist/assets/components/Geospatial.js +33 -33
- package/dist/assets/components/Geospatial.min.js +1 -1
- package/dist/assets/components/HAnim.js +18 -18
- package/dist/assets/components/HAnim.min.js +1 -1
- package/dist/assets/components/KeyDeviceSensor.js +8 -8
- package/dist/assets/components/KeyDeviceSensor.min.js +1 -1
- package/dist/assets/components/Layout.js +27 -27
- package/dist/assets/components/Layout.min.js +1 -1
- package/dist/assets/components/NURBS.js +24 -24
- package/dist/assets/components/NURBS.min.js +1 -1
- package/dist/assets/components/ParticleSystems.js +22 -22
- package/dist/assets/components/ParticleSystems.min.js +1 -1
- package/dist/assets/components/Picking.js +20 -20
- package/dist/assets/components/Picking.min.js +1 -1
- package/dist/assets/components/RigidBodyPhysics.js +18 -18
- package/dist/assets/components/RigidBodyPhysics.min.js +1 -1
- package/dist/assets/components/Scripting.js +28 -28
- package/dist/assets/components/Scripting.min.js +1 -1
- package/dist/assets/components/Text.js +24 -24
- package/dist/assets/components/Text.min.js +1 -1
- package/dist/assets/components/TextureProjector.js +14 -14
- package/dist/assets/components/TextureProjector.min.js +1 -1
- package/dist/assets/components/Texturing3D.js +31 -31
- package/dist/assets/components/Texturing3D.min.js +1 -1
- package/dist/assets/components/VolumeRendering.js +19 -19
- package/dist/assets/components/VolumeRendering.min.js +1 -1
- package/dist/assets/components/X_ITE.js +9 -9
- package/dist/assets/components/X_ITE.min.js +1 -1
- package/dist/x_ite.css +1 -1
- package/dist/x_ite.js +1939 -2168
- package/dist/x_ite.min.js +1 -1
- package/dist/x_ite.zip +0 -0
- package/docs/_config.yml +2 -2
- package/docs/_posts/getting-started.md +2 -0
- package/docs/_posts/reference/field-services-and-objects.md +1 -1
- package/package.json +3 -3
- package/src/bookmarks.js +3 -2
- package/src/standard/Math/Algorithm.js +18 -0
- package/src/x_ite/Base/FieldArray.js +3 -2
- package/src/x_ite/Base/FieldDefinitionArray.js +3 -2
- package/src/x_ite/Base/X3DArrayField.js +43 -7
- package/src/x_ite/Base/X3DInfoArray.js +69 -12
- package/src/x_ite/Base/X3DObject.js +10 -0
- package/src/x_ite/Base/X3DObjectArrayField.js +20 -21
- package/src/x_ite/Base/X3DTypedArrayField.js +86 -178
- package/src/x_ite/Browser/Core/BrowserOptions.js +2 -2
- package/src/x_ite/Browser/Core/RenderingProperties.js +1 -1
- package/src/x_ite/Browser/Core/X3DCoreContext.js +22 -6
- package/src/x_ite/Browser/DOMIntegration.js +5 -5
- package/src/x_ite/Browser/VERSION.js +1 -1
- package/src/x_ite/Browser/X3DBrowser.js +8 -10
- package/src/x_ite/Components/Core/X3DNode.js +0 -10
- package/src/x_ite/Components/Core/X3DPrototypeInstance.js +4 -4
- package/src/x_ite/Components/Picking/X3DPickSensorNode.js +2 -2
- package/src/x_ite/Configuration/ComponentInfo.js +2 -3
- package/src/x_ite/Configuration/ComponentInfoArray.js +2 -2
- package/src/x_ite/Configuration/ProfileInfoArray.js +2 -2
- package/src/x_ite/Configuration/UnitInfoArray.js +15 -1
- package/src/x_ite/Execution/BindableList.js +1 -1
- package/src/x_ite/Execution/ExportedNodesArray.js +4 -3
- package/src/x_ite/Execution/ImportedNodesArray.js +4 -3
- package/src/x_ite/Execution/NamedNodesArray.js +16 -2
- package/src/x_ite/Execution/X3DScene.js +2 -2
- package/src/x_ite/Fields/ArrayFields.js +13 -9
- package/src/x_ite/Fields/SFColor.js +4 -4
- package/src/x_ite/Fields/SFDouble.js +2 -2
- package/src/x_ite/Fields/SFFloat.js +2 -2
- package/src/x_ite/Fields/SFImage.js +11 -2
- package/src/x_ite/Fields/SFMatrixPrototypeTemplate.js +1 -1
- package/src/x_ite/Fields/SFNode.js +5 -1
- package/src/x_ite/Fields/SFRotation.js +8 -8
- package/src/x_ite/Fields/SFTime.js +1 -1
- package/src/x_ite/Fields/SFVecPrototypeTemplate.js +1 -1
- package/src/x_ite/InputOutput/FileLoader.js +3 -3
- package/src/x_ite/InputOutput/Generator.js +7 -7
- package/src/x_ite/Parser/JSONParser.js +4 -23
- package/src/x_ite/Parser/XMLParser.js +23 -29
- package/src/x_ite/Prototype/ExternProtoDeclarationArray.js +3 -2
- package/src/x_ite/Prototype/ProtoDeclarationArray.js +4 -3
- package/src/x_ite/Routing/RouteArray.js +3 -2
- package/src/x_ite/X3D.js +1 -1
- package/src/x_ite/X3DCanvasElement.js +0 -24
- package/src/x_ite.js +1 -1
package/dist/x_ite.zip
CHANGED
|
Binary file
|
package/docs/_config.yml
CHANGED
|
@@ -20,8 +20,8 @@ timezone:
|
|
|
20
20
|
# ↓ --------------------------
|
|
21
21
|
|
|
22
22
|
title: X_ITE X3D Browser # the main title
|
|
23
|
-
version: 8.7.
|
|
24
|
-
size:
|
|
23
|
+
version: 8.7.4 # x_ite latest version
|
|
24
|
+
size: 290 # size in kb
|
|
25
25
|
x3d_latest_version: 4.0 # x3d latest version
|
|
26
26
|
|
|
27
27
|
tagline: Step Into The Future # it will display as the sub-title
|
|
@@ -717,6 +717,8 @@ Type: script code. This event is sent to an \<x3d-canvas\> element when an error
|
|
|
717
717
|
|
|
718
718
|
Type: script code. This event handler will be called on the \<x3d-canvas\> element when a scene has finished loading. This applies whether the scene is applied via the *src* attribute or when a scene is loaded or replaced by another world. If you change the scene, the event will fire again when the new scene loads. This event will not bubble up the element tree.
|
|
719
719
|
|
|
720
|
+
The onload event handler will also be called at the very beginning when the initial empty scene is loaded.
|
|
721
|
+
|
|
720
722
|
### onshutdown
|
|
721
723
|
|
|
722
724
|
Type: script code. This event handler will be called on the \<x3d-canvas\> element when a scene is unloaded or replaced by another world.
|
|
@@ -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`, `
|
|
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
|
+
"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,8 +59,8 @@
|
|
|
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.
|
|
63
|
-
"jquery": "^3.
|
|
62
|
+
"jpeg-lossless-decoder-js": "^2.0.7",
|
|
63
|
+
"jquery": "^3.7.0",
|
|
64
64
|
"jquery-fullscreen-plugin": "^1.1.5",
|
|
65
65
|
"jquery-mousewheel": "^3.1.13",
|
|
66
66
|
"libgif": "^0.0.3",
|
package/src/bookmarks.js
CHANGED
|
@@ -87,8 +87,9 @@ const Bookmarks = (function ()
|
|
|
87
87
|
if (! path .match (/\.(?:x3d|x3dz|x3dv|x3dvz|x3dj|x3djz|wrl|wrz)$/))
|
|
88
88
|
continue;
|
|
89
89
|
|
|
90
|
-
const
|
|
91
|
-
|
|
90
|
+
const
|
|
91
|
+
basename = path .match (/([^\/]+)\.\w+$/),
|
|
92
|
+
name = basename [1] .replace (/([A-Z]+)/g, ' $1');
|
|
92
93
|
|
|
93
94
|
var element = $('<span/>')
|
|
94
95
|
.addClass ('example-box')
|
|
@@ -169,6 +169,24 @@ export default class Algorithm
|
|
|
169
169
|
return lhs > rhs ? 1 : lhs < rhs ? -1 : 0;
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
+
// static lexicographicallyCompare (lhs, rhs)
|
|
173
|
+
// {
|
|
174
|
+
// const
|
|
175
|
+
// length1 = lhs .length,
|
|
176
|
+
// length2 = rhs .length;
|
|
177
|
+
|
|
178
|
+
// for (let i = 0; i < length1 && i < length2; ++ i)
|
|
179
|
+
// {
|
|
180
|
+
// if (lhs [i] < rhs [i])
|
|
181
|
+
// return -1;
|
|
182
|
+
|
|
183
|
+
// if (rhs [i] < lhs [i])
|
|
184
|
+
// return 1;
|
|
185
|
+
// }
|
|
186
|
+
|
|
187
|
+
// return Algorithm .cmp (length1, length2);
|
|
188
|
+
// }
|
|
189
|
+
|
|
172
190
|
static less (lhs, rhs)
|
|
173
191
|
{
|
|
174
192
|
return lhs < rhs;
|
|
@@ -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
|
|
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),
|
|
@@ -55,31 +55,67 @@ function X3DArrayField (value)
|
|
|
55
55
|
X3DArrayField .prototype = Object .assign (Object .create (X3DField .prototype),
|
|
56
56
|
{
|
|
57
57
|
constructor: X3DArrayField,
|
|
58
|
+
// Implement all function also in TypedArray, if possible.
|
|
58
59
|
at: Array .prototype .at,
|
|
59
|
-
concat: Array .prototype .concat,
|
|
60
|
-
//Array.prototype.copyWithin,
|
|
60
|
+
// concat: Array .prototype .concat,
|
|
61
|
+
// copyWithin: Array.prototype.copyWithin,
|
|
61
62
|
entries: Array .prototype .entries,
|
|
62
63
|
every: Array .prototype .every,
|
|
63
64
|
fill: Array .prototype .fill,
|
|
64
|
-
filter:
|
|
65
|
+
filter: function (callbackFn, thisArg)
|
|
66
|
+
{
|
|
67
|
+
return new (this .constructor) (... Array .prototype .filter .call (this, callbackFn, thisArg));
|
|
68
|
+
},
|
|
65
69
|
find: Array .prototype .find,
|
|
66
70
|
findIndex: Array .prototype .findIndex,
|
|
67
71
|
findLast: Array .prototype .findLast,
|
|
68
72
|
findLastIndex: Array .prototype .findLastIndex,
|
|
69
|
-
flat: Array .prototype .flat,
|
|
70
|
-
flatMap: Array .prototype .flatMap,
|
|
73
|
+
// flat: Array .prototype .flat,
|
|
74
|
+
// flatMap: Array .prototype .flatMap,
|
|
71
75
|
forEach: Array .prototype .forEach,
|
|
72
76
|
includes: Array .prototype .includes,
|
|
73
77
|
indexOf: Array .prototype .indexOf,
|
|
74
78
|
join: Array .prototype .join,
|
|
75
79
|
keys: Array .prototype .keys,
|
|
76
80
|
lastIndexOf: Array .prototype .lastIndexOf,
|
|
77
|
-
map:
|
|
81
|
+
map: function (callbackFn, thisArg)
|
|
82
|
+
{
|
|
83
|
+
return new (this .constructor) (... Array .prototype .map .call (this, callbackFn, thisArg));
|
|
84
|
+
},
|
|
78
85
|
reduce: Array .prototype .reduce,
|
|
79
86
|
reduceRight: Array .prototype .reduceRight,
|
|
80
|
-
|
|
87
|
+
reverse: Array .prototype .reverse,
|
|
88
|
+
slice: function (start, end)
|
|
89
|
+
{
|
|
90
|
+
return new (this .constructor) (... Array .prototype .slice .call (this, start, end));
|
|
91
|
+
},
|
|
81
92
|
some: Array .prototype .some,
|
|
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
|
+
},
|
|
82
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
|
+
},
|
|
83
119
|
});
|
|
84
120
|
|
|
85
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]
|
|
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]
|
|
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:
|
|
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:
|
|
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
|
-
|
|
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;
|
|
@@ -135,6 +135,10 @@ X3DObject .prototype =
|
|
|
135
135
|
|
|
136
136
|
this [_userData] .set (key, value);
|
|
137
137
|
},
|
|
138
|
+
removeUserData: function (key)
|
|
139
|
+
{
|
|
140
|
+
this [_userData] .delete (key);
|
|
141
|
+
},
|
|
138
142
|
toString: function (options = Object .prototype)
|
|
139
143
|
{
|
|
140
144
|
const generator = new Generator (options);
|
|
@@ -193,6 +197,11 @@ X3DObject .prototype =
|
|
|
193
197
|
for (const key of Reflect .ownKeys (X3DObject .prototype))
|
|
194
198
|
Object .defineProperty (X3DObject .prototype, key, { enumerable: false });
|
|
195
199
|
|
|
200
|
+
Object .defineProperty (X3DObject .prototype, Symbol .toStringTag,
|
|
201
|
+
{
|
|
202
|
+
get: function () { return this .getTypeName (); },
|
|
203
|
+
});
|
|
204
|
+
|
|
196
205
|
Object .assign (X3DObject,
|
|
197
206
|
{
|
|
198
207
|
getId: (function ()
|
|
@@ -215,6 +224,7 @@ Object .assign (X3DObject,
|
|
|
215
224
|
})(),
|
|
216
225
|
});
|
|
217
226
|
|
|
227
|
+
// In the future we can use getId, because WeakMap will accept Symbols as key.
|
|
218
228
|
const SymbolId = (function ()
|
|
219
229
|
{
|
|
220
230
|
const map = new Map ();
|
|
@@ -47,7 +47,6 @@
|
|
|
47
47
|
|
|
48
48
|
import X3DField from "./X3DField.js";
|
|
49
49
|
import X3DArrayField from "./X3DArrayField.js";
|
|
50
|
-
import Algorithm from "../../standard/Math/Algorithm.js";
|
|
51
50
|
|
|
52
51
|
const
|
|
53
52
|
_target = Symbol (),
|
|
@@ -126,10 +125,10 @@ const handler =
|
|
|
126
125
|
|
|
127
126
|
function X3DObjectArrayField (value)
|
|
128
127
|
{
|
|
129
|
-
const proxy = new Proxy (this, handler);
|
|
130
|
-
|
|
131
128
|
X3DArrayField .call (this, [ ]);
|
|
132
129
|
|
|
130
|
+
const proxy = new Proxy (this, handler);
|
|
131
|
+
|
|
133
132
|
this [_target] = this;
|
|
134
133
|
this [_proxy] = proxy;
|
|
135
134
|
|
|
@@ -282,7 +281,7 @@ X3DObjectArrayField .prototype = Object .assign (Object .create (X3DArrayField .
|
|
|
282
281
|
return field .valueOf ();
|
|
283
282
|
}
|
|
284
283
|
},
|
|
285
|
-
splice: function (index, deleteCount)
|
|
284
|
+
splice: function (index, deleteCount, ... insertValues)
|
|
286
285
|
{
|
|
287
286
|
const
|
|
288
287
|
target = this [_target],
|
|
@@ -296,8 +295,8 @@ X3DObjectArrayField .prototype = Object .assign (Object .create (X3DArrayField .
|
|
|
296
295
|
|
|
297
296
|
const result = target .erase (index, index + deleteCount);
|
|
298
297
|
|
|
299
|
-
if (
|
|
300
|
-
target .insert (index,
|
|
298
|
+
if (insertValues .length)
|
|
299
|
+
target .insert (index, insertValues, 0, insertValues .length);
|
|
301
300
|
|
|
302
301
|
return result;
|
|
303
302
|
},
|
|
@@ -305,7 +304,7 @@ X3DObjectArrayField .prototype = Object .assign (Object .create (X3DArrayField .
|
|
|
305
304
|
{
|
|
306
305
|
const
|
|
307
306
|
target = this [_target],
|
|
308
|
-
args = [
|
|
307
|
+
args = [ ];
|
|
309
308
|
|
|
310
309
|
for (let i = first; i < last; ++ i)
|
|
311
310
|
{
|
|
@@ -316,7 +315,7 @@ X3DObjectArrayField .prototype = Object .assign (Object .create (X3DArrayField .
|
|
|
316
315
|
args .push (field);
|
|
317
316
|
}
|
|
318
317
|
|
|
319
|
-
Array .prototype .splice .
|
|
318
|
+
Array .prototype .splice .call (target .getValue (), index, 0, ... args);
|
|
320
319
|
|
|
321
320
|
target .addEvent ();
|
|
322
321
|
},
|
|
@@ -411,7 +410,7 @@ X3DObjectArrayField .prototype = Object .assign (Object .create (X3DArrayField .
|
|
|
411
410
|
|
|
412
411
|
target .addEvent ();
|
|
413
412
|
|
|
414
|
-
return
|
|
413
|
+
return new (target .constructor) (values);
|
|
415
414
|
},
|
|
416
415
|
resize: function (size, value, silently)
|
|
417
416
|
{
|
|
@@ -447,6 +446,14 @@ X3DObjectArrayField .prototype = Object .assign (Object .create (X3DArrayField .
|
|
|
447
446
|
target .addEvent ();
|
|
448
447
|
}
|
|
449
448
|
},
|
|
449
|
+
addChildObject: function (value)
|
|
450
|
+
{
|
|
451
|
+
value .addParent (this [_proxy]);
|
|
452
|
+
},
|
|
453
|
+
removeChildObject: function (value)
|
|
454
|
+
{
|
|
455
|
+
value .removeParent (this [_proxy]);
|
|
456
|
+
},
|
|
450
457
|
reverse: function ()
|
|
451
458
|
{
|
|
452
459
|
const target = this [_target];
|
|
@@ -454,24 +461,16 @@ X3DObjectArrayField .prototype = Object .assign (Object .create (X3DArrayField .
|
|
|
454
461
|
target .getValue () .reverse ();
|
|
455
462
|
target .addEvent ();
|
|
456
463
|
|
|
457
|
-
return
|
|
464
|
+
return target [_proxy];
|
|
458
465
|
},
|
|
459
|
-
sort: function ()
|
|
466
|
+
sort: function (compareFn)
|
|
460
467
|
{
|
|
461
468
|
const target = this [_target];
|
|
462
469
|
|
|
463
|
-
|
|
470
|
+
Array .prototype .sort .call (this, compareFn);
|
|
464
471
|
target .addEvent ();
|
|
465
472
|
|
|
466
|
-
return
|
|
467
|
-
},
|
|
468
|
-
addChildObject: function (value)
|
|
469
|
-
{
|
|
470
|
-
value .addParent (this [_proxy]);
|
|
471
|
-
},
|
|
472
|
-
removeChildObject: function (value)
|
|
473
|
-
{
|
|
474
|
-
value .removeParent (this [_proxy]);
|
|
473
|
+
return target [_proxy];
|
|
475
474
|
},
|
|
476
475
|
toStream: function (generator)
|
|
477
476
|
{
|