aptechka 0.64.3 → 0.64.4
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 +36 -36
- 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 E,m,H,N,_,B,$;class ye{constructor(){s(this,E,[]);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,E).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,E)){const
|
|
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 E,m,H,N,_,B,$;class ye{constructor(){s(this,E,[]);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,E).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,E)){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)),y=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=y.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,y);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,E,[]),a(this,m,[])}add(e,i){if(t(this,E).find(h=>h.object3D.uuid===e.uuid))return;const n=new xe(k({object3D:e},i));t(this,E).push(n)}remove(e){a(this,E,t(this,E).filter(i=>i.object3D.uuid!==e.uuid)),a(this,m,t(this,m).filter(i=>i.object3D.uuid!==e.uuid))}}E=new WeakMap,m=new WeakMap,H=new WeakMap,N=new WeakMap,_=new WeakMap,B=new WeakMap,$=new WeakMap;var U,b,l,j,f,M,T,L,W,S,x,Y,G;class Ee{constructor(){s(this,U,`https://unpkg.com/three@0.${u.REVISION}.x`);s(this,b,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,x,null);s(this,Y,()=>{a(this,M,t(this,b).clientWidth),a(this,T,t(this,b).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,x)&&(t(this,x).setPixelRatio(t(this,L)),t(this,x).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,b)}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,x)}setup(e){if(t(this,S)){console.warn("[en3.setup]: You are trying to setup en3 again.");return}a(this,b,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,b).shadowRoot||t(this,b)).append(t(this,l).domElement),t(this,
|
|
8
|
+
`,(t(this,b).shadowRoot||t(this,b)).append(t(this,l).domElement),t(this,f).set("default",new X("default",k({sizeElement:t(this,b)},e==null?void 0:e.view))),a(this,j,new ye),e!=null&&e.composer&&(a(this,x,new e.composer(t(this,l))),this.render=()=>{t(this,x).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})}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,x))==null||e.dispose(),a(this,x,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,b=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,x=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 y=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?(y=1,p=h/n*V):(p=1,y=n/h/V),r.matrix.setUvTransform(c,g,y,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 y=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:y,aspect:V};{const p=i.camera.fov*Math.PI/180,c=2*Math.tan(p/2)*y,g=c*(n/h);return{width:g,height:c,factor:n/g,distance:y,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
|
@@ -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) !== u.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)), u.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), {
|
|
@@ -156,19 +156,19 @@ class Ve {
|
|
|
156
156
|
r(this, Y, (e) => {
|
|
157
157
|
if (!t(this, b).length)
|
|
158
158
|
return;
|
|
159
|
-
t(this, H).x = e.clientX /
|
|
159
|
+
t(this, H).x = e.clientX / u.width * 2 - 1, t(this, H).y = -(e.clientY / u.height) * 2 + 1, u.camera && t(this, N).setFromCamera(t(this, H), u.camera);
|
|
160
160
|
const i = [];
|
|
161
161
|
for (const c of t(this, b)) {
|
|
162
|
-
const
|
|
163
|
-
|
|
162
|
+
const f = t(this, N).intersectObject(c.target);
|
|
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
|
-
(c) => !i.find((
|
|
167
|
+
(c) => !i.find((f) => f.object3D.uuid === c.object3D.uuid)
|
|
168
168
|
), E = i.sort(
|
|
169
|
-
(c,
|
|
170
|
-
).filter((c,
|
|
171
|
-
(c) => !t(this, d).find((
|
|
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 = E.filter(
|
|
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);
|
|
@@ -178,22 +178,22 @@ class Ve {
|
|
|
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
|
+
u.containerElement.addEventListener(
|
|
182
182
|
"pointerdown",
|
|
183
183
|
t(this, $)
|
|
184
|
-
),
|
|
184
|
+
), u.containerElement.addEventListener("pointerup", t(this, W)), u.containerElement.addEventListener(
|
|
185
185
|
"pointermove",
|
|
186
186
|
t(this, Y)
|
|
187
187
|
);
|
|
188
188
|
}
|
|
189
189
|
destroy() {
|
|
190
|
-
|
|
190
|
+
u.containerElement.removeEventListener(
|
|
191
191
|
"pointerdown",
|
|
192
192
|
t(this, $)
|
|
193
|
-
),
|
|
193
|
+
), u.containerElement.removeEventListener(
|
|
194
194
|
"pointerup",
|
|
195
195
|
t(this, W)
|
|
196
|
-
),
|
|
196
|
+
), u.containerElement.removeEventListener(
|
|
197
197
|
"pointermove",
|
|
198
198
|
t(this, Y)
|
|
199
199
|
), h(this, b, []), h(this, d, []);
|
|
@@ -213,14 +213,14 @@ class Ve {
|
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
215
|
b = new WeakMap(), d = new WeakMap(), H = new WeakMap(), N = new WeakMap(), $ = new WeakMap(), W = new WeakMap(), Y = new WeakMap();
|
|
216
|
-
var U, y, l, O,
|
|
216
|
+
var U, y, l, O, m, L, T, C, _, M, g, B, G;
|
|
217
217
|
class Le {
|
|
218
218
|
constructor() {
|
|
219
219
|
r(this, U, `https://unpkg.com/three@0.${we}.x`);
|
|
220
220
|
r(this, y, null);
|
|
221
221
|
r(this, l, null);
|
|
222
222
|
r(this, O, null);
|
|
223
|
-
r(this,
|
|
223
|
+
r(this, m, /* @__PURE__ */ new Map());
|
|
224
224
|
r(this, L, 0);
|
|
225
225
|
r(this, T, 0);
|
|
226
226
|
r(this, C, 0);
|
|
@@ -231,7 +231,7 @@ class Le {
|
|
|
231
231
|
h(this, L, t(this, y).clientWidth), h(this, T, t(this, y).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, g) && (t(this, g).setPixelRatio(t(this, C)), t(this, g).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, m).forEach((e) => {
|
|
235
235
|
this.render(e);
|
|
236
236
|
});
|
|
237
237
|
});
|
|
@@ -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, m);
|
|
253
253
|
}
|
|
254
254
|
get view() {
|
|
255
255
|
return this.getView("default");
|
|
@@ -284,7 +284,7 @@ class Le {
|
|
|
284
284
|
width: 100%;
|
|
285
285
|
height: 100%;
|
|
286
286
|
z-index: ${(e == null ? void 0 : e.zIndex) || 0};
|
|
287
|
-
`, (t(this, y).shadowRoot || t(this, y)).append(t(this, l).domElement), t(this,
|
|
287
|
+
`, (t(this, y).shadowRoot || t(this, y)).append(t(this, l).domElement), t(this, m).set(
|
|
288
288
|
"default",
|
|
289
289
|
new ne("default", j({
|
|
290
290
|
sizeElement: t(this, y)
|
|
@@ -301,25 +301,25 @@ class Le {
|
|
|
301
301
|
);
|
|
302
302
|
return;
|
|
303
303
|
}
|
|
304
|
-
re.unsubscribe(t(this, B)), he.unsubscribe(t(this, G)), t(this, O).destroy(), t(this,
|
|
304
|
+
re.unsubscribe(t(this, B)), he.unsubscribe(t(this, G)), t(this, O).destroy(), t(this, m).forEach((i) => {
|
|
305
305
|
i.destroy();
|
|
306
|
-
}), t(this, l).dispose(), t(this, l).domElement.remove(), h(this, l, null), (e = t(this, g)) == null || e.dispose(), h(this, g, null), h(this, M, !1);
|
|
306
|
+
}), t(this, m).clear(), t(this, l).dispose(), t(this, l).domElement.remove(), h(this, l, null), (e = t(this, g)) == null || e.dispose(), h(this, g, null), h(this, M, !1);
|
|
307
307
|
}
|
|
308
308
|
createView(e, i) {
|
|
309
|
-
const a = t(this,
|
|
310
|
-
return t(this,
|
|
309
|
+
const a = t(this, m).size, n = new ne(e, i);
|
|
310
|
+
return t(this, m).set(e, n), a === 1 && t(this, l).setScissorTest(!0), n;
|
|
311
311
|
}
|
|
312
312
|
getView(e) {
|
|
313
|
-
return t(this,
|
|
313
|
+
return t(this, m).get(e);
|
|
314
314
|
}
|
|
315
315
|
destroyView(e) {
|
|
316
|
-
const i = t(this,
|
|
317
|
-
i && (t(this,
|
|
316
|
+
const i = t(this, m).get(e);
|
|
317
|
+
i && (t(this, m).delete(e), i.destroy(), t(this, m).size <= 1 && t(this, l).setScissorTest(!1));
|
|
318
318
|
}
|
|
319
319
|
render(e) {
|
|
320
320
|
var i;
|
|
321
|
-
if (t(this,
|
|
322
|
-
const a = e.box.left + e.box.CSSTranslation.x + e.box.scrollValue.x, n =
|
|
321
|
+
if (t(this, m).size > 1 || this.view.isClipped) {
|
|
322
|
+
const a = e.box.left + e.box.CSSTranslation.x + e.box.scrollValue.x, n = u.height - e.box.height - e.box.top + e.box.CSSTranslation.y + e.box.scrollValue.y * -1;
|
|
323
323
|
t(this, l).setScissor(a, n, e.box.width, e.box.height), t(this, l).setViewport(
|
|
324
324
|
a,
|
|
325
325
|
n,
|
|
@@ -330,16 +330,16 @@ class Le {
|
|
|
330
330
|
(i = e.beforeRenderCallback) == null || i.call(e), t(this, l).render(e.scene, e.camera);
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
|
-
U = new WeakMap(), y = new WeakMap(), l = new WeakMap(), O = new WeakMap(),
|
|
334
|
-
const
|
|
333
|
+
U = new WeakMap(), y = new WeakMap(), l = new WeakMap(), O = new WeakMap(), m = new WeakMap(), L = new WeakMap(), T = new WeakMap(), C = new WeakMap(), _ = new WeakMap(), M = new WeakMap(), g = new WeakMap(), B = new WeakMap(), G = new WeakMap();
|
|
334
|
+
const u = new Le();
|
|
335
335
|
function Fe(s, e, i) {
|
|
336
336
|
const a = e.x, n = e.y, z = i || s.image.width / s.image.height;
|
|
337
|
-
let E = 0, w = 0, c = s.offset.x,
|
|
338
|
-
a / n > z ? (E = 1, w = n / a * z) : (w = 1, E = a / n / z), s.matrix.setUvTransform(c,
|
|
337
|
+
let E = 0, w = 0, c = s.offset.x, f = s.offset.y, oe = s.rotation, le = s.center.x, de = s.center.y;
|
|
338
|
+
a / n > z ? (E = 1, w = n / a * z) : (w = 1, E = a / n / z), s.matrix.setUvTransform(c, f, E, w, oe, le, de);
|
|
339
339
|
}
|
|
340
340
|
const K = new q(), Te = new q();
|
|
341
341
|
function Ie(s, e = "default") {
|
|
342
|
-
const i =
|
|
342
|
+
const i = u.getView(e), { width: a, height: n } = u, z = a / n;
|
|
343
343
|
s instanceof q ? K.copy(s) : K.set(...s);
|
|
344
344
|
const E = i.camera.getWorldPosition(Te).distanceTo(K);
|
|
345
345
|
if (i.camera instanceof X)
|
|
@@ -351,8 +351,8 @@ function Ie(s, e = "default") {
|
|
|
351
351
|
aspect: z
|
|
352
352
|
};
|
|
353
353
|
{
|
|
354
|
-
const w = i.camera.fov * Math.PI / 180, c = 2 * Math.tan(w / 2) * E,
|
|
355
|
-
return { width:
|
|
354
|
+
const w = i.camera.fov * Math.PI / 180, c = 2 * Math.tan(w / 2) * E, f = c * (a / n);
|
|
355
|
+
return { width: f, height: c, factor: a / f, distance: E, aspect: z };
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
358
|
function Ne(s, e) {
|
|
@@ -369,7 +369,7 @@ export {
|
|
|
369
369
|
ne as En3View,
|
|
370
370
|
Fe as coverTexture,
|
|
371
371
|
ve as dispose,
|
|
372
|
-
|
|
372
|
+
u as en3,
|
|
373
373
|
Ie as getCurrentViewport,
|
|
374
374
|
Ne as traverseMaterials,
|
|
375
375
|
$e as traverseMeshes
|