x_ite 4.7.9 → 4.7.14
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/build/parts/x_ite.end.frag.js +0 -8
- package/build/parts/x_ite.start.frag.js +0 -5
- package/dist/assets/components/scripting.js +1 -1
- package/dist/assets/components/scripting.min.js +1 -1
- package/dist/example.html +2 -2
- package/dist/x_ite.css +13 -9
- package/dist/x_ite.js +148 -95
- package/dist/x_ite.min.js +22 -22
- package/dist/x_ite.zip +0 -0
- package/docs/Accessing-the-External-Browser.md +1 -15
- package/docs/_config.yml +1 -1
- package/docs/index.md +24 -3
- package/docs/reference/Browser-Services.md +2 -2
- package/package.json +5 -6
- package/src/standard/Utility/DataStorage.js +16 -2
- package/src/x_ite/Basic/X3DBaseNode.js +1 -1
- package/src/x_ite/Basic/X3DField.js +18 -11
- package/src/x_ite/Basic/X3DObjectArrayField.js +9 -3
- package/src/x_ite/Browser/Core/ContextMenu.js +69 -5
- package/src/x_ite/Browser/Networking/urls.js +0 -25
- package/src/x_ite/Browser/VERSION.js +1 -1
- package/src/x_ite/Components/Layering/LayerSet.js +10 -11
- package/src/x_ite/Components/Scripting/Script.js +1 -1
- package/src/x_ite/Execution/World.js +3 -3
- package/src/x_ite/Fields/ArrayFields.js +1 -1
- package/src/x_ite/Fields/SFNode.js +5 -3
- package/src/x_ite/Fields/SFNodeCache.js +7 -8
- package/src/x_ite/InputOutput/Generator.js +1 -1
- package/src/x_ite/Parser/X3DParser.js +1 -1
- package/src/x_ite/Prototype/X3DExternProtoDeclaration.js +1 -1
- package/src/x_ite/Prototype/X3DProtoDeclaration.js +1 -1
- package/src/x_ite/X3D.js +1 -1
- package/src/x_ite.css +13 -8
- package/src/x_ite.js +2 -2
package/dist/x_ite.zip
CHANGED
|
Binary file
|
|
@@ -65,20 +65,6 @@ function (error)
|
|
|
65
65
|
</script>
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
-
### Using the Promise return value
|
|
69
|
-
|
|
70
|
-
```js
|
|
71
|
-
X3D () .then (function ()
|
|
72
|
-
{
|
|
73
|
-
const Browser = X3D .getBrowser ();
|
|
74
|
-
})
|
|
75
|
-
.catch (function (error)
|
|
76
|
-
{
|
|
77
|
-
// ooops an error.
|
|
78
|
-
console .error (error);
|
|
79
|
-
});
|
|
80
|
-
```
|
|
81
|
-
|
|
82
68
|
### Async use of X3D object
|
|
83
69
|
|
|
84
70
|
```js
|
|
@@ -194,7 +180,7 @@ function foo (node)
|
|
|
194
180
|
|
|
195
181
|
#### **X3DFields**
|
|
196
182
|
|
|
197
|
-
All X3DFields (SFColor, ..., MFBool, MFColor, and so on). The fields can be created using the object as
|
|
183
|
+
All X3DFields (SFColor, ..., MFBool, MFColor, and so on). The fields can be created using the object as constructor. **Note:** Scalar objects like SFBool, SFDouble, SFFloat, SFInt32, SFString, and SFTime have no constructor, just use the built-in JavaScript types Boolean, Number, and String.
|
|
198
184
|
|
|
199
185
|
```js
|
|
200
186
|
// Create a new translation vector and
|
package/docs/_config.yml
CHANGED
package/docs/index.md
CHANGED
|
@@ -838,8 +838,8 @@ If you are a developer or you always wanna be up to date:
|
|
|
838
838
|
If you are on production and everything works fine, then use a numbered version.
|
|
839
839
|
|
|
840
840
|
```html
|
|
841
|
-
<link rel="stylesheet" type="text/css" href="https://create3000.github.io/code/x_ite/4.7.
|
|
842
|
-
<script type="text/javascript" src="https://create3000.github.io/code/x_ite/4.7.
|
|
841
|
+
<link rel="stylesheet" type="text/css" href="https://create3000.github.io/code/x_ite/4.7.14/dist/x_ite.css"/>
|
|
842
|
+
<script type="text/javascript" src="https://create3000.github.io/code/x_ite/4.7.14/dist/x_ite.min.js"></script>
|
|
843
843
|
```
|
|
844
844
|
|
|
845
845
|
### jsDelivr CDN
|
|
@@ -946,7 +946,7 @@ A Boolean value (`true` or `false`) to indicate whether files transferred over t
|
|
|
946
946
|
|
|
947
947
|
### contextMenu
|
|
948
948
|
|
|
949
|
-
A Boolean value (`true` or `false`) to indicate whether a context menu should be displayed on right click. The default value for the contextMenu attribute is `true`.
|
|
949
|
+
A Boolean value (`true` or `false`) to indicate whether a context menu should be displayed on right click. The default value for the contextMenu attribute is `true`. The context menu can also be extended, [see here](#extending-the-context-menu).
|
|
950
950
|
{: .notice}
|
|
951
951
|
|
|
952
952
|
### notifications
|
|
@@ -999,6 +999,27 @@ A MFString value with urls that should be loaded on page load. If no url attribu
|
|
|
999
999
|
|
|
1000
1000
|
More options can be adjusted using the [Browser Object](/x_ite/reference/Browser-Services.html#browser-object) and [Browser Options](/x_ite/reference/Browser-Services.html#browser-options) for scene specific adjustments.
|
|
1001
1001
|
|
|
1002
|
+
## Extending the Context Menu
|
|
1003
|
+
|
|
1004
|
+
The context menu is the jQuery Context Menu plugin, and it can be extended using the `items` syntax. The full documentation [can be found here](https://swisnl.github.io/jQuery-contextMenu/docs/items.html).
|
|
1005
|
+
|
|
1006
|
+
### Example
|
|
1007
|
+
|
|
1008
|
+
```js
|
|
1009
|
+
Browser .getContextMenu () .setUserMenu (function ()
|
|
1010
|
+
{
|
|
1011
|
+
return {
|
|
1012
|
+
"command-1": {
|
|
1013
|
+
name: "Command 1",
|
|
1014
|
+
callback: function (key, opt)
|
|
1015
|
+
{
|
|
1016
|
+
console .log ("Clicked on " + key);
|
|
1017
|
+
},
|
|
1018
|
+
},
|
|
1019
|
+
};
|
|
1020
|
+
});
|
|
1021
|
+
```
|
|
1022
|
+
|
|
1002
1023
|
## Accessing the External Browser
|
|
1003
1024
|
|
|
1004
1025
|
X\_ITE is designed to provide access to a browser and its contained scene graph via JavaScript, either within an internal X3D Script node or an external HTML script.
|
|
@@ -189,7 +189,7 @@ Returns a browser option with the corresponding name.
|
|
|
189
189
|
<tr>
|
|
190
190
|
<td>Shading</td>
|
|
191
191
|
<td>Specify shading mode for all objects.</td>
|
|
192
|
-
<td>Wireframe, Flat, Gouraud, Phong</td>
|
|
192
|
+
<td>Point, Wireframe, Flat, Gouraud, Phong</td>
|
|
193
193
|
<td>Gouraud</td>
|
|
194
194
|
</tr>
|
|
195
195
|
<tr>
|
|
@@ -253,7 +253,7 @@ Returns a rendering property with the corresponding *name*.
|
|
|
253
253
|
<tr>
|
|
254
254
|
<td>Shading</td>
|
|
255
255
|
<td>String</td>
|
|
256
|
-
<td>The type of shading algorithm in use. Typical values are Flat, Gouraud, Phong, Wireframe.</td>
|
|
256
|
+
<td>The type of shading algorithm in use. Typical values are Flat, Gouraud, Phong, Wireframe, Point.</td>
|
|
257
257
|
</tr>
|
|
258
258
|
<tr>
|
|
259
259
|
<td>MaxTextureSize</td>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "x_ite",
|
|
3
|
-
"version": "4.7.
|
|
4
|
-
"revision": "
|
|
3
|
+
"version": "4.7.14",
|
|
4
|
+
"revision": "1139",
|
|
5
5
|
"description": "X_ITE X3D Browser, a framework for integrating and manipulating X3D and VRML scenes in HTML.",
|
|
6
6
|
"main": "dist/x_ite.js",
|
|
7
7
|
"repository": {
|
|
@@ -17,7 +17,9 @@
|
|
|
17
17
|
"wrl",
|
|
18
18
|
"JavaScript",
|
|
19
19
|
"JSON",
|
|
20
|
-
"xite"
|
|
20
|
+
"xite",
|
|
21
|
+
"node",
|
|
22
|
+
"electron"
|
|
21
23
|
],
|
|
22
24
|
"author": "Holger Seelig <holger.seelig@gmail.com>",
|
|
23
25
|
"license": "GPL-3.0",
|
|
@@ -70,8 +72,5 @@
|
|
|
70
72
|
"lint": "jshint **",
|
|
71
73
|
"build": "make",
|
|
72
74
|
"-prebuild:js": "npm run lint"
|
|
73
|
-
},
|
|
74
|
-
"dependencies": {
|
|
75
|
-
"sprintf-js": "^1.1.2"
|
|
76
75
|
}
|
|
77
76
|
}
|
|
@@ -53,7 +53,8 @@ define (function ()
|
|
|
53
53
|
|
|
54
54
|
const
|
|
55
55
|
storages = new WeakMap (),
|
|
56
|
-
namespaces = new WeakMap ()
|
|
56
|
+
namespaces = new WeakMap (),
|
|
57
|
+
defaults = new WeakMap ();
|
|
57
58
|
|
|
58
59
|
const handler =
|
|
59
60
|
{
|
|
@@ -67,7 +68,7 @@ define (function ()
|
|
|
67
68
|
var value = target .getStorage () [target .getNameSpace () + key];
|
|
68
69
|
|
|
69
70
|
if (value === undefined || value === "undefined" || value === null)
|
|
70
|
-
return
|
|
71
|
+
return target .getDefaultValue (key);
|
|
71
72
|
|
|
72
73
|
return JSON .parse (value);
|
|
73
74
|
},
|
|
@@ -89,6 +90,7 @@ define (function ()
|
|
|
89
90
|
|
|
90
91
|
storages .set (this, storage);
|
|
91
92
|
namespaces .set (this, namespace);
|
|
93
|
+
defaults .set (this, { });
|
|
92
94
|
|
|
93
95
|
return new Proxy (this, handler);
|
|
94
96
|
}
|
|
@@ -103,6 +105,18 @@ define (function ()
|
|
|
103
105
|
{
|
|
104
106
|
return namespaces .get (this .target);
|
|
105
107
|
},
|
|
108
|
+
addNameSpace: function (namespace)
|
|
109
|
+
{
|
|
110
|
+
return new DataStorage (this .getStorage (), this .getNameSpace () + namespace);
|
|
111
|
+
},
|
|
112
|
+
addDefaultValues: function (defaults)
|
|
113
|
+
{
|
|
114
|
+
Object .assign (defaults .get (this .target), object);
|
|
115
|
+
},
|
|
116
|
+
getDefaultValue (key)
|
|
117
|
+
{
|
|
118
|
+
return defaults .get (this .target) [key];
|
|
119
|
+
},
|
|
106
120
|
clear: function ()
|
|
107
121
|
{
|
|
108
122
|
const
|
|
@@ -265,31 +265,38 @@ function ($,
|
|
|
265
265
|
{
|
|
266
266
|
return this ._outputRoutes;
|
|
267
267
|
},
|
|
268
|
-
addRouteCallback: function (
|
|
268
|
+
addRouteCallback: function (id, object)
|
|
269
269
|
{
|
|
270
270
|
if (! this .hasOwnProperty ("_routeCallbacks"))
|
|
271
271
|
this ._routeCallbacks = new Map ();
|
|
272
272
|
|
|
273
|
-
this ._routeCallbacks .set (
|
|
273
|
+
this ._routeCallbacks .set (id, object);
|
|
274
274
|
},
|
|
275
|
-
removeRouteCallback: function (
|
|
275
|
+
removeRouteCallback: function (id)
|
|
276
276
|
{
|
|
277
|
-
this ._routeCallbacks .delete (
|
|
277
|
+
this ._routeCallbacks .delete (id);
|
|
278
278
|
},
|
|
279
279
|
getRouteCallbacks: function ()
|
|
280
280
|
{
|
|
281
281
|
return this ._routeCallbacks;
|
|
282
282
|
},
|
|
283
|
-
processRouteCallbacks: function ()
|
|
283
|
+
processRouteCallbacks: (function ()
|
|
284
284
|
{
|
|
285
|
-
|
|
285
|
+
const routeCallbacks = new Map ();
|
|
286
|
+
|
|
287
|
+
function processRouteCallback (routeCallback)
|
|
286
288
|
{
|
|
287
|
-
|
|
288
|
-
{
|
|
289
|
-
routeCallback ();
|
|
290
|
-
});
|
|
289
|
+
routeCallback ();
|
|
291
290
|
}
|
|
292
|
-
|
|
291
|
+
|
|
292
|
+
return function ()
|
|
293
|
+
{
|
|
294
|
+
if (this ._routeCallbacks .size)
|
|
295
|
+
{
|
|
296
|
+
MapUtilities .assign (routeCallbacks, this ._routeCallbacks) .forEach (processRouteCallback);
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
})(),
|
|
293
300
|
processEvent: (function ()
|
|
294
301
|
{
|
|
295
302
|
const fieldCallbacks = new Map ();
|
|
@@ -90,10 +90,16 @@ function ($,
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
const array = target .getValue ();
|
|
94
|
-
|
|
95
93
|
if (key === Symbol .iterator)
|
|
96
|
-
|
|
94
|
+
{
|
|
95
|
+
return function* ()
|
|
96
|
+
{
|
|
97
|
+
const array = target .getValue ();
|
|
98
|
+
|
|
99
|
+
for (const value of array)
|
|
100
|
+
yield value .valueOf ();
|
|
101
|
+
};
|
|
102
|
+
}
|
|
97
103
|
},
|
|
98
104
|
set: function (target, key, value)
|
|
99
105
|
{
|
|
@@ -64,7 +64,8 @@ function ($,
|
|
|
64
64
|
{
|
|
65
65
|
X3DBaseNode .call (this, executionContext);
|
|
66
66
|
|
|
67
|
-
this .
|
|
67
|
+
this .userMenu = null;
|
|
68
|
+
this .active = false;
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
ContextMenu .prototype = Object .assign (Object .create (X3DBaseNode .prototype),
|
|
@@ -116,15 +117,57 @@ function ($,
|
|
|
116
117
|
},
|
|
117
118
|
1);
|
|
118
119
|
}
|
|
119
|
-
|
|
120
|
+
},
|
|
121
|
+
activated: function (options)
|
|
122
|
+
{
|
|
120
123
|
// Display submenus on left side if there is no space on right side.
|
|
121
124
|
|
|
122
125
|
if (options .$menu .hasClass ("x_ite-private-menu-submenus-left"))
|
|
123
126
|
{
|
|
124
|
-
options .$menu .find (".context-menu-
|
|
125
|
-
|
|
127
|
+
options .$menu .find (".context-menu-list") .each (function (i, e)
|
|
128
|
+
{
|
|
129
|
+
$(e) .css ("right", $(e) .parent () .parent () .css ("width"));
|
|
126
130
|
});
|
|
127
131
|
}
|
|
132
|
+
else
|
|
133
|
+
{
|
|
134
|
+
options .$menu .find (".context-menu-list") .each (function (i, e)
|
|
135
|
+
{
|
|
136
|
+
$(e) .css ("left", (parseInt ($(e) .parent () .parent () .css ("width")) - 2) + "px");
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// If the submenu is higher than vh, add scrollbars.
|
|
141
|
+
options .$menu .find (".context-menu-list") .each (function (i, e)
|
|
142
|
+
{
|
|
143
|
+
if ($(e) .height () > $(window) .height ())
|
|
144
|
+
{
|
|
145
|
+
$(e) .css ({
|
|
146
|
+
"overflow-y": "scroll",
|
|
147
|
+
"max-height": "100vh",
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
// If the submenu is higher than vh, reposition it.
|
|
153
|
+
options .$menu .find (".context-menu-item") .on ("mouseenter", function (event)
|
|
154
|
+
{
|
|
155
|
+
event .stopImmediatePropagation ();
|
|
156
|
+
|
|
157
|
+
const
|
|
158
|
+
t = $(event .target),
|
|
159
|
+
e = t .children (".context-menu-list");
|
|
160
|
+
|
|
161
|
+
if (!e .length)
|
|
162
|
+
return;
|
|
163
|
+
|
|
164
|
+
e .css ("top", "");
|
|
165
|
+
|
|
166
|
+
const bottom = e .offset () .top + e .height () - $(window) .scrollTop () - $(window) .height ();
|
|
167
|
+
|
|
168
|
+
if (bottom > 0)
|
|
169
|
+
e .offset ({ "top": e .offset () .top - bottom });
|
|
170
|
+
});
|
|
128
171
|
}
|
|
129
172
|
.bind (this),
|
|
130
173
|
hide: function (options)
|
|
@@ -135,6 +178,14 @@ function ($,
|
|
|
135
178
|
},
|
|
136
179
|
});
|
|
137
180
|
},
|
|
181
|
+
getUserMenu: function ()
|
|
182
|
+
{
|
|
183
|
+
return this .userMenu;
|
|
184
|
+
},
|
|
185
|
+
setUserMenu: function (userMenu)
|
|
186
|
+
{
|
|
187
|
+
this .userMenu = userMenu;
|
|
188
|
+
},
|
|
138
189
|
getActive: function ()
|
|
139
190
|
{
|
|
140
191
|
return this .active;
|
|
@@ -414,9 +465,22 @@ function ($,
|
|
|
414
465
|
window .open (browser .getProviderUrl ());
|
|
415
466
|
},
|
|
416
467
|
},
|
|
417
|
-
}
|
|
468
|
+
},
|
|
418
469
|
};
|
|
419
470
|
|
|
471
|
+
if ($.isFunction (this .userMenu))
|
|
472
|
+
{
|
|
473
|
+
const userMenu = this .userMenu ();
|
|
474
|
+
|
|
475
|
+
if ($.isPlainObject (userMenu))
|
|
476
|
+
{
|
|
477
|
+
Object .assign (menu .items, { "separator4": "--------" });
|
|
478
|
+
|
|
479
|
+
for (const key in userMenu)
|
|
480
|
+
menu .items ["user-" + key] = userMenu [key];
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
|
|
420
484
|
if (leftSubMenus)
|
|
421
485
|
menu .className += " x_ite-private-menu-submenus-left";
|
|
422
486
|
|
|
@@ -61,9 +61,6 @@ define (function ()
|
|
|
61
61
|
if (getScriptURL () .match (/\.min\.js$/))
|
|
62
62
|
file += ".min";
|
|
63
63
|
|
|
64
|
-
if (typeof globalRequire === "function" && typeof __filename === "string")
|
|
65
|
-
return this .getPath ("assets", "components", file + ".js");
|
|
66
|
-
|
|
67
64
|
return new URL ("assets/components/" + file + ".js", getScriptURL ()) .href;
|
|
68
65
|
}
|
|
69
66
|
|
|
@@ -71,42 +68,20 @@ define (function ()
|
|
|
71
68
|
},
|
|
72
69
|
getShaderUrl: function (file)
|
|
73
70
|
{
|
|
74
|
-
if (typeof globalRequire === "function" && typeof __filename === "string")
|
|
75
|
-
return this .getPath ("assets", "shaders", file);
|
|
76
|
-
|
|
77
71
|
return new URL ("assets/shaders/" + file, getScriptURL ()) .href;
|
|
78
72
|
},
|
|
79
73
|
getFontsUrl: function (file)
|
|
80
74
|
{
|
|
81
|
-
if (typeof globalRequire === "function" && typeof __filename === "string")
|
|
82
|
-
return this .getPath ("assets", "fonts", file);
|
|
83
|
-
|
|
84
75
|
return new URL ("assets/fonts/" + file, getScriptURL ()) .href;
|
|
85
76
|
},
|
|
86
77
|
getLinetypeUrl: function (index)
|
|
87
78
|
{
|
|
88
|
-
if (typeof globalRequire === "function" && typeof __filename === "string")
|
|
89
|
-
return this .getPath ("assets", "linetype", index + ".png");
|
|
90
|
-
|
|
91
79
|
return new URL ("assets/linetype/" + index + ".png", getScriptURL ()) .href;
|
|
92
80
|
},
|
|
93
81
|
getHatchingUrl: function (index)
|
|
94
82
|
{
|
|
95
|
-
if (typeof globalRequire === "function" && typeof __filename === "string")
|
|
96
|
-
return this .getPath ("assets", "hatching", index + ".png");
|
|
97
|
-
|
|
98
83
|
return new URL ("assets/hatching/" + index + ".png", getScriptURL ()) .href;
|
|
99
84
|
},
|
|
100
|
-
getPath: function ()
|
|
101
|
-
{
|
|
102
|
-
const
|
|
103
|
-
path = globalRequire ("path"),
|
|
104
|
-
args = Array .prototype .slice .call (arguments);
|
|
105
|
-
|
|
106
|
-
args .unshift (path .dirname (getScriptURL ()));
|
|
107
|
-
|
|
108
|
-
return path .join .apply (path, args);
|
|
109
|
-
},
|
|
110
85
|
};
|
|
111
86
|
|
|
112
87
|
return new URLs ();
|
|
@@ -141,7 +141,7 @@ function (Fields,
|
|
|
141
141
|
}
|
|
142
142
|
else
|
|
143
143
|
{
|
|
144
|
-
|
|
144
|
+
const index = this .activeLayer_ - 1;
|
|
145
145
|
|
|
146
146
|
if (index >= 0 && index < this .layers_ .length)
|
|
147
147
|
{
|
|
@@ -157,24 +157,23 @@ function (Fields,
|
|
|
157
157
|
},
|
|
158
158
|
set_layers: function ()
|
|
159
159
|
{
|
|
160
|
-
|
|
160
|
+
const layers = this .layers_ .getValue ();
|
|
161
161
|
|
|
162
162
|
this .layerNodes .length = 0;
|
|
163
163
|
|
|
164
|
-
for (
|
|
164
|
+
for (let index of this .order_)
|
|
165
165
|
{
|
|
166
|
-
var index = this .order_ [i];
|
|
167
|
-
|
|
168
166
|
if (index === 0)
|
|
167
|
+
{
|
|
169
168
|
this .layerNodes .push (this .layerNode0);
|
|
170
|
-
|
|
169
|
+
}
|
|
171
170
|
else
|
|
172
171
|
{
|
|
173
172
|
-- index;
|
|
174
173
|
|
|
175
174
|
if (index >= 0 && index < layers .length)
|
|
176
175
|
{
|
|
177
|
-
|
|
176
|
+
const layerNode = X3DCast (X3DConstants .X3DLayerNode, layers [index]);
|
|
178
177
|
|
|
179
178
|
if (layerNode)
|
|
180
179
|
this .layerNodes .push (layerNode);
|
|
@@ -200,11 +199,11 @@ function (Fields,
|
|
|
200
199
|
},
|
|
201
200
|
traverse: function (type, renderObject)
|
|
202
201
|
{
|
|
203
|
-
|
|
202
|
+
const layerNodes = this .layerNodes;
|
|
204
203
|
|
|
205
204
|
if (type === TraverseType .POINTER)
|
|
206
205
|
{
|
|
207
|
-
for (
|
|
206
|
+
for (let i = 0, length = layerNodes .length; i < length; ++ i)
|
|
208
207
|
{
|
|
209
208
|
this .getBrowser () .setLayerNumber (i);
|
|
210
209
|
layerNodes [i] .traverse (type, renderObject);
|
|
@@ -212,9 +211,9 @@ function (Fields,
|
|
|
212
211
|
}
|
|
213
212
|
else
|
|
214
213
|
{
|
|
215
|
-
for (
|
|
214
|
+
for (const layerNode of layerNodes)
|
|
216
215
|
{
|
|
217
|
-
|
|
216
|
+
layerNode .traverse (type, renderObject);
|
|
218
217
|
}
|
|
219
218
|
}
|
|
220
219
|
},
|
|
@@ -264,7 +264,7 @@ function ($,
|
|
|
264
264
|
|
|
265
265
|
if (rootNodes .length && rootNodes [0])
|
|
266
266
|
{
|
|
267
|
-
return
|
|
267
|
+
return rootNodes [0];
|
|
268
268
|
}
|
|
269
269
|
|
|
270
270
|
throw new Error ("SFNode.new: invalid argument, must be 'string' is 'undefined'.");
|
|
@@ -124,10 +124,10 @@ function (SFNode,
|
|
|
124
124
|
|
|
125
125
|
for (const rootNode of rootNodes)
|
|
126
126
|
{
|
|
127
|
-
const
|
|
127
|
+
const layerSet = X3DCast (X3DConstants .LayerSet, rootNode);
|
|
128
128
|
|
|
129
|
-
if (
|
|
130
|
-
this .layerSet =
|
|
129
|
+
if (layerSet)
|
|
130
|
+
this .layerSet = layerSet;
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
this .layerSet .setLayer0 (this .layer0);
|
|
@@ -129,9 +129,11 @@ function (X3DField,
|
|
|
129
129
|
{
|
|
130
130
|
// Node need to test for X3DBaseNode, because there is a special version of SFNode in Script.
|
|
131
131
|
|
|
132
|
+
const proxy = new Proxy (this, handler);
|
|
133
|
+
|
|
132
134
|
if (value)
|
|
133
135
|
{
|
|
134
|
-
value .addParent (
|
|
136
|
+
value .addParent (proxy);
|
|
135
137
|
|
|
136
138
|
X3DField .call (this, value);
|
|
137
139
|
}
|
|
@@ -140,7 +142,7 @@ function (X3DField,
|
|
|
140
142
|
X3DField .call (this, null);
|
|
141
143
|
}
|
|
142
144
|
|
|
143
|
-
return
|
|
145
|
+
return proxy;
|
|
144
146
|
}
|
|
145
147
|
|
|
146
148
|
SFNode .prototype = Object .assign (Object .create (X3DField .prototype),
|
|
@@ -189,7 +191,7 @@ function (X3DField,
|
|
|
189
191
|
current .removeParent (this);
|
|
190
192
|
}
|
|
191
193
|
|
|
192
|
-
//
|
|
194
|
+
// No need to test for X3DBaseNode, because there is a special version of SFNode in Script.
|
|
193
195
|
|
|
194
196
|
if (value)
|
|
195
197
|
{
|
|
@@ -57,11 +57,11 @@ define (function ()
|
|
|
57
57
|
|
|
58
58
|
SFNodeCache .prototype =
|
|
59
59
|
{
|
|
60
|
-
add: function (baseNode
|
|
60
|
+
add: function (baseNode)
|
|
61
61
|
{
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
const
|
|
63
|
+
SFNode = require ("x_ite/Fields/SFNode"),
|
|
64
|
+
node = new SFNode (baseNode);
|
|
65
65
|
|
|
66
66
|
cache .set (baseNode, node);
|
|
67
67
|
|
|
@@ -77,10 +77,9 @@ define (function ()
|
|
|
77
77
|
}
|
|
78
78
|
else
|
|
79
79
|
{
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
const node = new SFNode (baseNode);
|
|
80
|
+
const
|
|
81
|
+
SFNode = require ("x_ite/Fields/SFNode"),
|
|
82
|
+
node = new SFNode (baseNode);
|
|
84
83
|
|
|
85
84
|
cache .set (baseNode, node);
|
|
86
85
|
|
|
@@ -60,7 +60,7 @@ function (X3DConstants)
|
|
|
60
60
|
this .indentChar = " ";
|
|
61
61
|
this .precision = 6;
|
|
62
62
|
this .doublePrecision = 14;
|
|
63
|
-
this .removeTrailingZeros = /\.?0
|
|
63
|
+
this .removeTrailingZeros = /\.?0*(?=$|[eE])/;
|
|
64
64
|
|
|
65
65
|
this .executionContextStack = [ null ];
|
|
66
66
|
this .importedNodesIndex = new Map ();
|
|
@@ -133,7 +133,7 @@ define (function ()
|
|
|
133
133
|
if (typeof globalRequire === "function" && typeof __filename === "string")
|
|
134
134
|
{
|
|
135
135
|
for (const url of providerUrls)
|
|
136
|
-
globalRequire (url);
|
|
136
|
+
globalRequire (globalRequire ("url") .fileURLToPath (url));
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
return Array .from (providerUrls);
|
package/src/x_ite/X3D.js
CHANGED
|
@@ -109,7 +109,7 @@ function ($,
|
|
|
109
109
|
const url = urls .getProviderUrl (name);
|
|
110
110
|
|
|
111
111
|
if (typeof globalRequire === "function" && typeof __filename === "string")
|
|
112
|
-
globalRequire (url);
|
|
112
|
+
globalRequire (globalRequire ("url") .fileURLToPath (url));
|
|
113
113
|
|
|
114
114
|
return url;
|
|
115
115
|
}
|