aptechka 0.64.4 → 0.64.6
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/lib/en3/index.cjs +2 -2
- package/lib/en3/index.js +60 -57
- package/lib/window-resizer/index.cjs +1 -1
- package/lib/window-resizer/index.d.ts +1 -1
- package/lib/window-resizer/index.js +11 -11
- package/package.json +1 -1
package/lib/en3/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";var de=Object.defineProperty,ue=Object.defineProperties;var me=Object.getOwnPropertyDescriptors;var Z=Object.getOwnPropertySymbols;var fe=Object.prototype.hasOwnProperty,ge=Object.prototype.propertyIsEnumerable;var Q=r=>{throw TypeError(r)};var J=(r,e,i)=>e in r?de(r,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):r[e]=i,k=(r,e)=>{for(var i in e||(e={}))fe.call(e,i)&&J(r,i,e[i]);if(Z)for(var i of Z(e))ge.call(e,i)&&J(r,i,e[i]);return r},ee=(r,e)=>ue(r,me(e));var te=(r,e,i)=>e.has(r)||Q("Cannot "+i);var t=(r,e,i)=>(te(r,e,"read from private field"),i?i.call(r):e.get(r)),s=(r,e,i)=>e.has(r)?Q("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,i),a=(r,e,i,n)=>(te(r,e,"write to private field"),n?n.call(r,i):e.set(r,i),i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("three"),ie=require("../order/index.cjs"),re=require("../window-resizer/index.cjs"),se=require("../ticker/index.cjs"),ne=require("../dom-JBOkFLTh.cjs");require("construct-style-sheets-polyfill");require("../index-DekP7OZe.cjs");const ae=require("../layout-box/index.cjs");function he(r){const e=i=>{i.dispose();for(const n of Object.keys(i)){const h=i[n];h&&typeof h=="object"&&"minFilter"in h&&h.dispose()}};r.traverse(i=>{if(i instanceof u.Mesh){if(i.geometry.dispose(),!Array.isArray(i.material)&&i.material.isMaterial)e(i.material);else if(Array.isArray(i.material))for(const n of i.material)e(n)}})}var P,o,C,v,w,O,D,R;class X{constructor(e,i){s(this,P);s(this,o);s(this,C);s(this,v);s(this,w);s(this,O);s(this,D);s(this,R);a(this,P,e),a(this,o,(i==null?void 0:i.cameraType)==="orthographic"?new u.OrthographicCamera:new u.PerspectiveCamera),a(this,C,new u.Scene),a(this,v,[]),a(this,w,(i==null?void 0:i.cameraDistance)||1e3),t(this,o).near=(i==null?void 0:i.cameraNear)||1,t(this,o).far=(i==null?void 0:i.cameraFar)||11e3,a(this,O,(i==null?void 0:i.cameraFov)||"auto"),t(this,o).position.z=t(this,w),t(this,o).name=`Cameras.${t(this,P)}`,a(this,D,ne.getElement(i==null?void 0:i.sizeElement)||document.documentElement),this.beforeRenderCallback=i==null?void 0:i.beforeRender,a(this,R,new ae.LayoutBox(t(this,D))),t(this,R).onResize(()=>{this.resize()})}get name(){return t(this,P)}get camera(){return t(this,o)}get scene(){return t(this,C)}get box(){return t(this,R)}get cameraDistance(){return t(this,w)}set cameraDistance(e){a(this,w,e),this.resize()}get sizeElement(){return t(this,D)}get isClipped(){return t(this,D)!==d.containerElement}resize(){const{width:e,height:i}=t(this,R);t(this,o).userData.controlled||(t(this,o).position.z=t(this,w)),t(this,o)instanceof u.PerspectiveCamera?(t(this,o).aspect=e/i,t(this,o).fov=t(this,O)==="auto"?2*Math.atan(i/2/t(this,w))*(180/Math.PI):t(this,o).userData.controlled?t(this,o).fov:t(this,O)):t(this,o)instanceof u.OrthographicCamera&&(t(this,o).left=e/-2,t(this,o).right=e/2,t(this,o).top=i/2,t(this,o).bottom=i/-2),t(this,o).updateProjectionMatrix()}destroy(){t(this,v).forEach(e=>{e.userData.box.destroy()}),t(this,C).clear(),he(t(this,C)),d.destroyView(this.name),t(this,R).destroy()}attachToHTMLElement(e,i,n){const h=new ae.LayoutBox(e,ee(k({},n),{containerElement:t(this,D),cartesian:!0,scrollStep:!this.isClipped}));return h.bindObject(i),i.userData.box=h,t(this,v).push(i),i}detachFromHTMLElement(e){a(this,v,t(this,v).filter(i=>i===e?(e.userData.box.destroy(),!1):!0))}add(...e){const i=e[0],n=e[1],h=e[2];return n&&this.attachToHTMLElement(n,i,h),this.scene.add(i),i}remove(e,i){this.scene.remove(e),i&&this.detachFromHTMLElement(e)}}P=new WeakMap,o=new WeakMap,C=new WeakMap,v=new WeakMap,w=new WeakMap,O=new WeakMap,D=new WeakMap,R=new WeakMap;var A,q,F,z,I;class xe{constructor(e){s(this,A);s(this,q);s(this,F);s(this,z);s(this,I);a(this,A,e.targetName||void 0),a(this,q,e.eventDispatcher||e.object3D),a(this,F,e.propagation||!1),a(this,z,e.object3D),a(this,I,t(this,A)?()=>t(this,z).getObjectByName(t(this,A))||t(this,z):()=>t(this,z))}get object3D(){return t(this,z)}get eventDispatcher(){return t(this,q)}get propagation(){return t(this,F)}get target(){return t(this,I).call(this)}dispatch(e,i){this.eventDispatcher.dispatchEvent(k({originalEvent:i,type:e},this.intersection))}}A=new WeakMap,q=new WeakMap,F=new WeakMap,z=new WeakMap,I=new WeakMap;var
|
|
1
|
+
"use strict";var de=Object.defineProperty,ue=Object.defineProperties;var me=Object.getOwnPropertyDescriptors;var Z=Object.getOwnPropertySymbols;var fe=Object.prototype.hasOwnProperty,ge=Object.prototype.propertyIsEnumerable;var Q=r=>{throw TypeError(r)};var J=(r,e,i)=>e in r?de(r,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):r[e]=i,k=(r,e)=>{for(var i in e||(e={}))fe.call(e,i)&&J(r,i,e[i]);if(Z)for(var i of Z(e))ge.call(e,i)&&J(r,i,e[i]);return r},ee=(r,e)=>ue(r,me(e));var te=(r,e,i)=>e.has(r)||Q("Cannot "+i);var t=(r,e,i)=>(te(r,e,"read from private field"),i?i.call(r):e.get(r)),s=(r,e,i)=>e.has(r)?Q("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,i),a=(r,e,i,n)=>(te(r,e,"write to private field"),n?n.call(r,i):e.set(r,i),i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("three"),ie=require("../order/index.cjs"),re=require("../window-resizer/index.cjs"),se=require("../ticker/index.cjs"),ne=require("../dom-JBOkFLTh.cjs");require("construct-style-sheets-polyfill");require("../index-DekP7OZe.cjs");const ae=require("../layout-box/index.cjs");function he(r){const e=i=>{i.dispose();for(const n of Object.keys(i)){const h=i[n];h&&typeof h=="object"&&"minFilter"in h&&h.dispose()}};r.traverse(i=>{if(i instanceof u.Mesh){if(i.geometry.dispose(),!Array.isArray(i.material)&&i.material.isMaterial)e(i.material);else if(Array.isArray(i.material))for(const n of i.material)e(n)}})}var P,o,C,v,w,O,D,R;class X{constructor(e,i){s(this,P);s(this,o);s(this,C);s(this,v);s(this,w);s(this,O);s(this,D);s(this,R);a(this,P,e),a(this,o,(i==null?void 0:i.cameraType)==="orthographic"?new u.OrthographicCamera:new u.PerspectiveCamera),a(this,C,new u.Scene),a(this,v,[]),a(this,w,(i==null?void 0:i.cameraDistance)||1e3),t(this,o).near=(i==null?void 0:i.cameraNear)||1,t(this,o).far=(i==null?void 0:i.cameraFar)||11e3,a(this,O,(i==null?void 0:i.cameraFov)||"auto"),t(this,o).position.z=t(this,w),t(this,o).name=`Cameras.${t(this,P)}`,a(this,D,ne.getElement(i==null?void 0:i.sizeElement)||document.documentElement),this.beforeRenderCallback=i==null?void 0:i.beforeRender,a(this,R,new ae.LayoutBox(t(this,D))),t(this,R).onResize(()=>{this.resize()})}get name(){return t(this,P)}get camera(){return t(this,o)}get scene(){return t(this,C)}get box(){return t(this,R)}get cameraDistance(){return t(this,w)}set cameraDistance(e){a(this,w,e),this.resize()}get sizeElement(){return t(this,D)}get isClipped(){return t(this,D)!==d.containerElement}resize(){const{width:e,height:i}=t(this,R);t(this,o).userData.controlled||(t(this,o).position.z=t(this,w)),t(this,o)instanceof u.PerspectiveCamera?(t(this,o).aspect=e/i,t(this,o).fov=t(this,O)==="auto"?2*Math.atan(i/2/t(this,w))*(180/Math.PI):t(this,o).userData.controlled?t(this,o).fov:t(this,O)):t(this,o)instanceof u.OrthographicCamera&&(t(this,o).left=e/-2,t(this,o).right=e/2,t(this,o).top=i/2,t(this,o).bottom=i/-2),t(this,o).updateProjectionMatrix()}destroy(){t(this,v).forEach(e=>{e.userData.box.destroy()}),t(this,C).clear(),he(t(this,C)),d.destroyView(this.name),t(this,R).destroy()}attachToHTMLElement(e,i,n){const h=new ae.LayoutBox(e,ee(k({},n),{containerElement:t(this,D),cartesian:!0,scrollStep:!this.isClipped}));return h.bindObject(i),i.userData.box=h,t(this,v).push(i),i}detachFromHTMLElement(e){a(this,v,t(this,v).filter(i=>i===e?(e.userData.box.destroy(),!1):!0))}add(...e){const i=e[0],n=e[1],h=e[2];return n&&this.attachToHTMLElement(n,i,h),this.scene.add(i),i}remove(e,i){this.scene.remove(e),i&&this.detachFromHTMLElement(e)}}P=new WeakMap,o=new WeakMap,C=new WeakMap,v=new WeakMap,w=new WeakMap,O=new WeakMap,D=new WeakMap,R=new WeakMap;var A,q,F,z,I;class xe{constructor(e){s(this,A);s(this,q);s(this,F);s(this,z);s(this,I);a(this,A,e.targetName||void 0),a(this,q,e.eventDispatcher||e.object3D),a(this,F,e.propagation||!1),a(this,z,e.object3D),a(this,I,t(this,A)?()=>t(this,z).getObjectByName(t(this,A))||t(this,z):()=>t(this,z))}get object3D(){return t(this,z)}get eventDispatcher(){return t(this,q)}get propagation(){return t(this,F)}get target(){return t(this,I).call(this)}dispatch(e,i){this.eventDispatcher.dispatchEvent(k({originalEvent:i,type:e},this.intersection))}}A=new WeakMap,q=new WeakMap,F=new WeakMap,z=new WeakMap,I=new WeakMap;var b,m,H,N,_,B,$;class ye{constructor(){s(this,b,[]);s(this,m,[]);s(this,H,new u.Vector2);s(this,N,new u.Raycaster);s(this,_,e=>{for(let i=0;i<t(this,m).length;i++)t(this,m)[i].dispatch("pointerDown",e)});s(this,B,e=>{for(let i=0;i<t(this,m).length;i++)t(this,m)[i].dispatch("pointerUp",e)});s(this,$,e=>{if(!t(this,b).length)return;t(this,H).x=e.clientX/d.width*2-1,t(this,H).y=-(e.clientY/d.height)*2+1,d.camera&&t(this,N).setFromCamera(t(this,H),d.camera);const i=[];for(const c of t(this,b)){const g=t(this,N).intersectObject(c.target);g.length&&(c.intersection=g[0],i.push(c))}let n=!1;const h=t(this,m).filter(c=>!i.find(g=>g.object3D.uuid===c.object3D.uuid)),E=i.sort((c,g)=>g.object3D.position.z-c.object3D.position.z).filter((c,g)=>n?(h.push(c),!1):(n=!c.propagation,!0)),p=E.filter(c=>!t(this,m).find(g=>g.object3D.uuid===c.object3D.uuid));for(let c=0;c<h.length;c++)h[c].dispatch("pointerLeave",e);for(let c=0;c<p.length;c++)p[c].dispatch("pointerEnter",e);a(this,m,E);for(let c=0;c<t(this,m).length;c++)t(this,m)[c].dispatch("pointerMove",e)});d.containerElement.addEventListener("pointerdown",t(this,_)),d.containerElement.addEventListener("pointerup",t(this,B)),d.containerElement.addEventListener("pointermove",t(this,$))}destroy(){d.containerElement.removeEventListener("pointerdown",t(this,_)),d.containerElement.removeEventListener("pointerup",t(this,B)),d.containerElement.removeEventListener("pointermove",t(this,$)),a(this,b,[]),a(this,m,[])}add(e,i){if(t(this,b).find(h=>h.object3D.uuid===e.uuid))return;const n=new xe(k({object3D:e},i));t(this,b).push(n)}remove(e){a(this,b,t(this,b).filter(i=>i.object3D.uuid!==e.uuid)),a(this,m,t(this,m).filter(i=>i.object3D.uuid!==e.uuid))}}b=new WeakMap,m=new WeakMap,H=new WeakMap,N=new WeakMap,_=new WeakMap,B=new WeakMap,$=new WeakMap;var U,x,l,j,f,M,T,L,W,S,y,Y,G;class Ee{constructor(){s(this,U,`https://unpkg.com/three@0.${u.REVISION}.x`);s(this,x,null);s(this,l,null);s(this,j,null);s(this,f,new Map);s(this,M,0);s(this,T,0);s(this,L,0);s(this,W,2);s(this,S,!1);s(this,y,null);s(this,Y,()=>{a(this,M,t(this,x).clientWidth),a(this,T,t(this,x).clientHeight),a(this,L,Math.min(t(this,W),devicePixelRatio||1)),t(this,l).setPixelRatio(t(this,L)),t(this,l).setSize(t(this,M),t(this,T)),t(this,y)&&(t(this,y).setPixelRatio(t(this,L)),t(this,y).setSize(t(this,M),t(this,T)))});s(this,G,()=>{t(this,l).setRenderTarget(null),t(this,f).forEach(e=>{this.render(e)})})}get CDNVersion(){return t(this,U)}get containerElement(){return t(this,x)}get webglRenderer(){return t(this,l)}get raycaster(){return t(this,j)}get views(){return t(this,f)}get view(){return this.getView("default")}get camera(){return this.getView("default").camera}get scene(){return this.getView("default").scene}get width(){return t(this,M)}get height(){return t(this,T)}get pixelRatio(){return t(this,L)}get composer(){return t(this,y)}setup(e){if(t(this,S)){console.warn("[en3.setup]: You are trying to setup en3 again.");return}a(this,x,ne.getElement(e==null?void 0:e.containerElement)||document.body),a(this,W,(e==null?void 0:e.maxPixelRatio)||2),a(this,l,new u.WebGLRenderer(e==null?void 0:e.webGLRendererParameters)),t(this,l).domElement.style.cssText=`
|
|
2
2
|
position: ${(e==null?void 0:e.position)||"fixed"};
|
|
3
3
|
left: 0;
|
|
4
4
|
top: 0;
|
|
5
5
|
width: 100%;
|
|
6
6
|
height: 100%;
|
|
7
7
|
z-index: ${(e==null?void 0:e.zIndex)||0};
|
|
8
|
-
`,(t(this,
|
|
8
|
+
`,(t(this,x).shadowRoot||t(this,x)).append(t(this,l).domElement),t(this,f).set("default",new X("default",k({sizeElement:t(this,x)},e==null?void 0:e.view))),a(this,j,new ye),e!=null&&e.composer&&(a(this,y,new e.composer(t(this,l))),this.render=()=>{t(this,y).render()}),a(this,S,!0),re.windowResizer.subscribe(t(this,Y),ie.RESIZE_ORDER.CANVAS),se.ticker.subscribe(t(this,G),{order:ie.TICK_ORDER.CANVAS,culling:t(this,x)})}destroy(){var e;if(!t(this,S)){console.warn("[en3.setup]: You are trying to destory en3 but it has not been initialized.");return}re.windowResizer.unsubscribe(t(this,Y)),se.ticker.unsubscribe(t(this,G)),t(this,j).destroy(),t(this,f).forEach(i=>{i.destroy()}),t(this,f).clear(),t(this,l).dispose(),t(this,l).domElement.remove(),a(this,l,null),(e=t(this,y))==null||e.dispose(),a(this,y,null),a(this,S,!1)}createView(e,i){const n=t(this,f).size,h=new X(e,i);return t(this,f).set(e,h),n===1&&t(this,l).setScissorTest(!0),h}getView(e){return t(this,f).get(e)}destroyView(e){const i=t(this,f).get(e);i&&(t(this,f).delete(e),i.destroy(),t(this,f).size<=1&&t(this,l).setScissorTest(!1))}render(e){var i;if(t(this,f).size>1||this.view.isClipped){const n=e.box.left+e.box.CSSTranslation.x+e.box.scrollValue.x,h=d.height-e.box.height-e.box.top+e.box.CSSTranslation.y+e.box.scrollValue.y*-1;t(this,l).setScissor(n,h,e.box.width,e.box.height),t(this,l).setViewport(n,h,e.box.width,e.box.height)}(i=e.beforeRenderCallback)==null||i.call(e),t(this,l).render(e.scene,e.camera)}}U=new WeakMap,x=new WeakMap,l=new WeakMap,j=new WeakMap,f=new WeakMap,M=new WeakMap,T=new WeakMap,L=new WeakMap,W=new WeakMap,S=new WeakMap,y=new WeakMap,Y=new WeakMap,G=new WeakMap;const d=new Ee;function be(r,e,i){const n=e.x,h=e.y,V=i||r.image.width/r.image.height;let E=0,p=0,c=r.offset.x,g=r.offset.y,ce=r.rotation,oe=r.center.x,le=r.center.y;n/h>V?(E=1,p=h/n*V):(p=1,E=n/h/V),r.matrix.setUvTransform(c,g,E,p,ce,oe,le)}const K=new u.Vector3,we=new u.Vector3;function pe(r,e="default"){const i=d.getView(e),{width:n,height:h}=d,V=n/h;r instanceof u.Vector3?K.copy(r):K.set(...r);const E=i.camera.getWorldPosition(we).distanceTo(K);if(i.camera instanceof u.OrthographicCamera)return{width:n/i.camera.zoom,height:h/i.camera.zoom,factor:1,distance:E,aspect:V};{const p=i.camera.fov*Math.PI/180,c=2*Math.tan(p/2)*E,g=c*(n/h);return{width:g,height:c,factor:n/g,distance:E,aspect:V}}}function ve(r,e){r.traverse(i=>{i instanceof u.Mesh&&i.material&&(Array.isArray(i.material)?i.material:[i.material]).forEach(e)})}function De(r,e){r.traverse(i=>{i instanceof u.Mesh&&e(i)})}exports.En3View=X;exports.coverTexture=be;exports.dispose=he;exports.en3=d;exports.getCurrentViewport=pe;exports.traverseMaterials=ve;exports.traverseMeshes=De;
|
package/lib/en3/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
var
|
|
1
|
+
var ue = Object.defineProperty, me = Object.defineProperties;
|
|
2
2
|
var fe = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var J = Object.getOwnPropertySymbols;
|
|
4
4
|
var ge = Object.prototype.hasOwnProperty, Ee = Object.prototype.propertyIsEnumerable;
|
|
5
5
|
var ee = (s) => {
|
|
6
6
|
throw TypeError(s);
|
|
7
7
|
};
|
|
8
|
-
var Q = (s, e, i) => e in s ?
|
|
8
|
+
var Q = (s, e, i) => e in s ? ue(s, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : s[e] = i, j = (s, e) => {
|
|
9
9
|
for (var i in e || (e = {}))
|
|
10
10
|
ge.call(e, i) && Q(s, i, e[i]);
|
|
11
11
|
if (J)
|
|
12
12
|
for (var i of J(e))
|
|
13
13
|
Ee.call(e, i) && Q(s, i, e[i]);
|
|
14
14
|
return s;
|
|
15
|
-
}, te = (s, e) =>
|
|
15
|
+
}, te = (s, e) => me(s, fe(e));
|
|
16
16
|
var ie = (s, e, i) => e.has(s) || ee("Cannot " + i);
|
|
17
17
|
var t = (s, e, i) => (ie(s, e, "read from private field"), i ? i.call(s) : e.get(s)), r = (s, e, i) => e.has(s) ? ee("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(s) : e.set(s, i), h = (s, e, i, a) => (ie(s, e, "write to private field"), a ? a.call(s, i) : e.set(s, i), i);
|
|
18
18
|
import { Mesh as Z, OrthographicCamera as X, PerspectiveCamera as se, Scene as be, Vector2 as ye, Raycaster as xe, REVISION as we, WebGLRenderer as pe, Vector3 as q } from "three";
|
|
@@ -77,7 +77,7 @@ class ne {
|
|
|
77
77
|
return t(this, D);
|
|
78
78
|
}
|
|
79
79
|
get isClipped() {
|
|
80
|
-
return t(this, D) !==
|
|
80
|
+
return t(this, D) !== m.containerElement;
|
|
81
81
|
}
|
|
82
82
|
resize() {
|
|
83
83
|
const { width: e, height: i } = t(this, R);
|
|
@@ -86,7 +86,7 @@ class ne {
|
|
|
86
86
|
destroy() {
|
|
87
87
|
t(this, p).forEach((e) => {
|
|
88
88
|
e.userData.box.destroy();
|
|
89
|
-
}), t(this, V).clear(), ve(t(this, V)),
|
|
89
|
+
}), t(this, V).clear(), ve(t(this, V)), m.destroyView(this.name), t(this, R).destroy();
|
|
90
90
|
}
|
|
91
91
|
attachToHTMLElement(e, i, a) {
|
|
92
92
|
const n = new ae(e, te(j({}, a), {
|
|
@@ -138,10 +138,10 @@ class ze {
|
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
A = new WeakMap(), k = new WeakMap(), F = new WeakMap(), v = new WeakMap(), I = new WeakMap();
|
|
141
|
-
var
|
|
141
|
+
var y, d, H, N, $, W, Y;
|
|
142
142
|
class Ve {
|
|
143
143
|
constructor() {
|
|
144
|
-
r(this,
|
|
144
|
+
r(this, y, []);
|
|
145
145
|
r(this, d, []);
|
|
146
146
|
r(this, H, new ye());
|
|
147
147
|
r(this, N, new xe());
|
|
@@ -154,84 +154,84 @@ class Ve {
|
|
|
154
154
|
t(this, d)[i].dispatch("pointerUp", e);
|
|
155
155
|
});
|
|
156
156
|
r(this, Y, (e) => {
|
|
157
|
-
if (!t(this,
|
|
157
|
+
if (!t(this, y).length)
|
|
158
158
|
return;
|
|
159
|
-
t(this, H).x = e.clientX /
|
|
159
|
+
t(this, H).x = e.clientX / m.width * 2 - 1, t(this, H).y = -(e.clientY / m.height) * 2 + 1, m.camera && t(this, N).setFromCamera(t(this, H), m.camera);
|
|
160
160
|
const i = [];
|
|
161
|
-
for (const c of t(this,
|
|
161
|
+
for (const c of t(this, y)) {
|
|
162
162
|
const f = t(this, N).intersectObject(c.target);
|
|
163
163
|
f.length && (c.intersection = f[0], i.push(c));
|
|
164
164
|
}
|
|
165
165
|
let a = !1;
|
|
166
166
|
const n = t(this, d).filter(
|
|
167
167
|
(c) => !i.find((f) => f.object3D.uuid === c.object3D.uuid)
|
|
168
|
-
),
|
|
168
|
+
), b = i.sort(
|
|
169
169
|
(c, f) => f.object3D.position.z - c.object3D.position.z
|
|
170
|
-
).filter((c, f) => a ? (n.push(c), !1) : (a = !c.propagation, !0)), w =
|
|
170
|
+
).filter((c, f) => a ? (n.push(c), !1) : (a = !c.propagation, !0)), w = b.filter(
|
|
171
171
|
(c) => !t(this, d).find((f) => f.object3D.uuid === c.object3D.uuid)
|
|
172
172
|
);
|
|
173
173
|
for (let c = 0; c < n.length; c++)
|
|
174
174
|
n[c].dispatch("pointerLeave", e);
|
|
175
175
|
for (let c = 0; c < w.length; c++)
|
|
176
176
|
w[c].dispatch("pointerEnter", e);
|
|
177
|
-
h(this, d,
|
|
177
|
+
h(this, d, b);
|
|
178
178
|
for (let c = 0; c < t(this, d).length; c++)
|
|
179
179
|
t(this, d)[c].dispatch("pointerMove", e);
|
|
180
180
|
});
|
|
181
|
-
|
|
181
|
+
m.containerElement.addEventListener(
|
|
182
182
|
"pointerdown",
|
|
183
183
|
t(this, $)
|
|
184
|
-
),
|
|
184
|
+
), m.containerElement.addEventListener("pointerup", t(this, W)), m.containerElement.addEventListener(
|
|
185
185
|
"pointermove",
|
|
186
186
|
t(this, Y)
|
|
187
187
|
);
|
|
188
188
|
}
|
|
189
189
|
destroy() {
|
|
190
|
-
|
|
190
|
+
m.containerElement.removeEventListener(
|
|
191
191
|
"pointerdown",
|
|
192
192
|
t(this, $)
|
|
193
|
-
),
|
|
193
|
+
), m.containerElement.removeEventListener(
|
|
194
194
|
"pointerup",
|
|
195
195
|
t(this, W)
|
|
196
|
-
),
|
|
196
|
+
), m.containerElement.removeEventListener(
|
|
197
197
|
"pointermove",
|
|
198
198
|
t(this, Y)
|
|
199
|
-
), h(this,
|
|
199
|
+
), h(this, y, []), h(this, d, []);
|
|
200
200
|
}
|
|
201
201
|
add(e, i) {
|
|
202
|
-
if (t(this,
|
|
202
|
+
if (t(this, y).find((n) => n.object3D.uuid === e.uuid))
|
|
203
203
|
return;
|
|
204
204
|
const a = new ze(j({
|
|
205
205
|
object3D: e
|
|
206
206
|
}, i));
|
|
207
|
-
t(this,
|
|
207
|
+
t(this, y).push(a);
|
|
208
208
|
}
|
|
209
209
|
remove(e) {
|
|
210
|
-
h(this,
|
|
210
|
+
h(this, y, t(this, y).filter(
|
|
211
211
|
(i) => i.object3D.uuid !== e.uuid
|
|
212
212
|
)), h(this, d, t(this, d).filter((i) => i.object3D.uuid !== e.uuid));
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
|
-
|
|
216
|
-
var U,
|
|
215
|
+
y = new WeakMap(), d = new WeakMap(), H = new WeakMap(), N = new WeakMap(), $ = new WeakMap(), W = new WeakMap(), Y = new WeakMap();
|
|
216
|
+
var U, g, l, O, u, L, T, C, _, M, E, B, G;
|
|
217
217
|
class Le {
|
|
218
218
|
constructor() {
|
|
219
219
|
r(this, U, `https://unpkg.com/three@0.${we}.x`);
|
|
220
|
-
r(this,
|
|
220
|
+
r(this, g, null);
|
|
221
221
|
r(this, l, null);
|
|
222
222
|
r(this, O, null);
|
|
223
|
-
r(this,
|
|
223
|
+
r(this, u, /* @__PURE__ */ new Map());
|
|
224
224
|
r(this, L, 0);
|
|
225
225
|
r(this, T, 0);
|
|
226
226
|
r(this, C, 0);
|
|
227
227
|
r(this, _, 2);
|
|
228
228
|
r(this, M, !1);
|
|
229
|
-
r(this,
|
|
229
|
+
r(this, E, null);
|
|
230
230
|
r(this, B, () => {
|
|
231
|
-
h(this, L, t(this,
|
|
231
|
+
h(this, L, t(this, g).clientWidth), h(this, T, t(this, g).clientHeight), h(this, C, Math.min(t(this, _), devicePixelRatio || 1)), t(this, l).setPixelRatio(t(this, C)), t(this, l).setSize(t(this, L), t(this, T)), t(this, E) && (t(this, E).setPixelRatio(t(this, C)), t(this, E).setSize(t(this, L), t(this, T)));
|
|
232
232
|
});
|
|
233
233
|
r(this, G, () => {
|
|
234
|
-
t(this, l).setRenderTarget(null), t(this,
|
|
234
|
+
t(this, l).setRenderTarget(null), t(this, u).forEach((e) => {
|
|
235
235
|
this.render(e);
|
|
236
236
|
});
|
|
237
237
|
});
|
|
@@ -240,7 +240,7 @@ class Le {
|
|
|
240
240
|
return t(this, U);
|
|
241
241
|
}
|
|
242
242
|
get containerElement() {
|
|
243
|
-
return t(this,
|
|
243
|
+
return t(this, g);
|
|
244
244
|
}
|
|
245
245
|
get webglRenderer() {
|
|
246
246
|
return t(this, l);
|
|
@@ -249,7 +249,7 @@ class Le {
|
|
|
249
249
|
return t(this, O);
|
|
250
250
|
}
|
|
251
251
|
get views() {
|
|
252
|
-
return t(this,
|
|
252
|
+
return t(this, u);
|
|
253
253
|
}
|
|
254
254
|
get view() {
|
|
255
255
|
return this.getView("default");
|
|
@@ -270,28 +270,31 @@ class Le {
|
|
|
270
270
|
return t(this, C);
|
|
271
271
|
}
|
|
272
272
|
get composer() {
|
|
273
|
-
return t(this,
|
|
273
|
+
return t(this, E);
|
|
274
274
|
}
|
|
275
275
|
setup(e) {
|
|
276
276
|
if (t(this, M)) {
|
|
277
277
|
console.warn("[en3.setup]: You are trying to setup en3 again.");
|
|
278
278
|
return;
|
|
279
279
|
}
|
|
280
|
-
h(this,
|
|
280
|
+
h(this, g, ce(e == null ? void 0 : e.containerElement) || document.body), h(this, _, (e == null ? void 0 : e.maxPixelRatio) || 2), h(this, l, new pe(e == null ? void 0 : e.webGLRendererParameters)), t(this, l).domElement.style.cssText = `
|
|
281
281
|
position: ${(e == null ? void 0 : e.position) || "fixed"};
|
|
282
282
|
left: 0;
|
|
283
283
|
top: 0;
|
|
284
284
|
width: 100%;
|
|
285
285
|
height: 100%;
|
|
286
286
|
z-index: ${(e == null ? void 0 : e.zIndex) || 0};
|
|
287
|
-
`, (t(this,
|
|
287
|
+
`, (t(this, g).shadowRoot || t(this, g)).append(t(this, l).domElement), t(this, u).set(
|
|
288
288
|
"default",
|
|
289
289
|
new ne("default", j({
|
|
290
|
-
sizeElement: t(this,
|
|
290
|
+
sizeElement: t(this, g)
|
|
291
291
|
}, e == null ? void 0 : e.view))
|
|
292
|
-
), h(this, O, new Ve()), e != null && e.composer && (h(this,
|
|
293
|
-
t(this,
|
|
294
|
-
}), h(this, M, !0), re.subscribe(t(this, B), De.CANVAS), he.subscribe(t(this, G), {
|
|
292
|
+
), h(this, O, new Ve()), e != null && e.composer && (h(this, E, new e.composer(t(this, l))), this.render = () => {
|
|
293
|
+
t(this, E).render();
|
|
294
|
+
}), h(this, M, !0), re.subscribe(t(this, B), De.CANVAS), he.subscribe(t(this, G), {
|
|
295
|
+
order: Re.CANVAS,
|
|
296
|
+
culling: t(this, g)
|
|
297
|
+
});
|
|
295
298
|
}
|
|
296
299
|
destroy() {
|
|
297
300
|
var e;
|
|
@@ -301,25 +304,25 @@ class Le {
|
|
|
301
304
|
);
|
|
302
305
|
return;
|
|
303
306
|
}
|
|
304
|
-
re.unsubscribe(t(this, B)), he.unsubscribe(t(this, G)), t(this, O).destroy(), t(this,
|
|
307
|
+
re.unsubscribe(t(this, B)), he.unsubscribe(t(this, G)), t(this, O).destroy(), t(this, u).forEach((i) => {
|
|
305
308
|
i.destroy();
|
|
306
|
-
}), t(this,
|
|
309
|
+
}), t(this, u).clear(), t(this, l).dispose(), t(this, l).domElement.remove(), h(this, l, null), (e = t(this, E)) == null || e.dispose(), h(this, E, null), h(this, M, !1);
|
|
307
310
|
}
|
|
308
311
|
createView(e, i) {
|
|
309
|
-
const a = t(this,
|
|
310
|
-
return t(this,
|
|
312
|
+
const a = t(this, u).size, n = new ne(e, i);
|
|
313
|
+
return t(this, u).set(e, n), a === 1 && t(this, l).setScissorTest(!0), n;
|
|
311
314
|
}
|
|
312
315
|
getView(e) {
|
|
313
|
-
return t(this,
|
|
316
|
+
return t(this, u).get(e);
|
|
314
317
|
}
|
|
315
318
|
destroyView(e) {
|
|
316
|
-
const i = t(this,
|
|
317
|
-
i && (t(this,
|
|
319
|
+
const i = t(this, u).get(e);
|
|
320
|
+
i && (t(this, u).delete(e), i.destroy(), t(this, u).size <= 1 && t(this, l).setScissorTest(!1));
|
|
318
321
|
}
|
|
319
322
|
render(e) {
|
|
320
323
|
var i;
|
|
321
|
-
if (t(this,
|
|
322
|
-
const a = e.box.left + e.box.CSSTranslation.x + e.box.scrollValue.x, n =
|
|
324
|
+
if (t(this, u).size > 1 || this.view.isClipped) {
|
|
325
|
+
const a = e.box.left + e.box.CSSTranslation.x + e.box.scrollValue.x, n = m.height - e.box.height - e.box.top + e.box.CSSTranslation.y + e.box.scrollValue.y * -1;
|
|
323
326
|
t(this, l).setScissor(a, n, e.box.width, e.box.height), t(this, l).setViewport(
|
|
324
327
|
a,
|
|
325
328
|
n,
|
|
@@ -330,29 +333,29 @@ class Le {
|
|
|
330
333
|
(i = e.beforeRenderCallback) == null || i.call(e), t(this, l).render(e.scene, e.camera);
|
|
331
334
|
}
|
|
332
335
|
}
|
|
333
|
-
U = new WeakMap(),
|
|
334
|
-
const
|
|
336
|
+
U = new WeakMap(), g = new WeakMap(), l = new WeakMap(), O = new WeakMap(), u = new WeakMap(), L = new WeakMap(), T = new WeakMap(), C = new WeakMap(), _ = new WeakMap(), M = new WeakMap(), E = new WeakMap(), B = new WeakMap(), G = new WeakMap();
|
|
337
|
+
const m = new Le();
|
|
335
338
|
function Fe(s, e, i) {
|
|
336
339
|
const a = e.x, n = e.y, z = i || s.image.width / s.image.height;
|
|
337
|
-
let
|
|
338
|
-
a / n > z ? (
|
|
340
|
+
let b = 0, w = 0, c = s.offset.x, f = s.offset.y, oe = s.rotation, le = s.center.x, de = s.center.y;
|
|
341
|
+
a / n > z ? (b = 1, w = n / a * z) : (w = 1, b = a / n / z), s.matrix.setUvTransform(c, f, b, w, oe, le, de);
|
|
339
342
|
}
|
|
340
343
|
const K = new q(), Te = new q();
|
|
341
344
|
function Ie(s, e = "default") {
|
|
342
|
-
const i =
|
|
345
|
+
const i = m.getView(e), { width: a, height: n } = m, z = a / n;
|
|
343
346
|
s instanceof q ? K.copy(s) : K.set(...s);
|
|
344
|
-
const
|
|
347
|
+
const b = i.camera.getWorldPosition(Te).distanceTo(K);
|
|
345
348
|
if (i.camera instanceof X)
|
|
346
349
|
return {
|
|
347
350
|
width: a / i.camera.zoom,
|
|
348
351
|
height: n / i.camera.zoom,
|
|
349
352
|
factor: 1,
|
|
350
|
-
distance:
|
|
353
|
+
distance: b,
|
|
351
354
|
aspect: z
|
|
352
355
|
};
|
|
353
356
|
{
|
|
354
|
-
const w = i.camera.fov * Math.PI / 180, c = 2 * Math.tan(w / 2) *
|
|
355
|
-
return { width: f, height: c, factor: a / f, distance:
|
|
357
|
+
const w = i.camera.fov * Math.PI / 180, c = 2 * Math.tan(w / 2) * b, f = c * (a / n);
|
|
358
|
+
return { width: f, height: c, factor: a / f, distance: b, aspect: z };
|
|
356
359
|
}
|
|
357
360
|
}
|
|
358
361
|
function Ne(s, e) {
|
|
@@ -369,7 +372,7 @@ export {
|
|
|
369
372
|
ne as En3View,
|
|
370
373
|
Fe as coverTexture,
|
|
371
374
|
ve as dispose,
|
|
372
|
-
|
|
375
|
+
m as en3,
|
|
373
376
|
Ie as getCurrentViewport,
|
|
374
377
|
Ne as traverseMaterials,
|
|
375
378
|
$e as traverseMeshes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var f=
|
|
1
|
+
"use strict";var f=i=>{throw TypeError(i)};var w=(i,s,e)=>s.has(i)||f("Cannot "+e);var t=(i,s,e)=>(w(i,s,"read from private field"),e?e.call(i):s.get(i)),u=(i,s,e)=>s.has(i)?f("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(i):s.set(i,e),c=(i,s,e,o)=>(w(i,s,"write to private field"),o?o.call(i,e):s.set(i,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("../notifier/index.cjs"),l=require("../index-DekP7OZe.cjs"),R=require("../function-MthRj-GJ.cjs");require("construct-style-sheets-polyfill");var r,n,d;class h extends b.Notifier{constructor(){super();u(this,r,!1);u(this,n,e=>{t(this,r)||(c(this,r,!0),t(this,d).call(this,e))});u(this,d,R.debounce(e=>{this.notify(e),c(this,r,!1)},0));l.isBrowser&&(window.addEventListener("resize",t(this,n)),t(this,n).call(this))}subscribe(e,o){const z=super.subscribe(e,o);return t(this,r)||e(),z}}r=new WeakMap,n=new WeakMap,d=new WeakMap;const a=new h;exports.WindowResizer=h;exports.windowResizer=a;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var h = (
|
|
2
|
-
throw TypeError(
|
|
1
|
+
var h = (e) => {
|
|
2
|
+
throw TypeError(e);
|
|
3
3
|
};
|
|
4
|
-
var c = (
|
|
5
|
-
var t = (
|
|
4
|
+
var c = (e, i, s) => i.has(e) || h("Cannot " + s);
|
|
5
|
+
var t = (e, i, s) => (c(e, i, "read from private field"), s ? s.call(e) : i.get(e)), u = (e, i, s) => i.has(e) ? h("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(e) : i.set(e, s), f = (e, i, s, n) => (c(e, i, "write to private field"), n ? n.call(e, s) : i.set(e, s), s);
|
|
6
6
|
import { Notifier as p } from "../notifier/index.js";
|
|
7
7
|
import { i as w } from "../index-Bv9zgfdb.js";
|
|
8
8
|
import { d as z } from "../function-C10DGppn.js";
|
|
@@ -12,17 +12,17 @@ class b extends p {
|
|
|
12
12
|
constructor() {
|
|
13
13
|
super();
|
|
14
14
|
u(this, r, !1);
|
|
15
|
-
u(this, o, () => {
|
|
16
|
-
t(this, r) || (f(this, r, !0), t(this, d).call(this));
|
|
15
|
+
u(this, o, (s) => {
|
|
16
|
+
t(this, r) || (f(this, r, !0), t(this, d).call(this, s));
|
|
17
17
|
});
|
|
18
|
-
u(this, d, z(() => {
|
|
19
|
-
this.notify(), f(this, r, !1);
|
|
18
|
+
u(this, d, z((s) => {
|
|
19
|
+
this.notify(s), f(this, r, !1);
|
|
20
20
|
}, 0));
|
|
21
21
|
w && (window.addEventListener("resize", t(this, o)), t(this, o).call(this));
|
|
22
22
|
}
|
|
23
|
-
subscribe(
|
|
24
|
-
const m = super.subscribe(
|
|
25
|
-
return t(this, r) ||
|
|
23
|
+
subscribe(s, n) {
|
|
24
|
+
const m = super.subscribe(s, n);
|
|
25
|
+
return t(this, r) || s(), m;
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
r = new WeakMap(), o = new WeakMap(), d = new WeakMap();
|