x_ite 11.3.2 → 11.4.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 +4 -4
- package/dist/LICENSE.md +2 -5
- package/dist/assets/components/AnnotationComponent.js +2 -2
- package/dist/assets/components/AnnotationComponent.min.js +2 -2
- package/dist/assets/components/CADGeometryComponent.js +2 -2
- package/dist/assets/components/CADGeometryComponent.min.js +2 -2
- package/dist/assets/components/CubeMapTexturingComponent.js +6 -6
- package/dist/assets/components/CubeMapTexturingComponent.min.js +2 -2
- package/dist/assets/components/DISComponent.js +2 -2
- package/dist/assets/components/DISComponent.min.js +2 -2
- package/dist/assets/components/EventUtilitiesComponent.js +2 -2
- package/dist/assets/components/EventUtilitiesComponent.min.js +2 -2
- package/dist/assets/components/Geometry2DComponent.js +2 -2
- package/dist/assets/components/Geometry2DComponent.min.js +2 -2
- package/dist/assets/components/GeospatialComponent.js +2 -2
- package/dist/assets/components/GeospatialComponent.min.js +2 -2
- package/dist/assets/components/HAnimComponent.js +2 -2
- package/dist/assets/components/HAnimComponent.min.js +2 -2
- package/dist/assets/components/KeyDeviceSensorComponent.js +2 -2
- package/dist/assets/components/KeyDeviceSensorComponent.min.js +2 -2
- package/dist/assets/components/LayoutComponent.js +2 -2
- package/dist/assets/components/LayoutComponent.min.js +2 -2
- package/dist/assets/components/NURBSComponent.js +2 -2
- package/dist/assets/components/NURBSComponent.min.js +2 -2
- package/dist/assets/components/ParticleSystemsComponent.js +2 -2
- package/dist/assets/components/ParticleSystemsComponent.min.js +2 -2
- package/dist/assets/components/PickingComponent.js +2 -2
- package/dist/assets/components/PickingComponent.min.js +2 -2
- package/dist/assets/components/RigidBodyPhysicsComponent.js +2 -2
- package/dist/assets/components/RigidBodyPhysicsComponent.min.js +2 -2
- package/dist/assets/components/ScriptingComponent.js +2 -2
- package/dist/assets/components/ScriptingComponent.min.js +2 -2
- package/dist/assets/components/TextComponent.js +293 -136
- package/dist/assets/components/TextComponent.min.js +2 -2
- package/dist/assets/components/TextureProjectionComponent.js +2 -2
- package/dist/assets/components/TextureProjectionComponent.min.js +2 -2
- package/dist/assets/components/Texturing3DComponent.js +4320 -4320
- package/dist/assets/components/Texturing3DComponent.min.js +2 -2
- package/dist/assets/components/VolumeRenderingComponent.js +2 -2
- package/dist/assets/components/VolumeRenderingComponent.min.js +2 -2
- package/dist/assets/components/WebXRComponent.js +2 -2
- package/dist/assets/components/WebXRComponent.min.js +2 -2
- package/dist/assets/components/X_ITEComponent.js +2 -7
- package/dist/assets/components/X_ITEComponent.min.js +2 -2
- package/dist/example.html +1 -1
- package/dist/x_ite.css +1 -1
- package/dist/x_ite.js +55432 -55426
- package/dist/x_ite.min.js +2 -2
- package/dist/x_ite.min.mjs +2 -2
- package/dist/x_ite.mjs +54840 -54834
- package/dist/x_ite.zip +0 -0
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* X_ITE v11.
|
|
2
|
-
const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D-11.
|
|
1
|
+
/* X_ITE v11.4.1 */
|
|
2
|
+
const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D-11.4.1")];
|
|
3
3
|
/******/ (() => { // webpackBootstrap
|
|
4
4
|
/******/ "use strict";
|
|
5
5
|
/******/ var __webpack_modules__ = ({
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* X_ITE v11.
|
|
2
|
-
const e=window[Symbol.for("X_ITE.X3D-11.
|
|
1
|
+
/* X_ITE v11.4.1 */
|
|
2
|
+
const e=window[Symbol.for("X_ITE.X3D-11.4.1")];(()=>{var t={254:t=>{t.exports=e.jquery}},n={};function o(e){var r=n[e];if(void 0!==r)return r.exports;var a=n[e]={exports:{}};return t[e](a,a.exports,o),a.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);const r=e.Components;var a=o.n(r);const i=e.X3DBaseNode;var s=o.n(i);const l=e.X3DFieldDefinition;var c=o.n(l);const u=e.FieldDefinitionArray;var d=o.n(u);const p=e.X3DField;var v=o.n(p);const F=e.X3DArrayField;var f=o.n(F);const h=e.Fields;var g=o.n(h);const S=e.X3DBrowser;var y=o.n(S);const D=e.ComponentInfo;var M=o.n(D);const m=e.ComponentInfoArray;var x=o.n(m);const w=e.ProfileInfo;var _=o.n(w);const N=e.ProfileInfoArray;var A=o.n(N);const O=e.ConcreteNodesArray;var I=o.n(O);const b=e.AbstractNodesArray;var E=o.n(b);const X=e.UnitInfo;var T=o.n(X);const C=e.UnitInfoArray;var V=o.n(C);const P=e.NamedNodesArray;var j=o.n(P);const B=e.ImportedNodesArray;var R=o.n(B);const U=e.X3DImportedNode;var L=o.n(U);const z=e.ExportedNodesArray;var $=o.n(z);const G=e.X3DExportedNode;var q=o.n(G);const k=e.X3DExecutionContext;var W=o.n(k);const H=e.X3DScene;var J=o.n(H);const K=e.ExternProtoDeclarationArray;var Q=o.n(K);const Y=e.ProtoDeclarationArray;var Z=o.n(Y);const ee=e.X3DExternProtoDeclaration;var te=o.n(ee);const ne=e.X3DProtoDeclaration;var oe=o.n(ne);const re=e.X3DProtoDeclarationNode;var ae=o.n(re);const ie=e.RouteArray;var se=o.n(ie);const le=e.X3DRoute;var ce=o.n(le);const ue=e.Namespace;var de=o.n(ue);const pe=function(e,t,n){return new Function("with (arguments [0])\n {\n return eval ((() =>\n {\n const sourceText = arguments [1];\n\n delete arguments [0];\n delete arguments [1];\n\n arguments .length = 0;\n\n return sourceText;\n })\n ());\n }").call(e,t,n)},ve=de().add("evaluate",pe),Fe=e.X3DNode;var fe=o.n(Fe);const he=e.X3DChildNode;var ge=o.n(he);const Se=e.X3DUrlObject;var ye=o.n(Se);const De=e.X3DConstants;var Me=o.n(De);function me(e){ge().call(this,e),ye().call(this,e),this.addType(Me().X3DScriptNode)}Object.assign(Object.setPrototypeOf(me.prototype,ge().prototype),ye().prototype,{initialize(){ge().prototype.initialize.call(this),ye().prototype.initialize.call(this)},dispose(){ye().prototype.dispose.call(this),ge().prototype.dispose.call(this)}}),Object.defineProperties(me,fe().getStaticProperties("X3DScriptNode","Scripting",1));const xe=me,we=de().add("X3DScriptNode",xe),_e=e.FileLoader;var Ne=o.n(_e);const Ae=e.SFNodeCache;var Oe=o.n(Ae),Ie=o(254);function be(e){we.call(this,e),this.addType(Me().Script)}Object.assign(Object.setPrototypeOf(be.prototype,we.prototype),{initialize(){we.prototype.initialize.call(this),this.requestImmediateLoad().catch(Function.prototype)},getExtendedEventHandling:()=>!1,canUserDefinedFields:()=>!0,addUserDefinedField(e,t,n){we.prototype.addUserDefinedField.call(this,e,t,n),this.isInitialized()&&(this.setLoadState(Me().NOT_STARTED_STATE),this.requestImmediateLoad().catch(Function.prototype))},removeUserDefinedField(e){this.getUserDefinedFields().get(e)?.removeInterest("set_field__",this),we.prototype.removeUserDefinedField.call(this,e),this.isInitialized()&&(this.setLoadState(Me().NOT_STARTED_STATE),this.requestImmediateLoad().catch(Function.prototype))},getSourceText(){return this._url},unloadData(){const e=this.context?.get("shutdown");"function"==typeof e&&this.call__(e,"shutdown"),Ie(window).off(`.Script-${this.getId()}`),this.getBrowser().prepareEvents().removeInterest("call__",this),this.removeInterest("call__",this);for(const e of this.getUserDefinedFields())e.removeInterest("set_field__",this)},async loadData(){await this.unloadData(),new(Ne())(this).loadDocument(this._url,(e=>{null===e?this.setLoadState(Me().FAILED_STATE):(this.initialize__(Ie.decodeText(e)),this.setLoadState(Me().COMPLETE_STATE))}))},createGlobalObject(){const e=()=>this,t={get(t,n){switch(n){case"getScriptNode":return e;case"currentScene":return e().getExecutionContext();default:return t[n]}}},n=new Proxy(this.getBrowser(),t);function o(e){const t=n.createVrmlFromString(e);if(t.length&&t[0])return t[0];throw new Error("SFNode.new: invalid argument.")}o.prototype=g().SFNode.prototype;const r={NULL:{value:null},FALSE:{value:!1},TRUE:{value:!0},print:{value:n.println.bind(n)},trace:{value:n.println.bind(n)},Browser:{value:n},X3DConstants:{value:Me()},X3DBrowser:{value:y()},X3DExecutionContext:{value:W()},X3DScene:{value:J()},ComponentInfo:{value:M()},ComponentInfoArray:{value:x()},ProfileInfo:{value:_()},ProfileInfoArray:{value:A()},ConcreteNodesArray:{value:I()},AbstractNodesArray:{value:E()},UnitInfo:{value:T()},UnitInfoArray:{value:V()},NamedNodesArray:{value:j()},ImportedNodesArray:{value:R()},X3DImportedNode:{value:L()},ExportedNodesArray:{value:$()},X3DExportedNode:{value:q()},ExternProtoDeclarationArray:{value:Q()},ProtoDeclarationArray:{value:Z()},X3DExternProtoDeclaration:{value:te()},X3DProtoDeclaration:{value:oe()},X3DProtoDeclarationNode:{value:ae()},RouteArray:{value:se()},X3DRoute:{value:ce()},X3DBaseNode:{value:s()},X3DFieldDefinition:{value:c()},FieldDefinitionArray:{value:d()},X3DField:{value:v()},X3DArrayField:{value:f()},SFColor:{value:g().SFColor},SFColorRGBA:{value:g().SFColorRGBA},SFImage:{value:g().SFImage},SFMatrix3d:{value:g().SFMatrix3d},SFMatrix3f:{value:g().SFMatrix3f},SFMatrix4d:{value:g().SFMatrix4d},SFMatrix4f:{value:g().SFMatrix4f},SFNode:{value:o},SFRotation:{value:g().SFRotation},SFString:{value:g().SFString},SFVec2d:{value:g().SFVec2d},SFVec2f:{value:g().SFVec2f},SFVec3d:{value:g().SFVec3d},SFVec3f:{value:g().SFVec3f},SFVec4d:{value:g().SFVec4d},SFVec4f:{value:g().SFVec4f},VrmlMatrix:{value:g().VrmlMatrix},MFBool:{value:g().MFBool},MFColor:{value:g().MFColor},MFColorRGBA:{value:g().MFColorRGBA},MFDouble:{value:g().MFDouble},MFFloat:{value:g().MFFloat},MFImage:{value:g().MFImage},MFInt32:{value:g().MFInt32},MFMatrix3d:{value:g().MFMatrix3d},MFMatrix3f:{value:g().MFMatrix3f},MFMatrix4d:{value:g().MFMatrix4d},MFMatrix4f:{value:g().MFMatrix4f},MFNode:{value:g().MFNode},MFRotation:{value:g().MFRotation},MFString:{value:g().MFString},MFTime:{value:g().MFTime},MFVec2d:{value:g().MFVec2d},MFVec2f:{value:g().MFVec2f},MFVec3d:{value:g().MFVec3d},MFVec3f:{value:g().MFVec3f},MFVec4d:{value:g().MFVec4d},MFVec4f:{value:g().MFVec4f}};for(const e of this.getUserDefinedFields()){if(e.getAccessType()===Me().inputOnly)continue;const t=[e.getName()];e.getAccessType()===Me().inputOutput&&t.push(e.getName()+"_changed");for(const n of t)n in r||(r[n]={get:e.valueOf.bind(e),set:e.setValue.bind(e)})}return Object.create(Object.prototype,r)},createContext(e){const t=["initialize","prepareEvents","eventsProcessed","shutdown"];for(const e of this.getUserDefinedFields())switch(e.getAccessType()){case Me().inputOnly:t.push(e.getName());break;case Me().inputOutput:t.push("set_"+e.getName())}e+=";\n["+t.map((e=>`typeof ${e} !== "undefined" ? ${e} : undefined`)).join(",")+"];";const n=this.evaluate(e),o=new Map;for(let e=0;e<t.length;++e)o.set(t[e],n[e]);return o},evaluate(e){return this.globalObject??=this.createGlobalObject(),ve(Oe().get(this),this.globalObject,e)},async initialize__(e){const t=this.getBrowser();this.globalObject=this.createGlobalObject(),this.context=this.createContext(e);const n=this.context.get("shutdown");"function"==typeof n&&Ie(window).on(`unload.Script-${this.getId()}`,(()=>this.call__(n,"shutdown")));const o=this.context.get("prepareEvents");"function"==typeof o&&t.prepareEvents().addInterest("call__",this,o,"prepareEvents");const r=this.context.get("eventsProcessed");"function"==typeof r&&this.addInterest("call__",this,r,"eventsProcessed");for(const e of this.getUserDefinedFields())switch(e.getAccessType()){case Me().inputOnly:{const t=this.context.get(e.getName());"function"==typeof t&&e.addInterest("set_field__",this,t,[]);break}case Me().inputOutput:{const t=this.context.get("set_"+e.getName());"function"==typeof t&&e.addInterest("set_field__",this,t,[]);break}}const a=this.context.get("initialize");"function"==typeof a&&await this.call__(a,"initialize")},async call__(e,t){try{await e.call(Oe().get(this),this.getBrowser().getCurrentTime())}catch(e){this.setError(`in function '${t}'`,e)}},async set_field__(e,t,n){const o=t.pop()??n.create();try{o.assign(n),await e.call(Oe().get(this),o.valueOf(),this.getBrowser().getCurrentTime())}catch(e){this.setError(`in function '${n.getName()}'`,e)}finally{t.push(o)}},setError(e,t){const n=this.getExecutionContext().getWorldURL().startsWith("data:")?"data:":this.getExecutionContext().getWorldURL();console.error(`JavaScript Error in Script '${this.getName()}', ${e}\nworld url is '${n}':`),console.error(t)},dispose(){this.unloadData(),we.prototype.dispose.call(this)}}),Object.defineProperties(be,{...fe().getStaticProperties("Script","Scripting",1,"children","2.0"),fieldDefinitions:{value:new(d())([new(c())(Me().inputOutput,"metadata",new(g().SFNode)),new(c())(Me().inputOutput,"description",new(g().SFString)),new(c())(Me().inputOutput,"load",new(g().SFBool)(!0)),new(c())(Me().inputOutput,"url",new(g().MFString)),new(c())(Me().inputOutput,"autoRefresh",new(g().SFTime)(0)),new(c())(Me().inputOutput,"autoRefreshTimeLimit",new(g().SFTime)(3600)),new(c())(Me().initializeOnly,"directOutput",new(g().SFBool)),new(c())(Me().initializeOnly,"mustEvaluate",new(g().SFBool))]),enumerable:!0}});const Ee=be,Xe=de().add("Script",Ee);a().add({name:"Scripting",concreteNodes:[Xe],abstractNodes:[we]});de().add("ScriptingComponent",undefined)})();
|
|
@@ -1,9 +1,41 @@
|
|
|
1
|
-
/* X_ITE v11.
|
|
2
|
-
const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D-11.
|
|
1
|
+
/* X_ITE v11.4.1 */
|
|
2
|
+
const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D-11.4.1")];
|
|
3
3
|
/******/ (() => { // webpackBootstrap
|
|
4
4
|
/******/ "use strict";
|
|
5
|
-
/******/
|
|
6
|
-
|
|
5
|
+
/******/ var __webpack_modules__ = ({
|
|
6
|
+
|
|
7
|
+
/***/ 254:
|
|
8
|
+
/***/ ((module) => {
|
|
9
|
+
|
|
10
|
+
module.exports = __X_ITE_X3D__ .jquery;
|
|
11
|
+
|
|
12
|
+
/***/ })
|
|
13
|
+
|
|
14
|
+
/******/ });
|
|
15
|
+
/************************************************************************/
|
|
16
|
+
/******/ // The module cache
|
|
17
|
+
/******/ var __webpack_module_cache__ = {};
|
|
18
|
+
/******/
|
|
19
|
+
/******/ // The require function
|
|
20
|
+
/******/ function __webpack_require__(moduleId) {
|
|
21
|
+
/******/ // Check if module is in cache
|
|
22
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
23
|
+
/******/ if (cachedModule !== undefined) {
|
|
24
|
+
/******/ return cachedModule.exports;
|
|
25
|
+
/******/ }
|
|
26
|
+
/******/ // Create a new module (and put it into the cache)
|
|
27
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
28
|
+
/******/ // no module.id needed
|
|
29
|
+
/******/ // no module.loaded needed
|
|
30
|
+
/******/ exports: {}
|
|
31
|
+
/******/ };
|
|
32
|
+
/******/
|
|
33
|
+
/******/ // Execute the module function
|
|
34
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
35
|
+
/******/
|
|
36
|
+
/******/ // Return the exports of the module
|
|
37
|
+
/******/ return module.exports;
|
|
38
|
+
/******/ }
|
|
7
39
|
/******/
|
|
8
40
|
/************************************************************************/
|
|
9
41
|
/******/ /* webpack/runtime/compat get default export */
|
|
@@ -129,6 +161,7 @@ var external_X_ITE_X3D_X3DConstants_default = /*#__PURE__*/__webpack_require__.n
|
|
|
129
161
|
const external_X_ITE_X3D_URLs_namespaceObject = __X_ITE_X3D__ .URLs;
|
|
130
162
|
var external_X_ITE_X3D_URLs_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_URLs_namespaceObject);
|
|
131
163
|
;// ./src/x_ite/Components/Text/X3DFontStyleNode.js
|
|
164
|
+
/* provided dependency */ var $ = __webpack_require__(254);
|
|
132
165
|
/*******************************************************************************
|
|
133
166
|
*
|
|
134
167
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
@@ -210,21 +243,21 @@ const Fonts = new Map ([
|
|
|
210
243
|
|
|
211
244
|
function X3DFontStyleNode (executionContext)
|
|
212
245
|
{
|
|
246
|
+
// To be of type X3DUrlObject ensures that it will work inside StaticGroup
|
|
247
|
+
// and legacy implementation of load URLs over family field.
|
|
248
|
+
|
|
213
249
|
external_X_ITE_X3D_X3DNode_default().call (this, executionContext);
|
|
214
250
|
external_X_ITE_X3D_X3DUrlObject_default().call (this, executionContext);
|
|
215
251
|
|
|
216
252
|
this .addType ((external_X_ITE_X3D_X3DConstants_default()).X3DFontStyleNode);
|
|
217
253
|
|
|
218
254
|
this .addChildObjects ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "description", new (external_X_ITE_X3D_Fields_default()).SFString (),
|
|
219
|
-
(external_X_ITE_X3D_X3DConstants_default()).inputOutput, "url",
|
|
255
|
+
(external_X_ITE_X3D_X3DConstants_default()).inputOutput, "url", new (external_X_ITE_X3D_Fields_default()).MFString (),
|
|
220
256
|
(external_X_ITE_X3D_X3DConstants_default()).inputOutput, "load", new (external_X_ITE_X3D_Fields_default()).SFBool (true),
|
|
221
257
|
(external_X_ITE_X3D_X3DConstants_default()).inputOutput, "autoRefresh", new (external_X_ITE_X3D_Fields_default()).SFTime (0),
|
|
222
258
|
(external_X_ITE_X3D_X3DConstants_default()).inputOutput, "autoRefreshTimeLimit", new (external_X_ITE_X3D_Fields_default()).SFTime (3600));
|
|
223
259
|
|
|
224
|
-
this .
|
|
225
|
-
|
|
226
|
-
this .familyStack = [ ];
|
|
227
|
-
this .alignments = [ ];
|
|
260
|
+
this .alignments = [ ];
|
|
228
261
|
}
|
|
229
262
|
|
|
230
263
|
Object .assign (Object .setPrototypeOf (X3DFontStyleNode .prototype, (external_X_ITE_X3D_X3DNode_default()).prototype),
|
|
@@ -235,39 +268,44 @@ Object .assign (Object .setPrototypeOf (X3DFontStyleNode .prototype, (external_X
|
|
|
235
268
|
external_X_ITE_X3D_X3DNode_default().prototype .initialize .call (this);
|
|
236
269
|
external_X_ITE_X3D_X3DUrlObject_default().prototype .initialize .call (this);
|
|
237
270
|
|
|
238
|
-
this ._style .addInterest ("
|
|
271
|
+
this ._style .addInterest ("set_url__", this);
|
|
239
272
|
this ._justify .addInterest ("set_justify__", this);
|
|
240
273
|
|
|
241
|
-
this .font = null;
|
|
242
|
-
this .familyIndex = 0;
|
|
243
|
-
|
|
244
274
|
// Don't call set_style__.
|
|
245
275
|
this .set_justify__ ();
|
|
246
276
|
|
|
247
277
|
this .requestImmediateLoad () .catch (Function .prototype);
|
|
248
278
|
},
|
|
249
|
-
set_style__ ()
|
|
250
|
-
{
|
|
251
|
-
if (!this ._load .getValue ())
|
|
252
|
-
return;
|
|
253
|
-
|
|
254
|
-
this .setLoadState ((external_X_ITE_X3D_X3DConstants_default()).NOT_STARTED_STATE);
|
|
255
|
-
|
|
256
|
-
this .requestImmediateLoad () .catch (Function .prototype);
|
|
257
|
-
},
|
|
258
279
|
set_justify__ ()
|
|
259
280
|
{
|
|
260
281
|
const majorNormal = this ._horizontal .getValue () ? this ._leftToRight .getValue () : this ._topToBottom .getValue ();
|
|
261
282
|
|
|
262
283
|
this .alignments [0] = this ._justify .length > 0
|
|
263
|
-
|
|
264
|
-
|
|
284
|
+
? this .getAlignment (0, majorNormal)
|
|
285
|
+
: majorNormal ? Text_TextAlignment .BEGIN : Text_TextAlignment .END;
|
|
265
286
|
|
|
266
287
|
const minorNormal = this ._horizontal .getValue () ? this ._topToBottom .getValue () : this ._leftToRight .getValue ();
|
|
267
288
|
|
|
268
289
|
this .alignments [1] = this ._justify .length > 1
|
|
269
|
-
|
|
270
|
-
|
|
290
|
+
? this .getAlignment (1, minorNormal)
|
|
291
|
+
: minorNormal ? Text_TextAlignment .FIRST : Text_TextAlignment .END;
|
|
292
|
+
},
|
|
293
|
+
getAllowEmptyUrl ()
|
|
294
|
+
{
|
|
295
|
+
return true;
|
|
296
|
+
},
|
|
297
|
+
getFont ()
|
|
298
|
+
{
|
|
299
|
+
return this .font;
|
|
300
|
+
},
|
|
301
|
+
getDefaultFont (fontFamily, fontStyle)
|
|
302
|
+
{
|
|
303
|
+
const family = Fonts .get (fontFamily);
|
|
304
|
+
|
|
305
|
+
if (family)
|
|
306
|
+
return family .get (fontStyle) ?? family .get ("PLAIN");
|
|
307
|
+
|
|
308
|
+
return;
|
|
271
309
|
},
|
|
272
310
|
getMajorAlignment ()
|
|
273
311
|
{
|
|
@@ -306,65 +344,84 @@ Object .assign (Object .setPrototypeOf (X3DFontStyleNode .prototype, (external_X
|
|
|
306
344
|
|
|
307
345
|
return index ? Text_TextAlignment .FIRST : Text_TextAlignment .BEGIN;
|
|
308
346
|
},
|
|
309
|
-
|
|
347
|
+
async loadData ()
|
|
310
348
|
{
|
|
311
|
-
|
|
349
|
+
// Wait for FontLibrary nodes to be setuped or changed.
|
|
312
350
|
|
|
313
|
-
|
|
314
|
-
return family .get (this ._style .getValue ()) ?? family .get ("PLAIN");
|
|
351
|
+
await $.sleep (0);
|
|
315
352
|
|
|
316
|
-
return;
|
|
317
|
-
},
|
|
318
|
-
loadData ()
|
|
319
|
-
{
|
|
320
353
|
// Add default font to family array.
|
|
321
354
|
|
|
322
|
-
const
|
|
355
|
+
const
|
|
356
|
+
browser = this .getBrowser (),
|
|
357
|
+
executionContext = this .getExecutionContext (),
|
|
358
|
+
family = this ._family .copy (),
|
|
359
|
+
fontStyle = this ._style .getValue ();
|
|
323
360
|
|
|
324
361
|
family .push ("SERIF");
|
|
325
362
|
|
|
326
|
-
|
|
363
|
+
this .font = null;
|
|
327
364
|
|
|
328
|
-
|
|
365
|
+
for (const fontFamily of family)
|
|
366
|
+
{
|
|
367
|
+
// Try to get default font.
|
|
329
368
|
|
|
330
|
-
|
|
331
|
-
this .familyStack .push (this .getDefaultFont (familyName) ?? familyName);
|
|
369
|
+
const defaultFont = this .getDefaultFont (fontFamily, fontStyle);
|
|
332
370
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
371
|
+
if (defaultFont)
|
|
372
|
+
{
|
|
373
|
+
const font = await this .loadFont (defaultFont);
|
|
374
|
+
|
|
375
|
+
if (font)
|
|
376
|
+
{
|
|
377
|
+
this .font = font;
|
|
378
|
+
break;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
343
381
|
|
|
344
|
-
|
|
345
|
-
this .URL = new URL (this .family, this .getExecutionContext () .getBaseURL ());
|
|
382
|
+
// Try to get font from family names
|
|
346
383
|
|
|
347
|
-
|
|
348
|
-
.then (this .setFont .bind (this))
|
|
349
|
-
.catch (this .setError .bind (this));
|
|
350
|
-
},
|
|
351
|
-
setError (error)
|
|
352
|
-
{
|
|
353
|
-
if (this .URL .protocol !== "data:")
|
|
354
|
-
console .warn (`Error loading font '${decodeURI (this .URL .href)}':`, error);
|
|
384
|
+
const font = await browser .getFont (executionContext, fontFamily, fontStyle);
|
|
355
385
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
386
|
+
if (font)
|
|
387
|
+
{
|
|
388
|
+
this .font = font;
|
|
389
|
+
break;
|
|
390
|
+
}
|
|
361
391
|
|
|
362
|
-
|
|
392
|
+
// DEPRECIATED: Try to get font by URL.
|
|
393
|
+
|
|
394
|
+
const fileURL = new URL (fontFamily, executionContext .getBaseURL ());
|
|
395
|
+
|
|
396
|
+
if (fileURL .protocol === "data:" || fileURL .pathname .match (/\.(?:woff2|woff|otf|ttf)$/i))
|
|
397
|
+
{
|
|
398
|
+
if (executionContext .getSpecificationVersion () >= 4.1)
|
|
399
|
+
console .warn (`Loading a font file via family field is depreciated, please use new FontLibrary node instead.`);
|
|
400
|
+
|
|
401
|
+
const font = await this .loadFont (fileURL);
|
|
402
|
+
|
|
403
|
+
if (font)
|
|
404
|
+
{
|
|
405
|
+
this .font = font;
|
|
406
|
+
break;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
else
|
|
410
|
+
{
|
|
411
|
+
console .warn (`Couldn't find font family '${fontFamily}' with style '${fontStyle}'.`);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
this .setLoadState (this .font ? (external_X_ITE_X3D_X3DConstants_default()).COMPLETE_STATE : (external_X_ITE_X3D_X3DConstants_default()).FAILED_STATE);
|
|
363
416
|
this .addNodeEvent ();
|
|
364
417
|
},
|
|
365
|
-
|
|
418
|
+
async loadFont (fontPath)
|
|
366
419
|
{
|
|
367
|
-
|
|
420
|
+
const
|
|
421
|
+
browser = this .getBrowser (),
|
|
422
|
+
fileURL = new URL (fontPath, this .getExecutionContext () .getBaseURL ());
|
|
423
|
+
|
|
424
|
+
return await browser .loadFont (fileURL, true);
|
|
368
425
|
},
|
|
369
426
|
dispose ()
|
|
370
427
|
{
|
|
@@ -1144,6 +1201,8 @@ var external_X_ITE_X3D_libtess_default = /*#__PURE__*/__webpack_require__.n(exte
|
|
|
1144
1201
|
|
|
1145
1202
|
|
|
1146
1203
|
|
|
1204
|
+
const _glyphCache = Symbol ();
|
|
1205
|
+
|
|
1147
1206
|
function PolygonText (text, fontStyle)
|
|
1148
1207
|
{
|
|
1149
1208
|
Text_X3DTextGeometry .call (this, text, fontStyle);
|
|
@@ -1279,10 +1338,19 @@ Object .assign (Object .setPrototypeOf (PolygonText .prototype, Text_X3DTextGeom
|
|
|
1279
1338
|
}
|
|
1280
1339
|
};
|
|
1281
1340
|
})(),
|
|
1341
|
+
getGlyph (font, primitiveQuality, glyphIndex)
|
|
1342
|
+
{
|
|
1343
|
+
const
|
|
1344
|
+
cachedFont = font [_glyphCache] ??= [ ],
|
|
1345
|
+
cachedQuality = cachedFont [primitiveQuality] ??= [ ],
|
|
1346
|
+
cachedGlyph = cachedQuality [glyphIndex] ??= { };
|
|
1347
|
+
|
|
1348
|
+
return cachedGlyph;
|
|
1349
|
+
},
|
|
1282
1350
|
getGlyphExtents (font, glyph, primitiveQuality, min, max)
|
|
1283
1351
|
{
|
|
1284
1352
|
const
|
|
1285
|
-
glyphCache = this .
|
|
1353
|
+
glyphCache = this .getGlyph (font, primitiveQuality, glyph .index),
|
|
1286
1354
|
extents = glyphCache .extents;
|
|
1287
1355
|
|
|
1288
1356
|
if (extents)
|
|
@@ -1313,31 +1381,19 @@ Object .assign (Object .setPrototypeOf (PolygonText .prototype, Text_X3DTextGeom
|
|
|
1313
1381
|
},
|
|
1314
1382
|
getGlyphGeometry (font, glyph, primitiveQuality)
|
|
1315
1383
|
{
|
|
1316
|
-
const
|
|
1317
|
-
glyphCache = this .getBrowser () .getGlyph (font, primitiveQuality, glyph .index),
|
|
1318
|
-
glyphGeometry = glyphCache .geometry;
|
|
1319
|
-
|
|
1320
|
-
if (glyphGeometry)
|
|
1321
|
-
{
|
|
1322
|
-
return glyphGeometry;
|
|
1323
|
-
}
|
|
1324
|
-
else
|
|
1325
|
-
{
|
|
1326
|
-
const glyphGeometry = glyphCache .geometry = [ ];
|
|
1327
|
-
|
|
1328
|
-
this .createGlyphGeometry (glyph, glyphGeometry, primitiveQuality);
|
|
1384
|
+
const glyphCache = this .getGlyph (font, primitiveQuality, glyph .index);
|
|
1329
1385
|
|
|
1330
|
-
|
|
1331
|
-
}
|
|
1386
|
+
return glyphCache .geometry ??= this .createGlyphGeometry (glyph, primitiveQuality);
|
|
1332
1387
|
},
|
|
1333
|
-
createGlyphGeometry (glyph,
|
|
1388
|
+
createGlyphGeometry (glyph, primitiveQuality)
|
|
1334
1389
|
{
|
|
1335
1390
|
// Get contours for the current glyph.
|
|
1336
1391
|
|
|
1337
1392
|
const
|
|
1338
1393
|
steps = this .getBezierSteps (primitiveQuality),
|
|
1339
1394
|
path = glyph .getPath (0, 0, 1),
|
|
1340
|
-
contours = [ ]
|
|
1395
|
+
contours = [ ],
|
|
1396
|
+
vertices = [ ];
|
|
1341
1397
|
|
|
1342
1398
|
let
|
|
1343
1399
|
points = [ ],
|
|
@@ -17709,6 +17765,9 @@ function loadSync() {
|
|
|
17709
17765
|
}
|
|
17710
17766
|
|
|
17711
17767
|
|
|
17768
|
+
;// external "__X_ITE_X3D__ .DEVELOPMENT"
|
|
17769
|
+
const external_X_ITE_X3D_DEVELOPMENT_namespaceObject = __X_ITE_X3D__ .DEVELOPMENT;
|
|
17770
|
+
var external_X_ITE_X3D_DEVELOPMENT_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_DEVELOPMENT_namespaceObject);
|
|
17712
17771
|
;// ./src/x_ite/Browser/Text/X3DTextContext.js
|
|
17713
17772
|
/*******************************************************************************
|
|
17714
17773
|
*
|
|
@@ -17761,108 +17820,206 @@ function loadSync() {
|
|
|
17761
17820
|
|
|
17762
17821
|
|
|
17763
17822
|
|
|
17823
|
+
|
|
17764
17824
|
const
|
|
17765
17825
|
_defaultFontStyle = Symbol (),
|
|
17826
|
+
_defaultFamilies = Symbol (),
|
|
17766
17827
|
_fontCache = Symbol (),
|
|
17767
|
-
|
|
17828
|
+
_loadingFonts = Symbol (),
|
|
17829
|
+
_families = Symbol (),
|
|
17830
|
+
_library = Symbol (),
|
|
17768
17831
|
_wawoff2 = Symbol ();
|
|
17769
17832
|
|
|
17770
17833
|
function X3DTextContext ()
|
|
17771
17834
|
{
|
|
17772
|
-
this [
|
|
17773
|
-
this [
|
|
17835
|
+
this [_defaultFamilies] = new Set (["SERIF", "SANS", "TYPEWRITER"]);
|
|
17836
|
+
this [_loadingFonts] = new Set ();
|
|
17837
|
+
this [_fontCache] = new Map ();
|
|
17838
|
+
this [_families] = new WeakMap ();
|
|
17839
|
+
this [_library] = new WeakMap ();
|
|
17774
17840
|
}
|
|
17775
17841
|
|
|
17776
17842
|
Object .assign (X3DTextContext .prototype,
|
|
17777
17843
|
{
|
|
17778
17844
|
getDefaultFontStyle ()
|
|
17779
17845
|
{
|
|
17780
|
-
this [_defaultFontStyle]
|
|
17781
|
-
|
|
17782
|
-
|
|
17783
|
-
|
|
17784
|
-
this .getDefaultFontStyle = function () { return this [_defaultFontStyle]; };
|
|
17846
|
+
return this [_defaultFontStyle] ??= (() =>
|
|
17847
|
+
{
|
|
17848
|
+
const defaultFontStyle = new Text_FontStyle (this .getPrivateScene ());
|
|
17785
17849
|
|
|
17786
|
-
|
|
17850
|
+
defaultFontStyle .setPrivate (true);
|
|
17851
|
+
defaultFontStyle .setup ();
|
|
17787
17852
|
|
|
17788
|
-
|
|
17853
|
+
return defaultFontStyle;
|
|
17854
|
+
})();
|
|
17789
17855
|
},
|
|
17790
|
-
|
|
17856
|
+
/**
|
|
17857
|
+
*
|
|
17858
|
+
* @param {URL} fileURL
|
|
17859
|
+
* @param {boolean} cache
|
|
17860
|
+
* @returns Promise<OpenType.Font>
|
|
17861
|
+
*/
|
|
17862
|
+
loadFont (fileURL, cache = true)
|
|
17791
17863
|
{
|
|
17792
|
-
|
|
17793
|
-
|
|
17794
|
-
let promise = this [_fontCache] .get (url);
|
|
17864
|
+
let promise = cache ? this [_fontCache] .get (fileURL .href) : null;
|
|
17795
17865
|
|
|
17796
17866
|
if (!promise)
|
|
17797
17867
|
{
|
|
17798
|
-
|
|
17868
|
+
promise = new Promise (async (resolve, reject) =>
|
|
17799
17869
|
{
|
|
17800
17870
|
try
|
|
17801
17871
|
{
|
|
17802
|
-
const response = await fetch (
|
|
17872
|
+
const response = await fetch (fileURL, { cache: cache ? "default" : "reload" });
|
|
17803
17873
|
|
|
17804
17874
|
if (!response .ok)
|
|
17805
17875
|
throw new Error (response .statusText || response .status);
|
|
17806
17876
|
|
|
17807
|
-
const decompress = url .includes (".woff2")
|
|
17808
|
-
? await this .getWebAssemblyWoff2 ()
|
|
17809
|
-
: buffer => buffer;
|
|
17810
|
-
|
|
17811
17877
|
const
|
|
17812
|
-
|
|
17813
|
-
decompressed =
|
|
17878
|
+
arrayBuffer = await response .arrayBuffer (),
|
|
17879
|
+
decompressed = await this .decompressFont (arrayBuffer),
|
|
17814
17880
|
font = parseBuffer (decompressed);
|
|
17815
17881
|
|
|
17816
|
-
|
|
17817
|
-
|
|
17818
|
-
|
|
17819
|
-
|
|
17820
|
-
|
|
17821
|
-
// console .log (... Object .values (name .fullName));
|
|
17822
|
-
// console .log (... Object .values (name .fontFamily));
|
|
17823
|
-
// console .log (name .preferredFamily);
|
|
17824
|
-
// console .log (name .preferredSubfamily);
|
|
17825
|
-
// }
|
|
17882
|
+
if ((external_X_ITE_X3D_DEVELOPMENT_default()))
|
|
17883
|
+
{
|
|
17884
|
+
if (fileURL .protocol !== "data:")
|
|
17885
|
+
console .info (`Done loading font '${decodeURI (fileURL)}'.`);
|
|
17886
|
+
}
|
|
17826
17887
|
|
|
17827
17888
|
resolve (font);
|
|
17828
17889
|
}
|
|
17829
17890
|
catch (error)
|
|
17830
17891
|
{
|
|
17831
|
-
|
|
17892
|
+
if (fileURL .protocol !== "data:")
|
|
17893
|
+
console .warn (`Error loading font '${decodeURI (fileURL)}':`, error);
|
|
17894
|
+
|
|
17895
|
+
resolve (null);
|
|
17896
|
+
}
|
|
17897
|
+
finally
|
|
17898
|
+
{
|
|
17899
|
+
this [_loadingFonts] .delete (promise);
|
|
17832
17900
|
}
|
|
17833
|
-
})
|
|
17901
|
+
});
|
|
17902
|
+
|
|
17903
|
+
this [_loadingFonts] .add (promise);
|
|
17904
|
+
|
|
17905
|
+
if (!fileURL .search)
|
|
17906
|
+
this [_fontCache] .set (fileURL .href, promise);
|
|
17834
17907
|
}
|
|
17835
17908
|
|
|
17836
17909
|
return promise;
|
|
17837
17910
|
},
|
|
17838
|
-
|
|
17911
|
+
registerFont (executionContext, font)
|
|
17839
17912
|
{
|
|
17840
|
-
|
|
17913
|
+
const
|
|
17914
|
+
scene = executionContext .getLocalScene (),
|
|
17915
|
+
families = this [_families] .get (scene) ?? new Map ();
|
|
17841
17916
|
|
|
17842
|
-
|
|
17843
|
-
this [_glyphCache] .set (font, cachedFont = [ ]);
|
|
17917
|
+
this [_families] .set (scene, families);
|
|
17844
17918
|
|
|
17845
|
-
|
|
17919
|
+
// fontFamily - fontStyle
|
|
17846
17920
|
|
|
17847
|
-
|
|
17848
|
-
|
|
17921
|
+
const fontFamilies = new Map (Object .values (font .names)
|
|
17922
|
+
.flatMap (name => Object .values (name .fontFamily ?? { }) .map (fontFamily => [fontFamily, name])));
|
|
17849
17923
|
|
|
17850
|
-
|
|
17924
|
+
for (const [fontFamily, name] of fontFamilies)
|
|
17925
|
+
{
|
|
17926
|
+
if (this [_defaultFamilies] .has (fontFamily .toUpperCase ()))
|
|
17927
|
+
continue;
|
|
17851
17928
|
|
|
17852
|
-
|
|
17853
|
-
cachedGlyph = cachedQuality [glyphIndex] = { };
|
|
17929
|
+
const fontStyles = families .get (fontFamily .toUpperCase ()) ?? new Map ();
|
|
17854
17930
|
|
|
17855
|
-
|
|
17931
|
+
families .set (fontFamily .toUpperCase (), fontStyles);
|
|
17932
|
+
|
|
17933
|
+
for (const fontStyle of new Set (Object .values (name .fontSubfamily ?? { })))
|
|
17934
|
+
{
|
|
17935
|
+
if (this .getBrowserOption ("Debug"))
|
|
17936
|
+
console .info (`Registering font family ${fontFamily} - ${fontStyle}.`);
|
|
17937
|
+
|
|
17938
|
+
fontStyles .set (fontStyle .toUpperCase () .replaceAll (" ", ""), font);
|
|
17939
|
+
}
|
|
17940
|
+
}
|
|
17941
|
+
|
|
17942
|
+
// console .log (name .preferredFamily);
|
|
17943
|
+
// console .log (name .preferredSubfamily);
|
|
17944
|
+
},
|
|
17945
|
+
registerFontLibrary (executionContext, fontFamily, font)
|
|
17946
|
+
{
|
|
17947
|
+
if (this [_defaultFamilies] .has (fontFamily .toUpperCase ()))
|
|
17948
|
+
return;
|
|
17949
|
+
|
|
17950
|
+
const
|
|
17951
|
+
scene = executionContext .getLocalScene (),
|
|
17952
|
+
library = this [_library] .get (scene) ?? new Map ();
|
|
17953
|
+
|
|
17954
|
+
this [_library] .set (scene, library);
|
|
17955
|
+
|
|
17956
|
+
// if (this .getBrowserOption ("Debug"))
|
|
17957
|
+
// console .info (`Registering font named ${fontFamily}.`);
|
|
17958
|
+
|
|
17959
|
+
library .set (fontFamily .toUpperCase (), font);
|
|
17960
|
+
},
|
|
17961
|
+
async getFont (executionContext, fontFamily, fontStyle)
|
|
17962
|
+
{
|
|
17963
|
+
try
|
|
17964
|
+
{
|
|
17965
|
+
fontFamily = fontFamily .toUpperCase ();
|
|
17966
|
+
fontStyle = fontStyle .toUpperCase () .replaceAll (" ", "");
|
|
17967
|
+
|
|
17968
|
+
const scene = executionContext .getLocalScene ();
|
|
17969
|
+
|
|
17970
|
+
for (;;)
|
|
17971
|
+
{
|
|
17972
|
+
const
|
|
17973
|
+
library = this [_library] .get (scene),
|
|
17974
|
+
families = this [_families] .get (scene);
|
|
17975
|
+
|
|
17976
|
+
const font = library ?.get (fontFamily)
|
|
17977
|
+
?? families ?.get (fontFamily) ?.get (fontStyle);
|
|
17978
|
+
|
|
17979
|
+
if (font)
|
|
17980
|
+
return font;
|
|
17981
|
+
|
|
17982
|
+
await Promise .any (this [_loadingFonts]);
|
|
17983
|
+
}
|
|
17984
|
+
}
|
|
17985
|
+
catch
|
|
17986
|
+
{
|
|
17987
|
+
return null;
|
|
17988
|
+
}
|
|
17989
|
+
},
|
|
17990
|
+
async decompressFont (arrayBuffer)
|
|
17991
|
+
{
|
|
17992
|
+
if (this .isWoff2 (arrayBuffer))
|
|
17993
|
+
{
|
|
17994
|
+
const decompress = await this .getWoff2Decompressor ();
|
|
17995
|
+
|
|
17996
|
+
return decompress (arrayBuffer);
|
|
17997
|
+
}
|
|
17998
|
+
|
|
17999
|
+
return arrayBuffer;
|
|
17856
18000
|
},
|
|
17857
|
-
|
|
18001
|
+
isWoff2 (arrayBuffer)
|
|
17858
18002
|
{
|
|
17859
|
-
|
|
18003
|
+
if (arrayBuffer .byteLength < 4)
|
|
18004
|
+
return false;
|
|
18005
|
+
|
|
18006
|
+
const
|
|
18007
|
+
dataView = new DataView (arrayBuffer),
|
|
18008
|
+
magic = dataView .getUint32 (0, false);
|
|
18009
|
+
|
|
18010
|
+
return magic === 0x774F4632; // 'wOF2'
|
|
18011
|
+
},
|
|
18012
|
+
async getWoff2Decompressor ()
|
|
18013
|
+
{
|
|
18014
|
+
return this [_wawoff2] ??= await this .loadWoff2Decompressor ();
|
|
17860
18015
|
},
|
|
17861
|
-
async
|
|
18016
|
+
async loadWoff2Decompressor ()
|
|
17862
18017
|
{
|
|
18018
|
+
// https://www.npmjs.com/package/wawoff2
|
|
18019
|
+
|
|
17863
18020
|
const
|
|
17864
|
-
|
|
17865
|
-
response = await fetch (
|
|
18021
|
+
fileURL = external_X_ITE_X3D_URLs_default().getLibraryURL ("decompress_binding.js"),
|
|
18022
|
+
response = await fetch (fileURL);
|
|
17866
18023
|
|
|
17867
18024
|
if (!response .ok)
|
|
17868
18025
|
throw new Error (response .statusText || response .status);
|
|
@@ -17873,7 +18030,7 @@ Object .assign (X3DTextContext .prototype,
|
|
|
17873
18030
|
|
|
17874
18031
|
await new Promise (resolve => wawoff2 .onRuntimeInitialized = resolve);
|
|
17875
18032
|
|
|
17876
|
-
return
|
|
18033
|
+
return arrayBuffer => wawoff2 .decompress (arrayBuffer);
|
|
17877
18034
|
},
|
|
17878
18035
|
});
|
|
17879
18036
|
|