x_ite-sog-parser 1.0.5 → 1.1.1
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/README.md +6 -6
- package/dist/x_ite-sog-parser-2.js +3 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,20 +13,20 @@ Include the script after X_ITE:
|
|
|
13
13
|
|
|
14
14
|
```html
|
|
15
15
|
<script defer src="https://cdn.jsdelivr.net/npm/x_ite@VERSION/dist/x_ite.min.js"></script>
|
|
16
|
-
<script defer src="https://cdn.jsdelivr.net/npm/x_ite-sog-parser@1.
|
|
16
|
+
<script defer src="https://cdn.jsdelivr.net/npm/x_ite-sog-parser@1.1.1/dist/x_ite-sog-parser-2.min.js"></script>
|
|
17
17
|
<!-- or as ES module -->
|
|
18
18
|
<script type="module" src="https://cdn.jsdelivr.net/npm/x_ite@VERSION/dist/x_ite.min.mjs"></script>
|
|
19
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/x_ite-sog-parser@1.
|
|
19
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/x_ite-sog-parser@1.1.1/dist/x_ite-sog-parser-2.min.js"></script>
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
Now you can load
|
|
22
|
+
Now you can directly load `.sog` files with the `src` attribute, but you also have to add the `extensions` attribute with a number, how many X_ITE extension you have included. Each extension will decrease this count and when it becomes `0`, the canvas knows that all extensions are loaded and now starts loading the file in the `src` attribute.
|
|
23
|
+
|
|
24
|
+
You can also use `.sog` files as source of an Inline node.
|
|
23
25
|
|
|
24
26
|
```html
|
|
25
|
-
<x3d-canvas data-src="room.sog"></x3d-canvas>
|
|
27
|
+
<x3d-canvas data-src="room.sog" extensions="1"></x3d-canvas>
|
|
26
28
|
```
|
|
27
29
|
|
|
28
|
-
Or use `.sog` files as source of an Inline node.
|
|
29
|
-
|
|
30
30
|
## NPM
|
|
31
31
|
|
|
32
32
|
You can also install it from npm:
|
|
@@ -3150,22 +3150,15 @@ class SOGParser extends X3D .X3DParser
|
|
|
3150
3150
|
|
|
3151
3151
|
X3D .GoldenGate .addParsers (SOGParser);
|
|
3152
3152
|
|
|
3153
|
-
//
|
|
3153
|
+
// Decrement extensions attribute to show that the parser is loaded.
|
|
3154
3154
|
|
|
3155
3155
|
const canvases = document .querySelectorAll ("x3d-canvas");
|
|
3156
3156
|
|
|
3157
3157
|
for (const canvas of canvases)
|
|
3158
3158
|
{
|
|
3159
|
-
|
|
3160
|
-
browser = X3D .getBrowser (canvas),
|
|
3161
|
-
element = browser .element,
|
|
3162
|
-
src = element .getAttribute ("data-src");
|
|
3159
|
+
const { element } = X3D .getBrowser (canvas);
|
|
3163
3160
|
|
|
3164
|
-
|
|
3165
|
-
continue;
|
|
3166
|
-
|
|
3167
|
-
element .setAttribute ("src", src);
|
|
3168
|
-
element .removeAttribute ("data-src");
|
|
3161
|
+
element .setAttribute ("extensions", Math .max ((element .getAttribute ("extensions")|0) - 1, 0));
|
|
3169
3162
|
}
|
|
3170
3163
|
|
|
3171
3164
|
/******/ })()
|