@ndmspc/ndmvr 0.20240402.0 → 0.20240411.0

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/dist/ndmvr.es.js CHANGED
@@ -14546,103 +14546,103 @@ class Ff {
14546
14546
  }
14547
14547
  }
14548
14548
  ve = new WeakMap();
14549
- const A9 = new Ff(), t9 = hA.registerComponent(
14550
- "oculus-thumbstick-movement-controller",
14551
- {
14552
- schema: {
14553
- //only for this scene acc: -45 -> the directions are initialized wrong
14554
- acceleration: { type: "number", default: 40 },
14555
- fly: { type: "boolean", default: !1 },
14556
- horizontalAxis: { type: "string", enum: ["x", "y", "z"], default: "x" },
14557
- verticalAxis: { type: "string", enum: ["x", "y", "z"], default: "z" },
14558
- enabled: { type: "boolean", default: !0 },
14559
- adEnabled: { type: "boolean", default: !0 },
14560
- adInverted: { type: "boolean", default: !1 },
14561
- wsEnabled: { type: "boolean", default: !0 },
14562
- wsInverted: { type: "boolean", default: !1 }
14563
- },
14564
- required: [
14565
- "acceleration",
14566
- "fly",
14567
- "horizontalAxis",
14568
- "verticalAxis",
14569
- "enabled",
14570
- "adEnabled",
14571
- "adInverted",
14572
- "wsEnabled",
14573
- "wsInverted"
14574
- ],
14575
- init: function() {
14576
- this.velocity = new THREE.Vector3(0, 0, 0), this.tsData = new THREE.Vector2(0, 0), this.moveEasing = 1.1, this.thumbstickMoved = this.thumbstickMoved.bind(this);
14577
- const e = this.el;
14578
- let A = !1, t = !1;
14579
- e.addEventListener("gripdown", () => {
14580
- A = !0;
14581
- }), e.addEventListener("gripup", () => {
14582
- A = !1;
14583
- });
14584
- let n = 0;
14585
- const u = 500;
14586
- e.addEventListener("triggerdown", () => {
14587
- const r = performance.now();
14588
- if (r - n <= u) {
14589
- let d = function() {
14590
- let b = this.sceneElement.getAttribute("position"), v = {
14591
- x: b.x,
14592
- y: b.y - 1,
14593
- // decrease position by 1
14594
- z: b.z
14595
- };
14596
- this.sceneElement.setAttribute("position", v), v.y <= f && clearInterval(B);
14597
- }, f = 2, B = setInterval(d.bind(this), 20);
14598
- } else
14599
- t = !0;
14600
- n = r;
14601
- }), e.addEventListener("triggerup", () => {
14602
- n = performance.now(), t = !1;
14603
- }), e.addEventListener("thumbstickmoved", (r) => {
14604
- A && Ft() > 1 ? this.tsData.set(0, 0) : (t ? this.data.fly = !0 : this.data.fly = !1, this.thumbstickMoved(r));
14605
- });
14606
- },
14607
- update: function() {
14608
- this.sceneElement = document.getElementById("cameraRig");
14609
- },
14610
- //tick: function - every frame to update the position of the entity
14611
- tick: function(e, A) {
14612
- var t = this.data, n = this.velocity;
14613
- !n[
14614
- /*'x'*/
14615
- t.horizontalAxis
14616
- ] && !n[
14617
- /*'z'*/
14618
- t.verticalAxis
14619
- ] && !this.tsData.length() || (A = A / 1e3, this.updateVelocity(A), !(!n[t.horizontalAxis] && !n[t.verticalAxis]) && this.sceneElement.object3D.position.add(this.getMovementVector(A)));
14620
- },
14621
- updateVelocity: function(e) {
14622
- var A, t, n, u = this.data, r = this.velocity, f, d;
14623
- const B = 1e-5;
14624
- if (t = u.horizontalAxis, n = u.verticalAxis, e > 0.2) {
14625
- r[t] = 0, r[n] = 0;
14626
- return;
14627
- }
14628
- var b = Math.pow(1 / this.moveEasing, e * 60);
14629
- r[t] !== 0 && (r[t] = r[t] * b), r[n] !== 0 && (r[n] = r[n] * b), Math.abs(r[t]) < B && (r[t] = 0), Math.abs(r[n]) < B && (r[n] = 0), u.enabled && (A = u.acceleration, u.adEnabled && this.tsData.x && (d = u.adInverted ? -1 : 1, r[t] += d * A * this.tsData.x * e), u.wsEnabled && (f = u.wsInverted ? -1 : 1, r[n] += f * A * this.tsData.y * e));
14630
- },
14631
- getMovementVector: function() {
14632
- var e = new THREE.Vector3(0, 0, 0), A = new THREE.Euler(0, 0, 0, "YXZ"), t = 4;
14633
- return function(n) {
14634
- var u = this.el.sceneEl.camera.el.object3D.rotation, r = this.velocity, f;
14635
- return e.copy(r), e.multiplyScalar(n), u && (f = this.data.fly ? u.x : 0, A.set(f, u.y - t, 0), e.applyEuler(A)), e;
14636
- };
14637
- }(),
14638
- thumbstickMoved: function(e) {
14639
- this.tsData.set(e.detail.x, e.detail.y);
14640
- },
14641
- remove: function() {
14642
- this.el.removeEventListener("thumbstickmoved", this.thumbstickMoved);
14549
+ const A9 = new Ff(), t9 = hA.registerComponent("oculus-thumbstick-movement-controller", {
14550
+ schema: {
14551
+ //only for this scene acc: -45 -> the directions are initialized wrong
14552
+ acceleration: { type: "number", default: 40 },
14553
+ fly: { type: "boolean", default: !1 },
14554
+ horizontalAxis: { type: "string", enum: ["x", "y", "z"], default: "x" },
14555
+ verticalAxis: { type: "string", enum: ["x", "y", "z"], default: "z" },
14556
+ enabled: { type: "boolean", default: !0 },
14557
+ adEnabled: { type: "boolean", default: !0 },
14558
+ adInverted: { type: "boolean", default: !1 },
14559
+ wsEnabled: { type: "boolean", default: !0 },
14560
+ wsInverted: { type: "boolean", default: !1 }
14561
+ },
14562
+ required: [
14563
+ "acceleration",
14564
+ "fly",
14565
+ "horizontalAxis",
14566
+ "verticalAxis",
14567
+ "enabled",
14568
+ "adEnabled",
14569
+ "adInverted",
14570
+ "wsEnabled",
14571
+ "wsInverted"
14572
+ ],
14573
+ init: function() {
14574
+ this.velocity = new THREE.Vector3(0, 0, 0), this.tsData = new THREE.Vector2(0, 0), this.moveEasing = 1.1, this.thumbstickMoved = this.thumbstickMoved.bind(this);
14575
+ const e = this.el;
14576
+ let A = !1, t = !1;
14577
+ e.addEventListener("gripdown", () => {
14578
+ A = !0;
14579
+ }), e.addEventListener("gripup", () => {
14580
+ A = !1;
14581
+ });
14582
+ let n = 0;
14583
+ const u = 200;
14584
+ e.addEventListener("triggerdown", () => {
14585
+ const r = performance.now();
14586
+ if (r - n <= u && r - n >= 30) {
14587
+ let f = 2, B = setInterval((() => {
14588
+ let b = this.sceneElement.getAttribute("position");
14589
+ if (b.y <= f)
14590
+ return;
14591
+ let v = {
14592
+ x: b.x,
14593
+ y: b.y - 1,
14594
+ // decrease position by 1
14595
+ z: b.z
14596
+ };
14597
+ this.sceneElement.setAttribute("position", v), v.y <= f && clearInterval(B);
14598
+ }).bind(this), 20);
14599
+ } else
14600
+ t = !0;
14601
+ n = r;
14602
+ }), e.addEventListener("triggerup", () => {
14603
+ n = performance.now(), t = !1;
14604
+ }), e.addEventListener("thumbstickmoved", (r) => {
14605
+ A && Ft() > 1 ? this.tsData.set(0, 0) : (t ? this.data.fly = !0 : this.data.fly = !1, this.thumbstickMoved(r));
14606
+ });
14607
+ },
14608
+ update: function() {
14609
+ this.sceneElement = document.getElementById("cameraRig");
14610
+ },
14611
+ //tick: function - every frame to update the position of the entity
14612
+ tick: function(e, A) {
14613
+ var t = this.data, n = this.velocity;
14614
+ !n[
14615
+ /*'x'*/
14616
+ t.horizontalAxis
14617
+ ] && !n[
14618
+ /*'z'*/
14619
+ t.verticalAxis
14620
+ ] && !this.tsData.length() || (A = A / 1e3, this.updateVelocity(A), !(!n[t.horizontalAxis] && !n[t.verticalAxis]) && this.sceneElement.object3D.position.add(this.getMovementVector(A)));
14621
+ },
14622
+ updateVelocity: function(e) {
14623
+ var A, t, n, u = this.data, r = this.velocity, f, d;
14624
+ const B = 1e-5;
14625
+ if (t = u.horizontalAxis, n = u.verticalAxis, e > 0.2) {
14626
+ r[t] = 0, r[n] = 0;
14627
+ return;
14643
14628
  }
14629
+ var b = Math.pow(1 / this.moveEasing, e * 60);
14630
+ r[t] !== 0 && (r[t] = r[t] * b), r[n] !== 0 && (r[n] = r[n] * b), Math.abs(r[t]) < B && (r[t] = 0), Math.abs(r[n]) < B && (r[n] = 0), u.enabled && (A = u.acceleration, u.adEnabled && this.tsData.x && (d = u.adInverted ? -1 : 1, r[t] += d * A * this.tsData.x * e), u.wsEnabled && (f = u.wsInverted ? -1 : 1, r[n] += f * A * this.tsData.y * e));
14631
+ },
14632
+ getMovementVector: function() {
14633
+ var e = new THREE.Vector3(0, 0, 0), A = new THREE.Euler(0, 0, 0, "YXZ");
14634
+ return function(t) {
14635
+ var n = this.el.sceneEl.camera.el.object3D.rotation, u = this.velocity, r;
14636
+ return e.copy(u), e.multiplyScalar(t), n && (r = this.data.fly ? n.x : 0, A.set(r, n.y, 0), e.applyEuler(A)), e;
14637
+ };
14638
+ }(),
14639
+ thumbstickMoved: function(e) {
14640
+ this.tsData.set(e.detail.x, e.detail.y);
14641
+ },
14642
+ remove: function() {
14643
+ this.el.removeEventListener("thumbstickmoved", this.thumbstickMoved);
14644
14644
  }
14645
- ), e9 = new F3();
14645
+ }), e9 = new F3();
14646
14646
  export {
14647
14647
  Rf as Banner,
14648
14648
  Kf as HistogramTH2,
package/dist/ndmvr.umd.js CHANGED
@@ -427,4 +427,4 @@ the left controller.`,rotation:"-60 0 0",position:"0.1 0 0","wrap-count":"400"})
427
427
  selectColor: ${b.getSecondaryAccentColor()};
428
428
  axisX: ${b.getAxisColor("x")};
429
429
  axisY: ${b.getAxisColor("y")};
430
- axisZ: ${b.getAxisColor("z")}`;v.id=lA,v.positionX=N,v.positionY=w,v.positionZ=l,v.scaleX=a/2,v.scaleY=X,v.scaleZ=V/2,v.color=WA,v.class="clickable",v.data=yA,A.bins.attributes[H]=d.binTemplate(v),B.updateElement(H,z,"bins","a-box"),H++}B.deleteUnnecessaryElements(H,["bins"]),v.id=1500+H,v.positionX=F+.5,v.positionY=0,v.positionZ=x+.5,v.rotationX=270,v.rotationY=360,v.rotationZ=0,v.width=2,v.height=2,v.value="0",v.color=b.getAxisColor("y"),A.normalXAxis.attributes[0]=d.axisTemplate(v),B.updateElement(0,z,"normalXAxis","a-entity"),v.positionZ=u-2.5,v.rotationX=270,v.rotationY=180,A.reversedYAxis.attributes[0]=d.axisTemplate(v),B.updateElement(0,z,"reversedYAxis","a-entity"),v.positionX=n-2.5,v.positionZ=x+.5,A.normalYAxis.attributes[0]=d.axisTemplate(v),B.updateElement(0,z,"normalYAxis","a-entity"),v.positionZ=u-2.5,v.rotationY=180,A.reversedXAxis.attributes[0]=d.axisTemplate(v),B.updateElement(0,z,"reversedXAxis","a-entity"),H=1;for(let _=u;_<=x;_++)v.id=1500+H,v.positionX=n-2.5,v.positionY=0,v.positionZ=_-1,v.rotationX=270,v.rotationY=180,v.rotationZ=0,v.width=2,v.height=1,v.value=`${G[_-1]?G[_-1].fString:_-1}`,v.color=b.getAxisColor("z"),A.normalYAxis.attributes[H]=d.axisTemplate(v),B.updateElement(H,z,"normalYAxis","a-entity"),v.id=4500+H,v.positionX=F+.5,v.rotationY=360,v.value=`${G[_-1]?G[_-1].fString:_-1}`,A.reversedYAxis.attributes[H]=d.axisTemplate(v),B.updateElement(H,z,"reversedYAxis","a-entity"),H++;B.deleteUnnecessaryElements(H,["normalYAxis","reversedYAxis"]),H=1;for(let _=n;_<=F;_++)v.id=1500+H,v.positionX=_-1,v.positionY=0,v.positionZ=u-2.5,v.rotationX=270,v.rotationY=270,v.rotationZ=0,v.width=2,v.height=1,v.value=`${Z[_-1]?Z[_-1].fString:_-1}`,v.color=b.getAxisColor("x"),A.normalXAxis.attributes[H]=d.axisTemplate(v),B.updateElement(H,z,"normalXAxis","a-entity"),v.id=4500+H,v.positionZ=x+.5,v.rotationX=270,v.rotationY=90,v.value=`${Z[_-1]?Z[_-1].fString:_-1}`,A.reversedXAxis.attributes[H]=d.axisTemplate(v),B.updateElement(H,z,"reversedXAxis","a-entity"),H++;B.deleteUnnecessaryElements(H,["normalXAxis","reversedXAxis"]),v.positionX=n,v.positionY=0,v.positionZ=u-4,v.rotationX=270,v.rotationY=180,v.rotationZ=0,v.width=4,v.height=1,v.value=U,v.id="downLabel",A.labels.attributes[0]=d.labelTemplate(v),B.updateElement(0,z,"labels","a-entity"),v.positionX=F-2.5,v.positionZ=x+2,v.rotationY=0,v.id="upLabel",A.labels.attributes[1]=d.labelTemplate(v),B.updateElement(1,z,"labels","a-entity"),v.positionX=n-4,v.positionY=0,v.positionZ=u+.5,v.rotationX=270,v.rotationY=270,v.rotationZ=0,v.width=4,v.height=1,v.value=I,v.color=b.getAxisColor("z"),v.id="leftLabel",A.labels.attributes[2]=d.labelTemplate(v),B.updateElement(2,z,"labels","a-entity"),v.positionX=F+2,v.positionZ=x-2.5,v.rotationX=270,v.rotationY=90,v.id="rightLabel",A.labels.attributes[3]=d.labelTemplate(v),B.updateElement(3,z,"labels","a-entity"),v.positionX=n-90,v.positionY=-6.5,v.positionZ=u+90,v.rotationX=0,v.rotationY=123,v.rotationZ=0,v.title=t.fTitle,v.color=b.getPrimaryFontColor();const R={};R.positionX=0,R.positionY=0,R.positionZ=-1,R.width=170,R.height=30,R.color="white",A.titles.attributes[0]=d.titleTemplate(v,R),B.updateElement(0,z,"titles","a-entity"),v.positionX=n+120,v.positionZ=u-70,v.rotationY=330,v.title=t.fName,A.titles.attributes[1]=d.titleTemplate(v,R),B.updateElement(1,z,"titles","a-entity")}const rf=(e,A)=>e<=0?0:(A>1&&(e=Math.round((e/A+Number.EPSILON)*100)/100),e);class ff{constructor(A){K(this,$e,void 0);S(this,$e,A)}createTH2DemoHistogram(A,t,n,u){const r=Ht.createHistogram("TH2I",A,t);let f=n;for(let d=1;d<=20;d++)for(let B=1;B<=20;B++){const b=r.getBin(B,d);let v=0;v=f,r.setBinContent(b,v),f+=u}return r.fXaxis.fTitle="x Axis",r.fYaxis.fTitle="y Axis",r.fName="You don't have a valid file path",r.fTitle="This is a TH2 histogram demo",r.fMaximum=f,r}createTH3DemoHistogram(A,t,n,u,r){const f=Ht.createHistogram("TH3I",A,t,n);let d=u;for(let B=1;B<=20;B++)for(let b=1;b<=20;b++)for(let v=1;v<=20;v++){const z=f.getBin(v,b,B);let w=0;w=d,f.setBinContent(z,w),d+=r}return f.fXaxis.fTitle="x Axis",f.fYaxis.fTitle="y Axis",f.fZaxis.fTitle="z Axis",f.fName="You don't have a valid file path",f.fTitle="This is a TH3 histogram demo",f.fMaximum=d,f}}$e=new WeakMap;const gf=XA.registerComponent("th2-histogram",{schema:{section:{type:"string"},filename:{type:"string"},theme:{type:"string",default:"def"},position:{name:"position",xValue:0,yValue:.1,zValue:0},scale:{name:"scale",xValue:2,yValue:2,zValue:2},rotation:{name:"rotation",xValue:0,yValue:0,zValue:0}},init:function(){const e=this.el;jn(this.schema,e),document.addEventListener("keydown",Fe),document.addEventListener("keyup",Ie),this.demoHistogramService=new ff,this.localStorageService=new n3,this.cameraService=new pt,this.render=!1,this.histogram=null,this.model={bins:{elements:[],attributes:[]},labels:{elements:[],attributes:[]},titles:{elements:[],attributes:[]},banners:{elements:[],attributes:[]},normalXAxis:{elements:[],attributes:[]},reversedXAxis:{elements:[],attributes:[]},normalYAxis:{elements:[],attributes:[]},reversedYAxis:{elements:[],attributes:[]}},this.section=null;const A=n=>{console.log(n),this.section.xOffset=n.xOffset,this.section.yOffset=n.yOffset,this.range=n.range,this.cameraService.setCameraPosition(n),V3(this.el,this.model,this.histogram,this.section.xOffset,this.section.yOffset,this.section.range,this.data.theme),this.render=!0},t=n=>{this.localStorageService.storeTH2Offsets(n.xOffset,n.yOffset,n.range),A(n)};this.subscription=LA.getChangedSection().subscribe(t)},update:function(){Yn(),this.section=JSON.parse(this.data.section),Ht.openFile(this.data.filename).then(e=>e.readObject("hUsersVsProjects")).then(e=>{this.localStorageService.initHistogramData(e),this.histogram=e,V3(this.el,this.model,this.histogram,this.section.xOffset,this.section.yOffset,this.section.range,this.data.theme),this.render=!0}).then(()=>console.log("drawing completed")).catch(e=>{this.histogram=this.demoHistogramService.createTH2DemoHistogram(20,20,0,.1),this.localStorageService.initHistogramData(this.histogram),V3(this.el,this.model,this.histogram,this.section.xOffset,this.section.yOffset,this.section.range,this.data.theme),this.render=!0,console.log(e)})},tick:function(){this.render&&(this.render=!1)},remove:function(){this.subscription.unsubscribe(),document.removeEventListener("keydown",Fe),document.removeEventListener("keyup",Ie)}}),cf=XA.registerComponent("banner-control",{schema:{position:{name:"position",xValue:-1.28,yValue:.3,zValue:-1},scale:{name:"scale",xValue:.5,yValue:.7,zValue:.1},rotation:{name:"rotation",xValue:0,yValue:20,zValue:0}},init:function(){}});new pt;const df=e=>{e.detail.y>.95&&(LA.changeHistogramSectionByOffset("yOffset","TH2",!1,!1),EA.changeHistogramSectionByOffset("yOffset","TH3",!1,!1)),e.detail.y<-.95&&(LA.changeHistogramSectionByOffset("yOffset","TH2",!0,!1),EA.changeHistogramSectionByOffset("yOffset","TH3",!0,!1)),e.detail.x<-.95&&(gt.changeHistogramSectionByOffset("xOffset","TH1",!0,!1),LA.changeHistogramSectionByOffset("xOffset","TH2",!0,!1),EA.changeHistogramSectionByOffset("xOffset","TH3",!0,!1)),e.detail.x>.95&&(gt.changeHistogramSectionByOffset("xOffset","TH1",!1,!1),LA.changeHistogramSectionByOffset("xOffset","TH2",!1,!1),EA.changeHistogramSectionByOffset("xOffset","TH3",!1,!1))},vf=e=>{e.detail.y>.95&&(LA.changeHistogramSectionByOffset("yOffset","TH2",!1,!0),EA.changeHistogramSectionByOffset("yOffset","TH3",!1,!0)),e.detail.y<-.95&&(LA.changeHistogramSectionByOffset("yOffset","TH2",!0,!0),EA.changeHistogramSectionByOffset("yOffset","TH3",!0,!0)),e.detail.x<-.95&&(gt.changeHistogramSectionByOffset("xOffset","TH1",!0,!0),LA.changeHistogramSectionByOffset("xOffset","TH2",!0,!0),EA.changeHistogramSectionByOffset("xOffset","TH3",!0,!0)),e.detail.x>.95&&(gt.changeHistogramSectionByOffset("xOffset","TH1",!1,!0),LA.changeHistogramSectionByOffset("xOffset","TH2",!1,!0),EA.changeHistogramSectionByOffset("xOffset","TH3",!1,!0))},Bf=e=>{e.detail.y>.1&&wA.next({scale:-.1}),e.detail.y<-.1&&wA.next({scale:.1})},sf=e=>{e.detail.y>.1?wA.next({source:"next"}):e.detail.y<-.1&&wA.next({source:"prev"})},bf=e=>{e.detail.y>.1?wA.next({theme:"next"}):e.detail.y<-.1&&wA.next({theme:"prev"})},zf=e=>{e.detail.y>.1?wA.next({range:"next"}):e.detail.y<-.1&&wA.next({range:"prev"})},af=e=>{e.detail.y>.1?wA.next({scene:"next"}):e.detail.y<-.1&&wA.next({scene:"prev"})},t7=e=>{e==="Y"?wA.next({tool:"next"}):wA.next({tool:"prev"})},e7=e=>{EA.changeHistogramSectionByOffset("zOffset","TH3",!0,e)},n7=e=>{EA.changeHistogramSectionByOffset("zOffset","TH3",!1,e)},u7=()=>{new pt},Cf=e=>{df(e)},of=e=>{vf(e)},Xf=()=>{Le.saveSelectedBinToLocalStorage(),Yt()===0&&wA.next({binData:Le})},Qf=()=>{Le.deleteBinFromLocalStorage()},Of=()=>{LA.changeHistogramFunction("feet","TH2")},wf=()=>{LA.changeHistogramFunction("default","TH2")},lf=()=>{Zt.setVisibilityOfBanners("oculus")},Df=()=>{Zt.setUserState()},Pf=()=>{Zt.shiftBanners()},pf=e=>{e.forEach(A=>{})},xf=XA.registerComponent("left-controller-logging",{init:function(){let e=!1,A=!0,t=!1;const n=this.el;n.addEventListener("gripdown",()=>{e=!0}),n.addEventListener("gripup",()=>{e=!1}),n.addEventListener("thumbstickdown",()=>{}),n.addEventListener("thumbstickmoved",u=>{if(e&&Yt()===2)Bf(u);else if(e&&Yt()===3){if(A){A=!1,sf(u);const r=setTimeout(()=>{A=!0},450);return()=>clearTimeout(r)}}else if(e&&Yt()===4){if(A){A=!1,bf(u);const r=setTimeout(()=>{A=!0},450);return()=>clearTimeout(r)}}else if(e&&Yt()===5){if(A){A=!1,zf(u);const r=setTimeout(()=>{A=!0},450);return()=>clearTimeout(r)}}else if(e&&Yt()===6&&A){A=!1,af(u);const r=setTimeout(()=>{A=!0},600);return()=>clearTimeout(r)}}),n.addEventListener("ybuttondown",()=>{e?t||(t=!0,t7("Y")):lf()}),n.addEventListener("xbuttondown",()=>{e?t||(t=!0,t7("X")):Df()}),n.addEventListener("ybuttonup",()=>{t=!1}),n.addEventListener("xbuttonup",()=>{t=!1})},update:function(){u7()}}),Nf=XA.registerComponent("right-controller-logging",{init:function(){let e=!1;const A=this.el;A.addEventListener("gripdown",()=>{e=!0}),A.addEventListener("gripup",()=>{e=!1}),A.addEventListener("thumbstickmoved",t=>{e?Cf(t):of(t)}),A.addEventListener("bbuttondown",()=>{e7(!e)}),A.addEventListener("abuttondown",()=>{n7(!e)}),A.addEventListener("thumbstickdown",()=>{e?Of():wf()}),A.addEventListener("triggerdown",()=>{e?(Xf(),pf()):(Qf(),Pf())})},update:function(){u7()}});class Wf{constructor(){K(this,Be,void 0);S(this,Be,new bt)}sendSourceSubject(A){g(this,Be).next(A)}getSourceSettingSubject(){return g(this,Be).asObservable()}}Be=new WeakMap;const mf=new Wf,Vf=XA.registerComponent("oculus-thumbstick-movement-controller",{schema:{acceleration:{type:"number",default:40},fly:{type:"boolean",default:!1},horizontalAxis:{type:"string",enum:["x","y","z"],default:"x"},verticalAxis:{type:"string",enum:["x","y","z"],default:"z"},enabled:{type:"boolean",default:!0},adEnabled:{type:"boolean",default:!0},adInverted:{type:"boolean",default:!1},wsEnabled:{type:"boolean",default:!0},wsInverted:{type:"boolean",default:!1}},required:["acceleration","fly","horizontalAxis","verticalAxis","enabled","adEnabled","adInverted","wsEnabled","wsInverted"],init:function(){this.velocity=new THREE.Vector3(0,0,0),this.tsData=new THREE.Vector2(0,0),this.moveEasing=1.1,this.thumbstickMoved=this.thumbstickMoved.bind(this);const e=this.el;let A=!1,t=!1;e.addEventListener("gripdown",()=>{A=!0}),e.addEventListener("gripup",()=>{A=!1});let n=0;const u=500;e.addEventListener("triggerdown",()=>{const r=performance.now();if(r-n<=u){let d=function(){let b=this.sceneElement.getAttribute("position"),v={x:b.x,y:b.y-1,z:b.z};this.sceneElement.setAttribute("position",v),v.y<=f&&clearInterval(B)},f=2,B=setInterval(d.bind(this),20)}else t=!0;n=r}),e.addEventListener("triggerup",()=>{n=performance.now(),t=!1}),e.addEventListener("thumbstickmoved",r=>{A&&Yt()>1?this.tsData.set(0,0):(t?this.data.fly=!0:this.data.fly=!1,this.thumbstickMoved(r))})},update:function(){this.sceneElement=document.getElementById("cameraRig")},tick:function(e,A){var t=this.data,n=this.velocity;!n[t.horizontalAxis]&&!n[t.verticalAxis]&&!this.tsData.length()||(A=A/1e3,this.updateVelocity(A),!(!n[t.horizontalAxis]&&!n[t.verticalAxis])&&this.sceneElement.object3D.position.add(this.getMovementVector(A)))},updateVelocity:function(e){var A,t,n,u=this.data,r=this.velocity,f,d;const B=1e-5;if(t=u.horizontalAxis,n=u.verticalAxis,e>.2){r[t]=0,r[n]=0;return}var b=Math.pow(1/this.moveEasing,e*60);r[t]!==0&&(r[t]=r[t]*b),r[n]!==0&&(r[n]=r[n]*b),Math.abs(r[t])<B&&(r[t]=0),Math.abs(r[n])<B&&(r[n]=0),u.enabled&&(A=u.acceleration,u.adEnabled&&this.tsData.x&&(d=u.adInverted?-1:1,r[t]+=d*A*this.tsData.x*e),u.wsEnabled&&(f=u.wsInverted?-1:1,r[n]+=f*A*this.tsData.y*e))},getMovementVector:function(){var e=new THREE.Vector3(0,0,0),A=new THREE.Euler(0,0,0,"YXZ"),t=4;return function(n){var u=this.el.sceneEl.camera.el.object3D.rotation,r=this.velocity,f;return e.copy(r),e.multiplyScalar(n),u&&(f=this.data.fly?u.x:0,A.set(f,u.y-t,0),e.applyEuler(A)),e}}(),thumbstickMoved:function(e){this.tsData.set(e.detail.x,e.detail.y)},remove:function(){this.el.removeEventListener("thumbstickmoved",this.thumbstickMoved)}}),Tf=new n3;gA.Banner=cf,gA.HistogramTH2=gf,gA.LeftController=xf,gA.NdmVr=tf,gA.NdmVrScene=Kn,gA.RegisterVerticalMoveComponent=$n,gA.RightController=Nf,gA.TabletContext=Nt,gA.ThumbsticController=Vf,gA.defaultScheme=Ue,gA.ndmVrStorage=Tf,gA.registerScreenControlsComponent=_n,gA.registerVRModeDetector=Rn,gA.sourceSettingSubject=mf,Object.defineProperty(gA,Symbol.toStringTag,{value:"Module"})});
430
+ axisZ: ${b.getAxisColor("z")}`;v.id=lA,v.positionX=N,v.positionY=w,v.positionZ=l,v.scaleX=a/2,v.scaleY=X,v.scaleZ=V/2,v.color=WA,v.class="clickable",v.data=yA,A.bins.attributes[H]=d.binTemplate(v),B.updateElement(H,z,"bins","a-box"),H++}B.deleteUnnecessaryElements(H,["bins"]),v.id=1500+H,v.positionX=F+.5,v.positionY=0,v.positionZ=x+.5,v.rotationX=270,v.rotationY=360,v.rotationZ=0,v.width=2,v.height=2,v.value="0",v.color=b.getAxisColor("y"),A.normalXAxis.attributes[0]=d.axisTemplate(v),B.updateElement(0,z,"normalXAxis","a-entity"),v.positionZ=u-2.5,v.rotationX=270,v.rotationY=180,A.reversedYAxis.attributes[0]=d.axisTemplate(v),B.updateElement(0,z,"reversedYAxis","a-entity"),v.positionX=n-2.5,v.positionZ=x+.5,A.normalYAxis.attributes[0]=d.axisTemplate(v),B.updateElement(0,z,"normalYAxis","a-entity"),v.positionZ=u-2.5,v.rotationY=180,A.reversedXAxis.attributes[0]=d.axisTemplate(v),B.updateElement(0,z,"reversedXAxis","a-entity"),H=1;for(let _=u;_<=x;_++)v.id=1500+H,v.positionX=n-2.5,v.positionY=0,v.positionZ=_-1,v.rotationX=270,v.rotationY=180,v.rotationZ=0,v.width=2,v.height=1,v.value=`${G[_-1]?G[_-1].fString:_-1}`,v.color=b.getAxisColor("z"),A.normalYAxis.attributes[H]=d.axisTemplate(v),B.updateElement(H,z,"normalYAxis","a-entity"),v.id=4500+H,v.positionX=F+.5,v.rotationY=360,v.value=`${G[_-1]?G[_-1].fString:_-1}`,A.reversedYAxis.attributes[H]=d.axisTemplate(v),B.updateElement(H,z,"reversedYAxis","a-entity"),H++;B.deleteUnnecessaryElements(H,["normalYAxis","reversedYAxis"]),H=1;for(let _=n;_<=F;_++)v.id=1500+H,v.positionX=_-1,v.positionY=0,v.positionZ=u-2.5,v.rotationX=270,v.rotationY=270,v.rotationZ=0,v.width=2,v.height=1,v.value=`${Z[_-1]?Z[_-1].fString:_-1}`,v.color=b.getAxisColor("x"),A.normalXAxis.attributes[H]=d.axisTemplate(v),B.updateElement(H,z,"normalXAxis","a-entity"),v.id=4500+H,v.positionZ=x+.5,v.rotationX=270,v.rotationY=90,v.value=`${Z[_-1]?Z[_-1].fString:_-1}`,A.reversedXAxis.attributes[H]=d.axisTemplate(v),B.updateElement(H,z,"reversedXAxis","a-entity"),H++;B.deleteUnnecessaryElements(H,["normalXAxis","reversedXAxis"]),v.positionX=n,v.positionY=0,v.positionZ=u-4,v.rotationX=270,v.rotationY=180,v.rotationZ=0,v.width=4,v.height=1,v.value=U,v.id="downLabel",A.labels.attributes[0]=d.labelTemplate(v),B.updateElement(0,z,"labels","a-entity"),v.positionX=F-2.5,v.positionZ=x+2,v.rotationY=0,v.id="upLabel",A.labels.attributes[1]=d.labelTemplate(v),B.updateElement(1,z,"labels","a-entity"),v.positionX=n-4,v.positionY=0,v.positionZ=u+.5,v.rotationX=270,v.rotationY=270,v.rotationZ=0,v.width=4,v.height=1,v.value=I,v.color=b.getAxisColor("z"),v.id="leftLabel",A.labels.attributes[2]=d.labelTemplate(v),B.updateElement(2,z,"labels","a-entity"),v.positionX=F+2,v.positionZ=x-2.5,v.rotationX=270,v.rotationY=90,v.id="rightLabel",A.labels.attributes[3]=d.labelTemplate(v),B.updateElement(3,z,"labels","a-entity"),v.positionX=n-90,v.positionY=-6.5,v.positionZ=u+90,v.rotationX=0,v.rotationY=123,v.rotationZ=0,v.title=t.fTitle,v.color=b.getPrimaryFontColor();const R={};R.positionX=0,R.positionY=0,R.positionZ=-1,R.width=170,R.height=30,R.color="white",A.titles.attributes[0]=d.titleTemplate(v,R),B.updateElement(0,z,"titles","a-entity"),v.positionX=n+120,v.positionZ=u-70,v.rotationY=330,v.title=t.fName,A.titles.attributes[1]=d.titleTemplate(v,R),B.updateElement(1,z,"titles","a-entity")}const rf=(e,A)=>e<=0?0:(A>1&&(e=Math.round((e/A+Number.EPSILON)*100)/100),e);class ff{constructor(A){K(this,$e,void 0);S(this,$e,A)}createTH2DemoHistogram(A,t,n,u){const r=Ht.createHistogram("TH2I",A,t);let f=n;for(let d=1;d<=20;d++)for(let B=1;B<=20;B++){const b=r.getBin(B,d);let v=0;v=f,r.setBinContent(b,v),f+=u}return r.fXaxis.fTitle="x Axis",r.fYaxis.fTitle="y Axis",r.fName="You don't have a valid file path",r.fTitle="This is a TH2 histogram demo",r.fMaximum=f,r}createTH3DemoHistogram(A,t,n,u,r){const f=Ht.createHistogram("TH3I",A,t,n);let d=u;for(let B=1;B<=20;B++)for(let b=1;b<=20;b++)for(let v=1;v<=20;v++){const z=f.getBin(v,b,B);let w=0;w=d,f.setBinContent(z,w),d+=r}return f.fXaxis.fTitle="x Axis",f.fYaxis.fTitle="y Axis",f.fZaxis.fTitle="z Axis",f.fName="You don't have a valid file path",f.fTitle="This is a TH3 histogram demo",f.fMaximum=d,f}}$e=new WeakMap;const gf=XA.registerComponent("th2-histogram",{schema:{section:{type:"string"},filename:{type:"string"},theme:{type:"string",default:"def"},position:{name:"position",xValue:0,yValue:.1,zValue:0},scale:{name:"scale",xValue:2,yValue:2,zValue:2},rotation:{name:"rotation",xValue:0,yValue:0,zValue:0}},init:function(){const e=this.el;jn(this.schema,e),document.addEventListener("keydown",Fe),document.addEventListener("keyup",Ie),this.demoHistogramService=new ff,this.localStorageService=new n3,this.cameraService=new pt,this.render=!1,this.histogram=null,this.model={bins:{elements:[],attributes:[]},labels:{elements:[],attributes:[]},titles:{elements:[],attributes:[]},banners:{elements:[],attributes:[]},normalXAxis:{elements:[],attributes:[]},reversedXAxis:{elements:[],attributes:[]},normalYAxis:{elements:[],attributes:[]},reversedYAxis:{elements:[],attributes:[]}},this.section=null;const A=n=>{console.log(n),this.section.xOffset=n.xOffset,this.section.yOffset=n.yOffset,this.range=n.range,this.cameraService.setCameraPosition(n),V3(this.el,this.model,this.histogram,this.section.xOffset,this.section.yOffset,this.section.range,this.data.theme),this.render=!0},t=n=>{this.localStorageService.storeTH2Offsets(n.xOffset,n.yOffset,n.range),A(n)};this.subscription=LA.getChangedSection().subscribe(t)},update:function(){Yn(),this.section=JSON.parse(this.data.section),Ht.openFile(this.data.filename).then(e=>e.readObject("hUsersVsProjects")).then(e=>{this.localStorageService.initHistogramData(e),this.histogram=e,V3(this.el,this.model,this.histogram,this.section.xOffset,this.section.yOffset,this.section.range,this.data.theme),this.render=!0}).then(()=>console.log("drawing completed")).catch(e=>{this.histogram=this.demoHistogramService.createTH2DemoHistogram(20,20,0,.1),this.localStorageService.initHistogramData(this.histogram),V3(this.el,this.model,this.histogram,this.section.xOffset,this.section.yOffset,this.section.range,this.data.theme),this.render=!0,console.log(e)})},tick:function(){this.render&&(this.render=!1)},remove:function(){this.subscription.unsubscribe(),document.removeEventListener("keydown",Fe),document.removeEventListener("keyup",Ie)}}),cf=XA.registerComponent("banner-control",{schema:{position:{name:"position",xValue:-1.28,yValue:.3,zValue:-1},scale:{name:"scale",xValue:.5,yValue:.7,zValue:.1},rotation:{name:"rotation",xValue:0,yValue:20,zValue:0}},init:function(){}});new pt;const df=e=>{e.detail.y>.95&&(LA.changeHistogramSectionByOffset("yOffset","TH2",!1,!1),EA.changeHistogramSectionByOffset("yOffset","TH3",!1,!1)),e.detail.y<-.95&&(LA.changeHistogramSectionByOffset("yOffset","TH2",!0,!1),EA.changeHistogramSectionByOffset("yOffset","TH3",!0,!1)),e.detail.x<-.95&&(gt.changeHistogramSectionByOffset("xOffset","TH1",!0,!1),LA.changeHistogramSectionByOffset("xOffset","TH2",!0,!1),EA.changeHistogramSectionByOffset("xOffset","TH3",!0,!1)),e.detail.x>.95&&(gt.changeHistogramSectionByOffset("xOffset","TH1",!1,!1),LA.changeHistogramSectionByOffset("xOffset","TH2",!1,!1),EA.changeHistogramSectionByOffset("xOffset","TH3",!1,!1))},vf=e=>{e.detail.y>.95&&(LA.changeHistogramSectionByOffset("yOffset","TH2",!1,!0),EA.changeHistogramSectionByOffset("yOffset","TH3",!1,!0)),e.detail.y<-.95&&(LA.changeHistogramSectionByOffset("yOffset","TH2",!0,!0),EA.changeHistogramSectionByOffset("yOffset","TH3",!0,!0)),e.detail.x<-.95&&(gt.changeHistogramSectionByOffset("xOffset","TH1",!0,!0),LA.changeHistogramSectionByOffset("xOffset","TH2",!0,!0),EA.changeHistogramSectionByOffset("xOffset","TH3",!0,!0)),e.detail.x>.95&&(gt.changeHistogramSectionByOffset("xOffset","TH1",!1,!0),LA.changeHistogramSectionByOffset("xOffset","TH2",!1,!0),EA.changeHistogramSectionByOffset("xOffset","TH3",!1,!0))},Bf=e=>{e.detail.y>.1&&wA.next({scale:-.1}),e.detail.y<-.1&&wA.next({scale:.1})},sf=e=>{e.detail.y>.1?wA.next({source:"next"}):e.detail.y<-.1&&wA.next({source:"prev"})},bf=e=>{e.detail.y>.1?wA.next({theme:"next"}):e.detail.y<-.1&&wA.next({theme:"prev"})},zf=e=>{e.detail.y>.1?wA.next({range:"next"}):e.detail.y<-.1&&wA.next({range:"prev"})},af=e=>{e.detail.y>.1?wA.next({scene:"next"}):e.detail.y<-.1&&wA.next({scene:"prev"})},t7=e=>{e==="Y"?wA.next({tool:"next"}):wA.next({tool:"prev"})},e7=e=>{EA.changeHistogramSectionByOffset("zOffset","TH3",!0,e)},n7=e=>{EA.changeHistogramSectionByOffset("zOffset","TH3",!1,e)},u7=()=>{new pt},Cf=e=>{df(e)},of=e=>{vf(e)},Xf=()=>{Le.saveSelectedBinToLocalStorage(),Yt()===0&&wA.next({binData:Le})},Qf=()=>{Le.deleteBinFromLocalStorage()},Of=()=>{LA.changeHistogramFunction("feet","TH2")},wf=()=>{LA.changeHistogramFunction("default","TH2")},lf=()=>{Zt.setVisibilityOfBanners("oculus")},Df=()=>{Zt.setUserState()},Pf=()=>{Zt.shiftBanners()},pf=e=>{e.forEach(A=>{})},xf=XA.registerComponent("left-controller-logging",{init:function(){let e=!1,A=!0,t=!1;const n=this.el;n.addEventListener("gripdown",()=>{e=!0}),n.addEventListener("gripup",()=>{e=!1}),n.addEventListener("thumbstickdown",()=>{}),n.addEventListener("thumbstickmoved",u=>{if(e&&Yt()===2)Bf(u);else if(e&&Yt()===3){if(A){A=!1,sf(u);const r=setTimeout(()=>{A=!0},450);return()=>clearTimeout(r)}}else if(e&&Yt()===4){if(A){A=!1,bf(u);const r=setTimeout(()=>{A=!0},450);return()=>clearTimeout(r)}}else if(e&&Yt()===5){if(A){A=!1,zf(u);const r=setTimeout(()=>{A=!0},450);return()=>clearTimeout(r)}}else if(e&&Yt()===6&&A){A=!1,af(u);const r=setTimeout(()=>{A=!0},600);return()=>clearTimeout(r)}}),n.addEventListener("ybuttondown",()=>{e?t||(t=!0,t7("Y")):lf()}),n.addEventListener("xbuttondown",()=>{e?t||(t=!0,t7("X")):Df()}),n.addEventListener("ybuttonup",()=>{t=!1}),n.addEventListener("xbuttonup",()=>{t=!1})},update:function(){u7()}}),Nf=XA.registerComponent("right-controller-logging",{init:function(){let e=!1;const A=this.el;A.addEventListener("gripdown",()=>{e=!0}),A.addEventListener("gripup",()=>{e=!1}),A.addEventListener("thumbstickmoved",t=>{e?Cf(t):of(t)}),A.addEventListener("bbuttondown",()=>{e7(!e)}),A.addEventListener("abuttondown",()=>{n7(!e)}),A.addEventListener("thumbstickdown",()=>{e?Of():wf()}),A.addEventListener("triggerdown",()=>{e?(Xf(),pf()):(Qf(),Pf())})},update:function(){u7()}});class Wf{constructor(){K(this,Be,void 0);S(this,Be,new bt)}sendSourceSubject(A){g(this,Be).next(A)}getSourceSettingSubject(){return g(this,Be).asObservable()}}Be=new WeakMap;const mf=new Wf,Vf=XA.registerComponent("oculus-thumbstick-movement-controller",{schema:{acceleration:{type:"number",default:40},fly:{type:"boolean",default:!1},horizontalAxis:{type:"string",enum:["x","y","z"],default:"x"},verticalAxis:{type:"string",enum:["x","y","z"],default:"z"},enabled:{type:"boolean",default:!0},adEnabled:{type:"boolean",default:!0},adInverted:{type:"boolean",default:!1},wsEnabled:{type:"boolean",default:!0},wsInverted:{type:"boolean",default:!1}},required:["acceleration","fly","horizontalAxis","verticalAxis","enabled","adEnabled","adInverted","wsEnabled","wsInverted"],init:function(){this.velocity=new THREE.Vector3(0,0,0),this.tsData=new THREE.Vector2(0,0),this.moveEasing=1.1,this.thumbstickMoved=this.thumbstickMoved.bind(this);const e=this.el;let A=!1,t=!1;e.addEventListener("gripdown",()=>{A=!0}),e.addEventListener("gripup",()=>{A=!1});let n=0;const u=200;e.addEventListener("triggerdown",()=>{const r=performance.now();if(r-n<=u&&r-n>=30){let f=2,B=setInterval((()=>{let b=this.sceneElement.getAttribute("position");if(b.y<=f)return;let v={x:b.x,y:b.y-1,z:b.z};this.sceneElement.setAttribute("position",v),v.y<=f&&clearInterval(B)}).bind(this),20)}else t=!0;n=r}),e.addEventListener("triggerup",()=>{n=performance.now(),t=!1}),e.addEventListener("thumbstickmoved",r=>{A&&Yt()>1?this.tsData.set(0,0):(t?this.data.fly=!0:this.data.fly=!1,this.thumbstickMoved(r))})},update:function(){this.sceneElement=document.getElementById("cameraRig")},tick:function(e,A){var t=this.data,n=this.velocity;!n[t.horizontalAxis]&&!n[t.verticalAxis]&&!this.tsData.length()||(A=A/1e3,this.updateVelocity(A),!(!n[t.horizontalAxis]&&!n[t.verticalAxis])&&this.sceneElement.object3D.position.add(this.getMovementVector(A)))},updateVelocity:function(e){var A,t,n,u=this.data,r=this.velocity,f,d;const B=1e-5;if(t=u.horizontalAxis,n=u.verticalAxis,e>.2){r[t]=0,r[n]=0;return}var b=Math.pow(1/this.moveEasing,e*60);r[t]!==0&&(r[t]=r[t]*b),r[n]!==0&&(r[n]=r[n]*b),Math.abs(r[t])<B&&(r[t]=0),Math.abs(r[n])<B&&(r[n]=0),u.enabled&&(A=u.acceleration,u.adEnabled&&this.tsData.x&&(d=u.adInverted?-1:1,r[t]+=d*A*this.tsData.x*e),u.wsEnabled&&(f=u.wsInverted?-1:1,r[n]+=f*A*this.tsData.y*e))},getMovementVector:function(){var e=new THREE.Vector3(0,0,0),A=new THREE.Euler(0,0,0,"YXZ");return function(t){var n=this.el.sceneEl.camera.el.object3D.rotation,u=this.velocity,r;return e.copy(u),e.multiplyScalar(t),n&&(r=this.data.fly?n.x:0,A.set(r,n.y,0),e.applyEuler(A)),e}}(),thumbstickMoved:function(e){this.tsData.set(e.detail.x,e.detail.y)},remove:function(){this.el.removeEventListener("thumbstickmoved",this.thumbstickMoved)}}),Tf=new n3;gA.Banner=cf,gA.HistogramTH2=gf,gA.LeftController=xf,gA.NdmVr=tf,gA.NdmVrScene=Kn,gA.RegisterVerticalMoveComponent=$n,gA.RightController=Nf,gA.TabletContext=Nt,gA.ThumbsticController=Vf,gA.defaultScheme=Ue,gA.ndmVrStorage=Tf,gA.registerScreenControlsComponent=_n,gA.registerVRModeDetector=Rn,gA.sourceSettingSubject=mf,Object.defineProperty(gA,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndmspc/ndmvr",
3
- "version": "0.20240402.0",
3
+ "version": "0.20240411.0",
4
4
  "description": "React components ndmspc core",
5
5
  "author": "Martin Vala",
6
6
  "repository": "https://gitlab.com/ndmspc/ndmvr.git",