x_ite 4.7.9 → 4.7.10
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/example.html +2 -2
- package/dist/x_ite.css +13 -9
- package/dist/x_ite.js +93 -53
- package/dist/x_ite.min.js +17 -17
- 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/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/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/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.10/dist/x_ite.css"/>
|
|
842
|
+
<script type="text/javascript" src="https://create3000.github.io/code/x_ite/4.7.10/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.10",
|
|
4
|
+
"revision": "1136",
|
|
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
|
|
@@ -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 ();
|
|
@@ -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
|
}
|
package/src/x_ite.css
CHANGED
|
@@ -335,12 +335,6 @@ X3DCanvas #context-menu-layer {
|
|
|
335
335
|
letter-spacing: unset;
|
|
336
336
|
}
|
|
337
337
|
|
|
338
|
-
.x_ite-private-menu .context-menu-separator {
|
|
339
|
-
padding-top: 0;
|
|
340
|
-
padding-bottom: 0;
|
|
341
|
-
border-bottom: 1px solid #111;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
338
|
.x_ite-private-menu .context-menu-item > label > input,
|
|
345
339
|
.x_ite-private-menu .context-menu-item > label > textarea {
|
|
346
340
|
all: revert;
|
|
@@ -360,13 +354,24 @@ X3DCanvas #context-menu-layer {
|
|
|
360
354
|
-moz-appearance: radio;
|
|
361
355
|
}
|
|
362
356
|
|
|
363
|
-
.x_ite-private-menu .context-menu-hover {
|
|
357
|
+
.x_ite-private-menu .context-menu-item:hover {
|
|
364
358
|
cursor: pointer;
|
|
365
359
|
background-color: #444;
|
|
366
360
|
border-top: 1px solid #eee;
|
|
367
361
|
border-bottom: 1px solid #eee;
|
|
368
362
|
}
|
|
369
363
|
|
|
364
|
+
.x_ite-private-menu .context-menu-item.context-menu-separator {
|
|
365
|
+
padding-top: 0;
|
|
366
|
+
padding-bottom: 0;
|
|
367
|
+
border-top: 0;
|
|
368
|
+
border-bottom: 1px solid #111;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
.x_ite-private-menu .context-menu-separator + .context-menu-separator {
|
|
372
|
+
display: none !important;
|
|
373
|
+
}
|
|
374
|
+
|
|
370
375
|
.x_ite-private-menu .context-menu-disabled {
|
|
371
376
|
color: #666;
|
|
372
377
|
}
|
|
@@ -445,7 +450,7 @@ X3DCanvas #context-menu-layer {
|
|
|
445
450
|
}
|
|
446
451
|
|
|
447
452
|
.x_ite-private-menu .context-menu-item > .context-menu-list {
|
|
448
|
-
top:
|
|
453
|
+
top: -9px;
|
|
449
454
|
/* re-positioned by js */
|
|
450
455
|
right: -5px;
|
|
451
456
|
display: none;
|
package/src/x_ite.js
CHANGED
|
@@ -70,8 +70,8 @@ const getScriptURL = (function ()
|
|
|
70
70
|
{
|
|
71
71
|
if (document .currentScript)
|
|
72
72
|
var src = document .currentScript .src;
|
|
73
|
-
else if (typeof __filename === "string")
|
|
74
|
-
var src = __filename;
|
|
73
|
+
else if (typeof globalRequire === "function" && typeof __filename === "string")
|
|
74
|
+
var src = globalRequire ("url") .pathToFileURL (__filename) .href;
|
|
75
75
|
|
|
76
76
|
return function ()
|
|
77
77
|
{
|