aptechka 0.64.6 → 0.64.7

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 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 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=`
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=s=>{throw TypeError(s)};var J=(s,e,i)=>e in s?de(s,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[e]=i,k=(s,e)=>{for(var i in e||(e={}))fe.call(e,i)&&J(s,i,e[i]);if(Z)for(var i of Z(e))ge.call(e,i)&&J(s,i,e[i]);return s},ee=(s,e)=>ue(s,me(e));var te=(s,e,i)=>e.has(s)||Q("Cannot "+i);var t=(s,e,i)=>(te(s,e,"read from private field"),i?i.call(s):e.get(s)),r=(s,e,i)=>e.has(s)?Q("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(s):e.set(s,i),n=(s,e,i,a)=>(te(s,e,"write to private field"),a?a.call(s,i):e.set(s,i),i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("three"),ie=require("../order/index.cjs"),se=require("../window-resizer/index.cjs"),re=require("../ticker/index.cjs"),ae=require("../dom-JBOkFLTh.cjs");require("construct-style-sheets-polyfill");require("../index-DekP7OZe.cjs");const ne=require("../layout-box/index.cjs");function he(s){const e=i=>{i.dispose();for(const a of Object.keys(i)){const h=i[a];h&&typeof h=="object"&&"minFilter"in h&&h.dispose()}};s.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 a of i.material)e(a)}})}var P,o,C,p,w,O,D,R;class X{constructor(e,i){r(this,P);r(this,o);r(this,C);r(this,p);r(this,w);r(this,O);r(this,D);r(this,R);n(this,P,e),n(this,o,(i==null?void 0:i.cameraType)==="orthographic"?new u.OrthographicCamera:new u.PerspectiveCamera),n(this,C,new u.Scene),n(this,p,[]),n(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,n(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)}`,n(this,D,ae.getElement(i==null?void 0:i.sizeElement)||document.documentElement),this.beforeRenderCallback=i==null?void 0:i.beforeRender,n(this,R,new ne.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){n(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,p).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,a){const h=new ne.LayoutBox(e,ee(k({},a),{containerElement:t(this,D),cartesian:!0,scrollStep:!this.isClipped}));return h.bindObject(i),i.userData.box=h,t(this,p).push(i),i}detachFromHTMLElement(e){n(this,p,t(this,p).filter(i=>i===e?(e.userData.box.destroy(),!1):!0))}add(...e){const i=e[0],a=e[1],h=e[2];return a&&this.attachToHTMLElement(a,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,p=new WeakMap,w=new WeakMap,O=new WeakMap,D=new WeakMap,R=new WeakMap;var A,q,F,z,I;class Ee{constructor(e){r(this,A);r(this,q);r(this,F);r(this,z);r(this,I);n(this,A,e.targetName||void 0),n(this,q,e.eventDispatcher||e.object3D),n(this,F,e.propagation||!1),n(this,z,e.object3D),n(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 xe{constructor(){r(this,b,[]);r(this,m,[]);r(this,H,new u.Vector2);r(this,N,new u.Raycaster);r(this,_,e=>{for(let i=0;i<t(this,m).length;i++)t(this,m)[i].dispatch("pointerDown",e)});r(this,B,e=>{for(let i=0;i<t(this,m).length;i++)t(this,m)[i].dispatch("pointerUp",e)});r(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 a=!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)=>a?(h.push(c),!1):(a=!c.propagation,!0)),v=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<v.length;c++)v[c].dispatch("pointerEnter",e);n(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,$)),n(this,b,[]),n(this,m,[])}add(e,i){if(t(this,b).find(h=>h.object3D.uuid===e.uuid))return;const a=new Ee(k({object3D:e},i));t(this,b).push(a)}remove(e){n(this,b,t(this,b).filter(i=>i.object3D.uuid!==e.uuid)),n(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,E,l,j,f,M,T,L,W,S,x,Y,G;class ye{constructor(){r(this,U,`https://unpkg.com/three@0.${u.REVISION}.x`);r(this,E,null);r(this,l,null);r(this,j,null);r(this,f,new Map);r(this,M,0);r(this,T,0);r(this,L,0);r(this,W,2);r(this,S,!1);r(this,x,null);r(this,Y,e=>{e instanceof CustomEvent||(n(this,M,t(this,E).clientWidth),n(this,T,t(this,E).clientHeight),n(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))))});r(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,E)}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}n(this,E,ae.getElement(e==null?void 0:e.containerElement)||document.body),n(this,W,(e==null?void 0:e.maxPixelRatio)||2),n(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,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;
8
+ `,(t(this,E).shadowRoot||t(this,E)).append(t(this,l).domElement),t(this,f).set("default",new X("default",k({sizeElement:t(this,E)},e==null?void 0:e.view))),n(this,j,new xe),e!=null&&e.composer&&(n(this,x,new e.composer(t(this,l))),this.render=()=>{t(this,x).render()}),n(this,S,!0),se.windowResizer.subscribe(t(this,Y),ie.RESIZE_ORDER.CANVAS),re.ticker.subscribe(t(this,G),{order:ie.TICK_ORDER.CANVAS,culling:t(this,E)})}destroy(){var e;if(!t(this,S)){console.warn("[en3.setup]: You are trying to destory en3 but it has not been initialized.");return}se.windowResizer.unsubscribe(t(this,Y)),re.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(),n(this,l,null),(e=t(this,x))==null||e.dispose(),n(this,x,null),n(this,S,!1)}createView(e,i){const a=t(this,f).size,h=new X(e,i);return t(this,f).set(e,h),a===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 a=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(a,h,e.box.width,e.box.height),t(this,l).setViewport(a,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,E=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 ye;function be(s,e,i){const a=e.x,h=e.y,V=i||s.image.width/s.image.height;let y=0,v=0,c=s.offset.x,g=s.offset.y,ce=s.rotation,oe=s.center.x,le=s.center.y;a/h>V?(y=1,v=h/a*V):(v=1,y=a/h/V),s.matrix.setUvTransform(c,g,y,v,ce,oe,le)}const K=new u.Vector3,we=new u.Vector3;function ve(s,e="default"){const i=d.getView(e),{width:a,height:h}=d,V=a/h;s instanceof u.Vector3?K.copy(s):K.set(...s);const y=i.camera.getWorldPosition(we).distanceTo(K);if(i.camera instanceof u.OrthographicCamera)return{width:a/i.camera.zoom,height:h/i.camera.zoom,factor:1,distance:y,aspect:V};{const v=i.camera.fov*Math.PI/180,c=2*Math.tan(v/2)*y,g=c*(a/h);return{width:g,height:c,factor:a/g,distance:y,aspect:V}}}function pe(s,e){s.traverse(i=>{i instanceof u.Mesh&&i.material&&(Array.isArray(i.material)?i.material:[i.material]).forEach(e)})}function De(s,e){s.traverse(i=>{i instanceof u.Mesh&&e(i)})}exports.En3View=X;exports.coverTexture=be;exports.dispose=he;exports.en3=d;exports.getCurrentViewport=ve;exports.traverseMaterials=pe;exports.traverseMeshes=De;
package/lib/en3/index.js CHANGED
@@ -16,14 +16,14 @@ var Q = (s, e, i) => e in s ? ue(s, e, { enumerable: !0, configurable: !0, writa
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";
19
- import { RESIZE_ORDER as De, TICK_ORDER as Re } from "../order/index.js";
19
+ import { RESIZE_ORDER as De, TICK_ORDER as ve } from "../order/index.js";
20
20
  import { windowResizer as re } from "../window-resizer/index.js";
21
21
  import { ticker as he } from "../ticker/index.js";
22
22
  import { g as ce } from "../dom-CVWzyXPH.js";
23
23
  import "construct-style-sheets-polyfill";
24
24
  import "../index-Bv9zgfdb.js";
25
25
  import { LayoutBox as ae } from "../layout-box/index.js";
26
- function ve(s) {
26
+ function Re(s) {
27
27
  const e = (i) => {
28
28
  i.dispose();
29
29
  for (const a of Object.keys(i)) {
@@ -40,7 +40,7 @@ function ve(s) {
40
40
  }
41
41
  });
42
42
  }
43
- var S, o, V, p, x, P, D, R;
43
+ var S, o, V, p, x, P, D, v;
44
44
  class ne {
45
45
  constructor(e, i) {
46
46
  r(this, S);
@@ -50,8 +50,8 @@ class ne {
50
50
  r(this, x);
51
51
  r(this, P);
52
52
  r(this, D);
53
- r(this, R);
54
- h(this, S, e), h(this, o, (i == null ? void 0 : i.cameraType) === "orthographic" ? new X() : new se()), h(this, V, new be()), h(this, p, []), h(this, x, (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, h(this, P, (i == null ? void 0 : i.cameraFov) || "auto"), t(this, o).position.z = t(this, x), t(this, o).name = `Cameras.${t(this, S)}`, h(this, D, ce(i == null ? void 0 : i.sizeElement) || document.documentElement), this.beforeRenderCallback = i == null ? void 0 : i.beforeRender, h(this, R, new ae(t(this, D))), t(this, R).onResize(() => {
53
+ r(this, v);
54
+ h(this, S, e), h(this, o, (i == null ? void 0 : i.cameraType) === "orthographic" ? new X() : new se()), h(this, V, new be()), h(this, p, []), h(this, x, (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, h(this, P, (i == null ? void 0 : i.cameraFov) || "auto"), t(this, o).position.z = t(this, x), t(this, o).name = `Cameras.${t(this, S)}`, h(this, D, ce(i == null ? void 0 : i.sizeElement) || document.documentElement), this.beforeRenderCallback = i == null ? void 0 : i.beforeRender, h(this, v, new ae(t(this, D))), t(this, v).onResize(() => {
55
55
  this.resize();
56
56
  });
57
57
  }
@@ -65,7 +65,7 @@ class ne {
65
65
  return t(this, V);
66
66
  }
67
67
  get box() {
68
- return t(this, R);
68
+ return t(this, v);
69
69
  }
70
70
  get cameraDistance() {
71
71
  return t(this, x);
@@ -80,13 +80,13 @@ class ne {
80
80
  return t(this, D) !== m.containerElement;
81
81
  }
82
82
  resize() {
83
- const { width: e, height: i } = t(this, R);
83
+ const { width: e, height: i } = t(this, v);
84
84
  t(this, o).userData.controlled || (t(this, o).position.z = t(this, x)), t(this, o) instanceof se ? (t(this, o).aspect = e / i, t(this, o).fov = t(this, P) === "auto" ? 2 * Math.atan(i / 2 / t(this, x)) * (180 / Math.PI) : t(this, o).userData.controlled ? t(this, o).fov : t(this, P)) : t(this, o) instanceof X && (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();
85
85
  }
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)), m.destroyView(this.name), t(this, R).destroy();
89
+ }), t(this, V).clear(), Re(t(this, V)), m.destroyView(this.name), t(this, v).destroy();
90
90
  }
91
91
  attachToHTMLElement(e, i, a) {
92
92
  const n = new ae(e, te(j({}, a), {
@@ -107,19 +107,19 @@ class ne {
107
107
  this.scene.remove(e), i && this.detachFromHTMLElement(e);
108
108
  }
109
109
  }
110
- S = new WeakMap(), o = new WeakMap(), V = new WeakMap(), p = new WeakMap(), x = new WeakMap(), P = new WeakMap(), D = new WeakMap(), R = new WeakMap();
111
- var A, k, F, v, I;
110
+ S = new WeakMap(), o = new WeakMap(), V = new WeakMap(), p = new WeakMap(), x = new WeakMap(), P = new WeakMap(), D = new WeakMap(), v = new WeakMap();
111
+ var A, k, F, R, I;
112
112
  class ze {
113
113
  constructor(e) {
114
114
  r(this, A);
115
115
  r(this, k);
116
116
  r(this, F);
117
- r(this, v);
117
+ r(this, R);
118
118
  r(this, I);
119
- h(this, A, e.targetName || void 0), h(this, k, e.eventDispatcher || e.object3D), h(this, F, e.propagation || !1), h(this, v, e.object3D), h(this, I, t(this, A) ? () => t(this, v).getObjectByName(t(this, A)) || t(this, v) : () => t(this, v));
119
+ h(this, A, e.targetName || void 0), h(this, k, e.eventDispatcher || e.object3D), h(this, F, e.propagation || !1), h(this, R, e.object3D), h(this, I, t(this, A) ? () => t(this, R).getObjectByName(t(this, A)) || t(this, R) : () => t(this, R));
120
120
  }
121
121
  get object3D() {
122
- return t(this, v);
122
+ return t(this, R);
123
123
  }
124
124
  get eventDispatcher() {
125
125
  return t(this, k);
@@ -137,7 +137,7 @@ class ze {
137
137
  }, this.intersection));
138
138
  }
139
139
  }
140
- A = new WeakMap(), k = new WeakMap(), F = new WeakMap(), v = new WeakMap(), I = new WeakMap();
140
+ A = new WeakMap(), k = new WeakMap(), F = new WeakMap(), R = new WeakMap(), I = new WeakMap();
141
141
  var y, d, H, N, $, W, Y;
142
142
  class Ve {
143
143
  constructor() {
@@ -213,22 +213,22 @@ class Ve {
213
213
  }
214
214
  }
215
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
- class Le {
216
+ var U, g, l, O, u, C, L, T, _, M, E, B, G;
217
+ class Ce {
218
218
  constructor() {
219
219
  r(this, U, `https://unpkg.com/three@0.${we}.x`);
220
220
  r(this, g, null);
221
221
  r(this, l, null);
222
222
  r(this, O, null);
223
223
  r(this, u, /* @__PURE__ */ new Map());
224
+ r(this, C, 0);
224
225
  r(this, L, 0);
225
226
  r(this, T, 0);
226
- r(this, C, 0);
227
227
  r(this, _, 2);
228
228
  r(this, M, !1);
229
229
  r(this, E, null);
230
- r(this, B, () => {
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)));
230
+ r(this, B, (e) => {
231
+ e instanceof CustomEvent || (h(this, C, t(this, g).clientWidth), h(this, L, t(this, g).clientHeight), h(this, T, Math.min(t(this, _), devicePixelRatio || 1)), t(this, l).setPixelRatio(t(this, T)), t(this, l).setSize(t(this, C), t(this, L)), t(this, E) && (t(this, E).setPixelRatio(t(this, T)), t(this, E).setSize(t(this, C), t(this, L))));
232
232
  });
233
233
  r(this, G, () => {
234
234
  t(this, l).setRenderTarget(null), t(this, u).forEach((e) => {
@@ -261,13 +261,13 @@ class Le {
261
261
  return this.getView("default").scene;
262
262
  }
263
263
  get width() {
264
- return t(this, L);
264
+ return t(this, C);
265
265
  }
266
266
  get height() {
267
- return t(this, T);
267
+ return t(this, L);
268
268
  }
269
269
  get pixelRatio() {
270
- return t(this, C);
270
+ return t(this, T);
271
271
  }
272
272
  get composer() {
273
273
  return t(this, E);
@@ -292,7 +292,7 @@ class Le {
292
292
  ), h(this, O, new Ve()), e != null && e.composer && (h(this, E, new e.composer(t(this, l))), this.render = () => {
293
293
  t(this, E).render();
294
294
  }), h(this, M, !0), re.subscribe(t(this, B), De.CANVAS), he.subscribe(t(this, G), {
295
- order: Re.CANVAS,
295
+ order: ve.CANVAS,
296
296
  culling: t(this, g)
297
297
  });
298
298
  }
@@ -333,18 +333,18 @@ class Le {
333
333
  (i = e.beforeRenderCallback) == null || i.call(e), t(this, l).render(e.scene, e.camera);
334
334
  }
335
335
  }
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();
336
+ U = new WeakMap(), g = new WeakMap(), l = new WeakMap(), O = new WeakMap(), u = new WeakMap(), C = new WeakMap(), L = new WeakMap(), T = new WeakMap(), _ = new WeakMap(), M = new WeakMap(), E = new WeakMap(), B = new WeakMap(), G = new WeakMap();
337
+ const m = new Ce();
338
338
  function Fe(s, e, i) {
339
339
  const a = e.x, n = e.y, z = i || s.image.width / s.image.height;
340
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
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);
342
342
  }
343
- const K = new q(), Te = new q();
343
+ const K = new q(), Le = new q();
344
344
  function Ie(s, e = "default") {
345
345
  const i = m.getView(e), { width: a, height: n } = m, z = a / n;
346
346
  s instanceof q ? K.copy(s) : K.set(...s);
347
- const b = i.camera.getWorldPosition(Te).distanceTo(K);
347
+ const b = i.camera.getWorldPosition(Le).distanceTo(K);
348
348
  if (i.camera instanceof X)
349
349
  return {
350
350
  width: a / i.camera.zoom,
@@ -371,7 +371,7 @@ function $e(s, e) {
371
371
  export {
372
372
  ne as En3View,
373
373
  Fe as coverTexture,
374
- ve as dispose,
374
+ Re as dispose,
375
375
  m as en3,
376
376
  Ie as getCurrentViewport,
377
377
  Ne as traverseMaterials,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aptechka",
3
- "version": "0.64.6",
3
+ "version": "0.64.7",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/denisavitski/aptechka.git"