aptechka 0.76.3 → 0.76.5

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.
@@ -28,6 +28,12 @@ export declare class En3View {
28
28
  get box(): LayoutBox;
29
29
  get cameraDistance(): number;
30
30
  set cameraDistance(value: number);
31
+ set fov(value: 'auto' | number);
32
+ get fov(): "auto" | number;
33
+ set near(value: number);
34
+ get near(): number;
35
+ set far(value: number);
36
+ get far(): number;
31
37
  get sizeElement(): HTMLElement;
32
38
  get isClipped(): boolean;
33
39
  resize(): void;
package/lib/en3/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
- "use strict";var j=Object.defineProperty,p=Object.defineProperties;var ee=Object.getOwnPropertyDescriptors;var H=Object.getOwnPropertySymbols;var te=Object.prototype.hasOwnProperty,re=Object.prototype.propertyIsEnumerable;var $=i=>{throw TypeError(i)};var N=(i,e,r)=>e in i?j(i,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[e]=r,I=(i,e)=>{for(var r in e||(e={}))te.call(e,r)&&N(i,r,e[r]);if(H)for(var r of H(e))re.call(e,r)&&N(i,r,e[r]);return i},B=(i,e)=>p(i,ee(e));var W=(i,e,r)=>e.has(i)||$("Cannot "+r);var t=(i,e,r)=>(W(i,e,"read from private field"),r?r.call(i):e.get(i)),n=(i,e,r)=>e.has(i)?$("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,r),h=(i,e,r,s)=>(W(i,e,"write to private field"),s?s.call(i,r):e.set(i,r),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("three"),G=require("../order/index.cjs"),K=require("../window-resizer/index.cjs"),U=require("../ticker/index.cjs"),J=require("../dom-JBOkFLTh.cjs");require("construct-style-sheets-polyfill");require("../index-DekP7OZe.cjs");const Z=require("../layout-box/index.cjs");function Q(i){const e=r=>{r.dispose();for(const s of Object.keys(r)){const a=r[s];a&&typeof a=="object"&&"minFilter"in a&&a.dispose()}};i.traverse(r=>{if(r instanceof d.Mesh){if(r.geometry.dispose(),!Array.isArray(r.material)&&r.material.isMaterial)e(r.material);else if(Array.isArray(r.material))for(const s of r.material)e(s)}})}var T,S,c,b,g,o,v,x,w;class F{constructor(e,r,s){n(this,T);n(this,S);n(this,c);n(this,b);n(this,g);n(this,o);n(this,v);n(this,x);n(this,w);h(this,T,e),h(this,S,r),h(this,c,(s==null?void 0:s.cameraType)==="orthographic"?new d.OrthographicCamera:new d.PerspectiveCamera),h(this,b,new d.Scene),h(this,g,[]),h(this,o,(s==null?void 0:s.cameraDistance)||1e3),t(this,c).near=(s==null?void 0:s.cameraNear)||1,t(this,c).far=(s==null?void 0:s.cameraFar)||11e3,h(this,v,(s==null?void 0:s.cameraFov)||"auto"),t(this,c).position.z=t(this,o),t(this,c).name=`Cameras.${t(this,S)}`,h(this,x,J.getElement(s==null?void 0:s.sizeElement)||document.documentElement),this.beforeRenderCallback=s==null?void 0:s.beforeRender,h(this,w,new Z.LayoutBox(t(this,x))),t(this,w).onResize(()=>{this.resize()})}get name(){return t(this,S)}get camera(){return t(this,c)}get scene(){return t(this,b)}get box(){return t(this,w)}get cameraDistance(){return t(this,o)}set cameraDistance(e){h(this,o,e),this.resize()}get sizeElement(){return t(this,x)}get isClipped(){return t(this,x)!==t(this,T).containerElement}resize(){const{width:e,height:r}=t(this,w);t(this,c).userData.controlled||(t(this,c).position.z=t(this,o)),t(this,c)instanceof d.PerspectiveCamera?(t(this,c).aspect=e/r,t(this,c).fov=t(this,v)==="auto"?2*Math.atan(r/2/t(this,o))*(180/Math.PI):t(this,c).userData.controlled?t(this,c).fov:t(this,v)):t(this,c)instanceof d.OrthographicCamera&&(t(this,c).left=e/-2,t(this,c).right=e/2,t(this,c).top=r/2,t(this,c).bottom=r/-2),t(this,c).updateProjectionMatrix()}destroy(){t(this,g).forEach(e=>{e.userData.box.destroy()}),t(this,b).clear(),Q(t(this,b)),t(this,T).destroyView(this.name),t(this,w).destroy()}attachToHTMLElement(e,r,s){const a=new Z.LayoutBox(e,B(I({},s),{containerElement:t(this,x),cartesian:!0,scrollStep:!this.isClipped}));return a.bindObject(r),r.userData.box=a,t(this,g).push(r),r}detachFromHTMLElement(e){h(this,g,t(this,g).filter(r=>r===e?(e.userData.box.destroy(),!1):!0))}add(...e){const r=e[0],s=e[1],a=e[2];return s&&this.attachToHTMLElement(s,r,a),this.scene.add(r),r}remove(e,r){this.scene.remove(e),r&&this.detachFromHTMLElement(e)}}T=new WeakMap,S=new WeakMap,c=new WeakMap,b=new WeakMap,g=new WeakMap,o=new WeakMap,v=new WeakMap,x=new WeakMap,w=new WeakMap;var k,u,l,m,R,z,V,D,C,f,P,A;class se{constructor(){n(this,k,`https://unpkg.com/three@0.${d.REVISION}.x`);n(this,u,null);n(this,l,null);n(this,m,new Map);n(this,R,0);n(this,z,0);n(this,V,0);n(this,D,2);n(this,C,!1);n(this,f,null);n(this,P,e=>{e instanceof CustomEvent||(h(this,R,t(this,u).clientWidth),h(this,z,t(this,u).clientHeight),h(this,V,Math.min(t(this,D),devicePixelRatio||1)),t(this,l).setPixelRatio(t(this,V)),t(this,l).setSize(t(this,R),t(this,z)),t(this,f)&&(t(this,f).setPixelRatio(t(this,V)),t(this,f).setSize(t(this,R),t(this,z))))});n(this,A,()=>{t(this,l).setRenderTarget(null),t(this,m).forEach(e=>{this.render(e)})})}get CDNVersion(){return t(this,k)}get containerElement(){return t(this,u)}get webglRenderer(){return t(this,l)}get views(){return t(this,m)}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,R)}get height(){return t(this,z)}get pixelRatio(){return t(this,V)}get composer(){return t(this,f)}setup(e){if(t(this,C))return;h(this,u,J.getElement(e==null?void 0:e.containerElement)||document.body),h(this,D,(e==null?void 0:e.maxPixelRatio)||2),h(this,l,new d.WebGLRenderer(e==null?void 0:e.webGLRendererParameters)),t(this,l).domElement.style.cssText=`
1
+ "use strict";var p=Object.defineProperty,ee=Object.defineProperties;var te=Object.getOwnPropertyDescriptors;var N=Object.getOwnPropertySymbols;var re=Object.prototype.hasOwnProperty,se=Object.prototype.propertyIsEnumerable;var B=i=>{throw TypeError(i)};var $=(i,e,r)=>e in i?p(i,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[e]=r,I=(i,e)=>{for(var r in e||(e={}))re.call(e,r)&&$(i,r,e[r]);if(N)for(var r of N(e))se.call(e,r)&&$(i,r,e[r]);return i},W=(i,e)=>ee(i,te(e));var G=(i,e,r)=>e.has(i)||B("Cannot "+r);var t=(i,e,r)=>(G(i,e,"read from private field"),r?r.call(i):e.get(i)),c=(i,e,r)=>e.has(i)?B("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,r),n=(i,e,r,s)=>(G(i,e,"write to private field"),s?s.call(i,r):e.set(i,r),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("three"),K=require("../order/index.cjs"),U=require("../window-resizer/index.cjs"),Z=require("../ticker/index.cjs"),Q=require("../dom-JBOkFLTh.cjs");require("construct-style-sheets-polyfill");require("../index-DekP7OZe.cjs");const J=require("../layout-box/index.cjs"),ie=require("../function-MthRj-GJ.cjs");function X(i){const e=r=>{r.dispose();for(const s of Object.keys(r)){const h=r[s];h&&typeof h=="object"&&"minFilter"in h&&h.dispose()}};i.traverse(r=>{if(r instanceof m.Mesh){if(r.geometry.dispose(),!Array.isArray(r.material)&&r.material.isMaterial)e(r.material);else if(Array.isArray(r.material))for(const s of r.material)e(s)}})}var S,D,a,R,g,o,x,w,y,z;class H{constructor(e,r,s){c(this,S);c(this,D);c(this,a);c(this,R);c(this,g);c(this,o);c(this,x);c(this,w);c(this,y);c(this,z,ie.debounce(()=>{this.resize()},0));n(this,S,e),n(this,D,r),n(this,a,(s==null?void 0:s.cameraType)==="orthographic"?new m.OrthographicCamera:new m.PerspectiveCamera),n(this,R,new m.Scene),n(this,g,[]),n(this,o,(s==null?void 0:s.cameraDistance)||1e3),t(this,a).near=(s==null?void 0:s.cameraNear)||1,t(this,a).far=(s==null?void 0:s.cameraFar)||11e3,n(this,x,(s==null?void 0:s.cameraFov)||"auto"),t(this,a).position.z=t(this,o),t(this,a).name=`Cameras.${t(this,D)}`,n(this,w,Q.getElement(s==null?void 0:s.sizeElement)||document.documentElement),this.beforeRenderCallback=s==null?void 0:s.beforeRender,n(this,y,new J.LayoutBox(t(this,w))),t(this,y).onResize(()=>{this.resize()})}get name(){return t(this,D)}get camera(){return t(this,a)}get scene(){return t(this,R)}get box(){return t(this,y)}get cameraDistance(){return t(this,o)}set cameraDistance(e){n(this,o,e),t(this,z).call(this)}set fov(e){n(this,x,e),t(this,z).call(this)}get fov(){return t(this,x)}set near(e){t(this,a).near=e,t(this,z).call(this)}get near(){return t(this,a).near}set far(e){t(this,a).far=e,t(this,z).call(this)}get far(){return t(this,a).far}get sizeElement(){return t(this,w)}get isClipped(){return t(this,w)!==t(this,S).containerElement}resize(){const{width:e,height:r}=t(this,y);t(this,a).userData.controlled||(t(this,a).position.z=t(this,o)),t(this,a)instanceof m.PerspectiveCamera?(t(this,a).aspect=e/r,t(this,a).fov=t(this,x)==="auto"?2*Math.atan(r/2/t(this,o))*(180/Math.PI):t(this,a).userData.controlled?t(this,a).fov:t(this,x)):t(this,a)instanceof m.OrthographicCamera&&(t(this,a).left=e/-2,t(this,a).right=e/2,t(this,a).top=r/2,t(this,a).bottom=r/-2),t(this,a).updateProjectionMatrix()}destroy(){t(this,g).forEach(e=>{e.userData.box.destroy()}),t(this,R).clear(),X(t(this,R)),t(this,S).destroyView(this.name),t(this,y).destroy()}attachToHTMLElement(e,r,s){const h=new J.LayoutBox(e,W(I({},s),{containerElement:t(this,w),cartesian:!0,scrollStep:!this.isClipped}));return h.bindObject(r),r.userData.box=h,t(this,g).push(r),r}detachFromHTMLElement(e){n(this,g,t(this,g).filter(r=>r===e?(e.userData.box.destroy(),!1):!0))}add(...e){const r=e[0],s=e[1],h=e[2];return s&&this.attachToHTMLElement(s,r,h),this.scene.add(r),r}remove(e,r){this.scene.remove(e),r&&this.detachFromHTMLElement(e)}}S=new WeakMap,D=new WeakMap,a=new WeakMap,R=new WeakMap,g=new WeakMap,o=new WeakMap,x=new WeakMap,w=new WeakMap,y=new WeakMap,z=new WeakMap;var q,d,l,u,V,C,M,P,T,f,A,L;class ae{constructor(){c(this,q,`https://unpkg.com/three@0.${m.REVISION}.x`);c(this,d,null);c(this,l,null);c(this,u,new Map);c(this,V,0);c(this,C,0);c(this,M,0);c(this,P,2);c(this,T,!1);c(this,f,null);c(this,A,e=>{e instanceof CustomEvent||(n(this,V,t(this,d).clientWidth),n(this,C,t(this,d).clientHeight),n(this,M,Math.min(t(this,P),devicePixelRatio||1)),t(this,l).setPixelRatio(t(this,M)),t(this,l).setSize(t(this,V),t(this,C)),t(this,f)&&(t(this,f).setPixelRatio(t(this,M)),t(this,f).setSize(t(this,V),t(this,C))))});c(this,L,()=>{t(this,l).setRenderTarget(null),t(this,u).forEach(e=>{this.render(e)})})}get CDNVersion(){return t(this,q)}get containerElement(){return t(this,d)}get webglRenderer(){return t(this,l)}get views(){return t(this,u)}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,V)}get height(){return t(this,C)}get pixelRatio(){return t(this,M)}get composer(){return t(this,f)}setup(e){if(t(this,T))return;n(this,d,Q.getElement(e==null?void 0:e.containerElement)||document.body),n(this,P,(e==null?void 0:e.maxPixelRatio)||2),n(this,l,new m.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,u).shadowRoot||t(this,u)).append(t(this,l).domElement),t(this,m).set("default",new F(this,"default",I({sizeElement:t(this,u)},e==null?void 0:e.view))),e!=null&&e.composer&&(h(this,f,new e.composer(t(this,l))),this.render=()=>{t(this,f).render()}),h(this,C,!0),K.windowResizer.subscribe(t(this,P),G.RESIZE_ORDER.CANVAS),U.ticker.subscribe(t(this,A),{order:G.TICK_ORDER.CANVAS,culling:t(this,u)})}destroy(){var e;t(this,C)&&(K.windowResizer.unsubscribe(t(this,P)),U.ticker.unsubscribe(t(this,A)),t(this,m).forEach(r=>{r.destroy()}),t(this,m).clear(),t(this,l).dispose(),t(this,l).domElement.remove(),h(this,l,null),(e=t(this,f))==null||e.dispose(),h(this,f,null),h(this,C,!1))}createView(e,r){const s=t(this,m).size,a=new F(this,e,r);return t(this,m).set(e,a),s===1&&t(this,l).setScissorTest(!0),a}getView(e){return t(this,m).get(e)}destroyView(e){const r=t(this,m).get(e);r&&(t(this,m).delete(e),r.destroy(),t(this,m).size<=1&&t(this,l).setScissorTest(!1))}render(e){var r;if(t(this,m).size>1||this.view.isClipped){const s=e.box.left+e.box.CSSTranslation.x+e.box.scrollValue.x,a=this.height-e.box.height-e.box.top+e.box.CSSTranslation.y+e.box.scrollValue.y*-1;t(this,l).setScissor(s,a,e.box.width,e.box.height),t(this,l).setViewport(s,a,e.box.width,e.box.height)}(r=e.beforeRenderCallback)==null||r.call(e),t(this,l).render(e.scene,e.camera)}}k=new WeakMap,u=new WeakMap,l=new WeakMap,m=new WeakMap,R=new WeakMap,z=new WeakMap,V=new WeakMap,D=new WeakMap,C=new WeakMap,f=new WeakMap,P=new WeakMap,A=new WeakMap;function ie(i,e,r){const s=e.x,a=e.y,y=r||i.image.width/i.image.height;let M=0,E=0,q=i.offset.x,L=i.offset.y,O=i.rotation,X=i.center.x,Y=i.center.y;s/a>y?(M=1,E=a/s*y):(E=1,M=s/a/y),i.matrix.setUvTransform(q,L,M,E,O,X,Y)}const _=new d.Vector3,ae=new d.Vector3;function he(i,e,r="default"){const s=i.getView(r),{width:a,height:y}=i,M=a/y;e instanceof d.Vector3?_.copy(e):_.set(...e);const E=s.camera.getWorldPosition(ae).distanceTo(_);if(s.camera instanceof d.OrthographicCamera)return{width:a/s.camera.zoom,height:y/s.camera.zoom,factor:1,distance:E,aspect:M};{const q=s.camera.fov*Math.PI/180,L=2*Math.tan(q/2)*E,O=L*(a/y);return{width:O,height:L,factor:a/O,distance:E,aspect:M}}}function ne(i,e){i.traverse(r=>{r instanceof d.Mesh&&r.material&&(Array.isArray(r.material)?r.material:[r.material]).forEach(e)})}function ce(i,e){i.traverse(r=>{r instanceof d.Mesh&&e(r)})}exports.En3=se;exports.En3View=F;exports.coverTexture=ie;exports.dispose=Q;exports.getCurrentViewport=he;exports.traverseMaterials=ne;exports.traverseMeshes=ce;
8
+ `,(t(this,d).shadowRoot||t(this,d)).append(t(this,l).domElement),t(this,u).set("default",new H(this,"default",I({sizeElement:t(this,d)},e==null?void 0:e.view))),e!=null&&e.composer&&(n(this,f,new e.composer(t(this,l))),this.render=()=>{t(this,f).render()}),n(this,T,!0),U.windowResizer.subscribe(t(this,A),K.RESIZE_ORDER.CANVAS),Z.ticker.subscribe(t(this,L),{order:K.TICK_ORDER.CANVAS,culling:t(this,d)})}destroy(){var e;t(this,T)&&(U.windowResizer.unsubscribe(t(this,A)),Z.ticker.unsubscribe(t(this,L)),t(this,u).forEach(r=>{r.destroy()}),t(this,u).clear(),t(this,l).dispose(),t(this,l).domElement.remove(),n(this,l,null),(e=t(this,f))==null||e.dispose(),n(this,f,null),n(this,T,!1))}createView(e,r){const s=t(this,u).size,h=new H(this,e,r);return t(this,u).set(e,h),s===1&&t(this,l).setScissorTest(!0),h}getView(e){return t(this,u).get(e)}destroyView(e){const r=t(this,u).get(e);r&&(t(this,u).delete(e),r.destroy(),t(this,u).size<=1&&t(this,l).setScissorTest(!1))}render(e){var r;if(t(this,u).size>1||this.view.isClipped){const s=e.box.left+e.box.CSSTranslation.x+e.box.scrollValue.x,h=this.height-e.box.height-e.box.top+e.box.CSSTranslation.y+e.box.scrollValue.y*-1;t(this,l).setScissor(s,h,e.box.width,e.box.height),t(this,l).setViewport(s,h,e.box.width,e.box.height)}(r=e.beforeRenderCallback)==null||r.call(e),t(this,l).render(e.scene,e.camera)}}q=new WeakMap,d=new WeakMap,l=new WeakMap,u=new WeakMap,V=new WeakMap,C=new WeakMap,M=new WeakMap,P=new WeakMap,T=new WeakMap,f=new WeakMap,A=new WeakMap,L=new WeakMap;function he(i,e,r){const s=e.x,h=e.y,b=r||i.image.width/i.image.height;let v=0,E=0,_=i.offset.x,O=i.offset.y,k=i.rotation,Y=i.center.x,j=i.center.y;s/h>b?(v=1,E=h/s*b):(E=1,v=s/h/b),i.matrix.setUvTransform(_,O,v,E,k,Y,j)}const F=new m.Vector3,ne=new m.Vector3;function ce(i,e,r="default"){const s=i.getView(r),{width:h,height:b}=i,v=h/b;e instanceof m.Vector3?F.copy(e):F.set(...e);const E=s.camera.getWorldPosition(ne).distanceTo(F);if(s.camera instanceof m.OrthographicCamera)return{width:h/s.camera.zoom,height:b/s.camera.zoom,factor:1,distance:E,aspect:v};{const _=s.camera.fov*Math.PI/180,O=2*Math.tan(_/2)*E,k=O*(h/b);return{width:k,height:O,factor:h/k,distance:E,aspect:v}}}function le(i,e){i.traverse(r=>{r instanceof m.Mesh&&r.material&&(Array.isArray(r.material)?r.material:[r.material]).forEach(e)})}function ue(i,e){i.traverse(r=>{r instanceof m.Mesh&&e(r)})}exports.En3=ae;exports.En3View=H;exports.coverTexture=he;exports.dispose=X;exports.getCurrentViewport=ce;exports.traverseMaterials=le;exports.traverseMeshes=ue;
package/lib/en3/index.js CHANGED
@@ -1,29 +1,30 @@
1
- var p = Object.defineProperty, ee = Object.defineProperties;
2
- var te = Object.getOwnPropertyDescriptors;
3
- var W = Object.getOwnPropertySymbols;
4
- var se = Object.prototype.hasOwnProperty, ie = Object.prototype.propertyIsEnumerable;
5
- var G = (r) => {
1
+ var ee = Object.defineProperty, te = Object.defineProperties;
2
+ var se = Object.getOwnPropertyDescriptors;
3
+ var _ = Object.getOwnPropertySymbols;
4
+ var ie = Object.prototype.hasOwnProperty, re = Object.prototype.propertyIsEnumerable;
5
+ var B = (r) => {
6
6
  throw TypeError(r);
7
7
  };
8
- var _ = (r, e, s) => e in r ? p(r, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[e] = s, O = (r, e) => {
8
+ var G = (r, e, s) => e in r ? ee(r, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[e] = s, F = (r, e) => {
9
9
  for (var s in e || (e = {}))
10
- se.call(e, s) && _(r, s, e[s]);
11
- if (W)
12
- for (var s of W(e))
13
- ie.call(e, s) && _(r, s, e[s]);
10
+ ie.call(e, s) && G(r, s, e[s]);
11
+ if (_)
12
+ for (var s of _(e))
13
+ re.call(e, s) && G(r, s, e[s]);
14
14
  return r;
15
- }, B = (r, e) => ee(r, te(e));
16
- var K = (r, e, s) => e.has(r) || G("Cannot " + s);
17
- var t = (r, e, s) => (K(r, e, "read from private field"), s ? s.call(r) : e.get(r)), n = (r, e, s) => e.has(r) ? G("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, s), h = (r, e, s, i) => (K(r, e, "write to private field"), i ? i.call(r, s) : e.set(r, s), s);
18
- import { Mesh as N, OrthographicCamera as H, PerspectiveCamera as U, Scene as re, REVISION as ae, WebGLRenderer as he, Vector3 as $ } from "three";
19
- import { RESIZE_ORDER as ne, TICK_ORDER as ce } from "../order/index.js";
20
- import { windowResizer as Z } from "../window-resizer/index.js";
21
- import { ticker as q } from "../ticker/index.js";
22
- import { g as X } from "../dom-CVWzyXPH.js";
15
+ }, K = (r, e) => te(r, se(e));
16
+ var U = (r, e, s) => e.has(r) || B("Cannot " + s);
17
+ var t = (r, e, s) => (U(r, e, "read from private field"), s ? s.call(r) : e.get(r)), c = (r, e, s) => e.has(r) ? B("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, s), n = (r, e, s, i) => (U(r, e, "write to private field"), i ? i.call(r, s) : e.set(r, s), s);
18
+ import { Mesh as $, OrthographicCamera as N, PerspectiveCamera as Z, Scene as he, REVISION as ae, WebGLRenderer as ne, Vector3 as W } from "three";
19
+ import { RESIZE_ORDER as ce, TICK_ORDER as le } from "../order/index.js";
20
+ import { windowResizer as q } from "../window-resizer/index.js";
21
+ import { ticker as J } from "../ticker/index.js";
22
+ import { g as Y } from "../dom-CVWzyXPH.js";
23
23
  import "construct-style-sheets-polyfill";
24
24
  import "../index-Bv9zgfdb.js";
25
- import { LayoutBox as J } from "../layout-box/index.js";
26
- function le(r) {
25
+ import { LayoutBox as Q } from "../layout-box/index.js";
26
+ import { d as me } from "../function-C10DGppn.js";
27
+ function fe(r) {
27
28
  const e = (s) => {
28
29
  s.dispose();
29
30
  for (const i of Object.keys(s)) {
@@ -32,7 +33,7 @@ function le(r) {
32
33
  }
33
34
  };
34
35
  r.traverse((s) => {
35
- if (s instanceof N) {
36
+ if (s instanceof $) {
36
37
  if (s.geometry.dispose(), !Array.isArray(s.material) && s.material.isMaterial)
37
38
  e(s.material);
38
39
  else if (Array.isArray(s.material))
@@ -40,65 +41,86 @@ function le(r) {
40
41
  }
41
42
  });
42
43
  }
43
- var T, M, c, b, o, u, S, g, x;
44
- class Q {
44
+ var S, D, h, w, o, u, g, x, b, R;
45
+ class X {
45
46
  constructor(e, s, i) {
46
- n(this, T);
47
- n(this, M);
48
- n(this, c);
49
- n(this, b);
50
- n(this, o);
51
- n(this, u);
52
- n(this, S);
53
- n(this, g);
54
- n(this, x);
55
- h(this, T, e), h(this, M, s), h(this, c, (i == null ? void 0 : i.cameraType) === "orthographic" ? new H() : new U()), h(this, b, new re()), h(this, o, []), h(this, u, (i == null ? void 0 : i.cameraDistance) || 1e3), t(this, c).near = (i == null ? void 0 : i.cameraNear) || 1, t(this, c).far = (i == null ? void 0 : i.cameraFar) || 11e3, h(this, S, (i == null ? void 0 : i.cameraFov) || "auto"), t(this, c).position.z = t(this, u), t(this, c).name = `Cameras.${t(this, M)}`, h(this, g, X(i == null ? void 0 : i.sizeElement) || document.documentElement), this.beforeRenderCallback = i == null ? void 0 : i.beforeRender, h(this, x, new J(t(this, g))), t(this, x).onResize(() => {
47
+ c(this, S);
48
+ c(this, D);
49
+ c(this, h);
50
+ c(this, w);
51
+ c(this, o);
52
+ c(this, u);
53
+ c(this, g);
54
+ c(this, x);
55
+ c(this, b);
56
+ c(this, R, me(() => {
57
+ this.resize();
58
+ }, 0));
59
+ n(this, S, e), n(this, D, s), n(this, h, (i == null ? void 0 : i.cameraType) === "orthographic" ? new N() : new Z()), n(this, w, new he()), n(this, o, []), n(this, u, (i == null ? void 0 : i.cameraDistance) || 1e3), t(this, h).near = (i == null ? void 0 : i.cameraNear) || 1, t(this, h).far = (i == null ? void 0 : i.cameraFar) || 11e3, n(this, g, (i == null ? void 0 : i.cameraFov) || "auto"), t(this, h).position.z = t(this, u), t(this, h).name = `Cameras.${t(this, D)}`, n(this, x, Y(i == null ? void 0 : i.sizeElement) || document.documentElement), this.beforeRenderCallback = i == null ? void 0 : i.beforeRender, n(this, b, new Q(t(this, x))), t(this, b).onResize(() => {
56
60
  this.resize();
57
61
  });
58
62
  }
59
63
  get name() {
60
- return t(this, M);
64
+ return t(this, D);
61
65
  }
62
66
  get camera() {
63
- return t(this, c);
67
+ return t(this, h);
64
68
  }
65
69
  get scene() {
66
- return t(this, b);
70
+ return t(this, w);
67
71
  }
68
72
  get box() {
69
- return t(this, x);
73
+ return t(this, b);
70
74
  }
71
75
  get cameraDistance() {
72
76
  return t(this, u);
73
77
  }
74
78
  set cameraDistance(e) {
75
- h(this, u, e), this.resize();
79
+ n(this, u, e), t(this, R).call(this);
76
80
  }
77
- get sizeElement() {
81
+ set fov(e) {
82
+ n(this, g, e), t(this, R).call(this);
83
+ }
84
+ get fov() {
78
85
  return t(this, g);
79
86
  }
87
+ set near(e) {
88
+ t(this, h).near = e, t(this, R).call(this);
89
+ }
90
+ get near() {
91
+ return t(this, h).near;
92
+ }
93
+ set far(e) {
94
+ t(this, h).far = e, t(this, R).call(this);
95
+ }
96
+ get far() {
97
+ return t(this, h).far;
98
+ }
99
+ get sizeElement() {
100
+ return t(this, x);
101
+ }
80
102
  get isClipped() {
81
- return t(this, g) !== t(this, T).containerElement;
103
+ return t(this, x) !== t(this, S).containerElement;
82
104
  }
83
105
  resize() {
84
- const { width: e, height: s } = t(this, x);
85
- t(this, c).userData.controlled || (t(this, c).position.z = t(this, u)), t(this, c) instanceof U ? (t(this, c).aspect = e / s, t(this, c).fov = t(this, S) === "auto" ? 2 * Math.atan(s / 2 / t(this, u)) * (180 / Math.PI) : t(this, c).userData.controlled ? t(this, c).fov : t(this, S)) : t(this, c) instanceof H && (t(this, c).left = e / -2, t(this, c).right = e / 2, t(this, c).top = s / 2, t(this, c).bottom = s / -2), t(this, c).updateProjectionMatrix();
106
+ const { width: e, height: s } = t(this, b);
107
+ t(this, h).userData.controlled || (t(this, h).position.z = t(this, u)), t(this, h) instanceof Z ? (t(this, h).aspect = e / s, t(this, h).fov = t(this, g) === "auto" ? 2 * Math.atan(s / 2 / t(this, u)) * (180 / Math.PI) : t(this, h).userData.controlled ? t(this, h).fov : t(this, g)) : t(this, h) instanceof N && (t(this, h).left = e / -2, t(this, h).right = e / 2, t(this, h).top = s / 2, t(this, h).bottom = s / -2), t(this, h).updateProjectionMatrix();
86
108
  }
87
109
  destroy() {
88
110
  t(this, o).forEach((e) => {
89
111
  e.userData.box.destroy();
90
- }), t(this, b).clear(), le(t(this, b)), t(this, T).destroyView(this.name), t(this, x).destroy();
112
+ }), t(this, w).clear(), fe(t(this, w)), t(this, S).destroyView(this.name), t(this, b).destroy();
91
113
  }
92
114
  attachToHTMLElement(e, s, i) {
93
- const a = new J(e, B(O({}, i), {
94
- containerElement: t(this, g),
115
+ const a = new Q(e, K(F({}, i), {
116
+ containerElement: t(this, x),
95
117
  cartesian: !0,
96
118
  scrollStep: !this.isClipped
97
119
  }));
98
120
  return a.bindObject(s), s.userData.box = a, t(this, o).push(s), s;
99
121
  }
100
122
  detachFromHTMLElement(e) {
101
- h(this, o, t(this, o).filter((s) => s === e ? (e.userData.box.destroy(), !1) : !0));
123
+ n(this, o, t(this, o).filter((s) => s === e ? (e.userData.box.destroy(), !1) : !0));
102
124
  }
103
125
  add(...e) {
104
126
  const s = e[0], i = e[1], a = e[2];
@@ -108,31 +130,31 @@ class Q {
108
130
  this.scene.remove(e), s && this.detachFromHTMLElement(e);
109
131
  }
110
132
  }
111
- T = new WeakMap(), M = new WeakMap(), c = new WeakMap(), b = new WeakMap(), o = new WeakMap(), u = new WeakMap(), S = new WeakMap(), g = new WeakMap(), x = new WeakMap();
112
- var k, f, l, m, w, R, z, D, V, d, P, A;
113
- class we {
133
+ S = new WeakMap(), D = new WeakMap(), h = new WeakMap(), w = new WeakMap(), o = new WeakMap(), u = new WeakMap(), g = new WeakMap(), x = new WeakMap(), b = new WeakMap(), R = new WeakMap();
134
+ var I, f, l, m, z, V, C, v, T, d, P, A;
135
+ class Ve {
114
136
  constructor() {
115
- n(this, k, `https://unpkg.com/three@0.${ae}.x`);
116
- n(this, f, null);
117
- n(this, l, null);
118
- n(this, m, /* @__PURE__ */ new Map());
119
- n(this, w, 0);
120
- n(this, R, 0);
121
- n(this, z, 0);
122
- n(this, D, 2);
123
- n(this, V, !1);
124
- n(this, d, null);
125
- n(this, P, (e) => {
126
- e instanceof CustomEvent || (h(this, w, t(this, f).clientWidth), h(this, R, t(this, f).clientHeight), h(this, z, Math.min(t(this, D), devicePixelRatio || 1)), t(this, l).setPixelRatio(t(this, z)), t(this, l).setSize(t(this, w), t(this, R)), t(this, d) && (t(this, d).setPixelRatio(t(this, z)), t(this, d).setSize(t(this, w), t(this, R))));
137
+ c(this, I, `https://unpkg.com/three@0.${ae}.x`);
138
+ c(this, f, null);
139
+ c(this, l, null);
140
+ c(this, m, /* @__PURE__ */ new Map());
141
+ c(this, z, 0);
142
+ c(this, V, 0);
143
+ c(this, C, 0);
144
+ c(this, v, 2);
145
+ c(this, T, !1);
146
+ c(this, d, null);
147
+ c(this, P, (e) => {
148
+ e instanceof CustomEvent || (n(this, z, t(this, f).clientWidth), n(this, V, t(this, f).clientHeight), n(this, C, Math.min(t(this, v), devicePixelRatio || 1)), t(this, l).setPixelRatio(t(this, C)), t(this, l).setSize(t(this, z), t(this, V)), t(this, d) && (t(this, d).setPixelRatio(t(this, C)), t(this, d).setSize(t(this, z), t(this, V))));
127
149
  });
128
- n(this, A, () => {
150
+ c(this, A, () => {
129
151
  t(this, l).setRenderTarget(null), t(this, m).forEach((e) => {
130
152
  this.render(e);
131
153
  });
132
154
  });
133
155
  }
134
156
  get CDNVersion() {
135
- return t(this, k);
157
+ return t(this, I);
136
158
  }
137
159
  get containerElement() {
138
160
  return t(this, f);
@@ -153,21 +175,21 @@ class we {
153
175
  return this.getView("default").scene;
154
176
  }
155
177
  get width() {
156
- return t(this, w);
178
+ return t(this, z);
157
179
  }
158
180
  get height() {
159
- return t(this, R);
181
+ return t(this, V);
160
182
  }
161
183
  get pixelRatio() {
162
- return t(this, z);
184
+ return t(this, C);
163
185
  }
164
186
  get composer() {
165
187
  return t(this, d);
166
188
  }
167
189
  setup(e) {
168
- if (t(this, V))
190
+ if (t(this, T))
169
191
  return;
170
- h(this, f, X(e == null ? void 0 : e.containerElement) || document.body), h(this, D, (e == null ? void 0 : e.maxPixelRatio) || 2), h(this, l, new he(e == null ? void 0 : e.webGLRendererParameters)), t(this, l).domElement.style.cssText = `
192
+ n(this, f, Y(e == null ? void 0 : e.containerElement) || document.body), n(this, v, (e == null ? void 0 : e.maxPixelRatio) || 2), n(this, l, new ne(e == null ? void 0 : e.webGLRendererParameters)), t(this, l).domElement.style.cssText = `
171
193
  position: ${(e == null ? void 0 : e.position) || "fixed"};
172
194
  left: 0;
173
195
  top: 0;
@@ -176,24 +198,24 @@ class we {
176
198
  z-index: ${(e == null ? void 0 : e.zIndex) || 0};
177
199
  `, (t(this, f).shadowRoot || t(this, f)).append(t(this, l).domElement), t(this, m).set(
178
200
  "default",
179
- new Q(this, "default", O({
201
+ new X(this, "default", F({
180
202
  sizeElement: t(this, f)
181
203
  }, e == null ? void 0 : e.view))
182
- ), e != null && e.composer && (h(this, d, new e.composer(t(this, l))), this.render = () => {
204
+ ), e != null && e.composer && (n(this, d, new e.composer(t(this, l))), this.render = () => {
183
205
  t(this, d).render();
184
- }), h(this, V, !0), Z.subscribe(t(this, P), ne.CANVAS), q.subscribe(t(this, A), {
185
- order: ce.CANVAS,
206
+ }), n(this, T, !0), q.subscribe(t(this, P), ce.CANVAS), J.subscribe(t(this, A), {
207
+ order: le.CANVAS,
186
208
  culling: t(this, f)
187
209
  });
188
210
  }
189
211
  destroy() {
190
212
  var e;
191
- t(this, V) && (Z.unsubscribe(t(this, P)), q.unsubscribe(t(this, A)), t(this, m).forEach((s) => {
213
+ t(this, T) && (q.unsubscribe(t(this, P)), J.unsubscribe(t(this, A)), t(this, m).forEach((s) => {
192
214
  s.destroy();
193
- }), t(this, m).clear(), t(this, l).dispose(), t(this, l).domElement.remove(), h(this, l, null), (e = t(this, d)) == null || e.dispose(), h(this, d, null), h(this, V, !1));
215
+ }), t(this, m).clear(), t(this, l).dispose(), t(this, l).domElement.remove(), n(this, l, null), (e = t(this, d)) == null || e.dispose(), n(this, d, null), n(this, T, !1));
194
216
  }
195
217
  createView(e, s) {
196
- const i = t(this, m).size, a = new Q(this, e, s);
218
+ const i = t(this, m).size, a = new X(this, e, s);
197
219
  return t(this, m).set(e, a), i === 1 && t(this, l).setScissorTest(!0), a;
198
220
  }
199
221
  getView(e) {
@@ -217,46 +239,46 @@ class we {
217
239
  (s = e.beforeRenderCallback) == null || s.call(e), t(this, l).render(e.scene, e.camera);
218
240
  }
219
241
  }
220
- k = new WeakMap(), f = new WeakMap(), l = new WeakMap(), m = new WeakMap(), w = new WeakMap(), R = new WeakMap(), z = new WeakMap(), D = new WeakMap(), V = new WeakMap(), d = new WeakMap(), P = new WeakMap(), A = new WeakMap();
221
- function Re(r, e, s) {
242
+ I = new WeakMap(), f = new WeakMap(), l = new WeakMap(), m = new WeakMap(), z = new WeakMap(), V = new WeakMap(), C = new WeakMap(), v = new WeakMap(), T = new WeakMap(), d = new WeakMap(), P = new WeakMap(), A = new WeakMap();
243
+ function Ce(r, e, s) {
222
244
  const i = e.x, a = e.y, y = s || r.image.width / r.image.height;
223
- let C = 0, E = 0, I = r.offset.x, v = r.offset.y, L = r.rotation, Y = r.center.x, j = r.center.y;
224
- i / a > y ? (C = 1, E = a / i * y) : (E = 1, C = i / a / y), r.matrix.setUvTransform(I, v, C, E, L, Y, j);
245
+ let M = 0, E = 0, O = r.offset.x, L = r.offset.y, k = r.rotation, j = r.center.x, p = r.center.y;
246
+ i / a > y ? (M = 1, E = a / i * y) : (E = 1, M = i / a / y), r.matrix.setUvTransform(O, L, M, E, k, j, p);
225
247
  }
226
- const F = new $(), me = new $();
227
- function ze(r, e, s = "default") {
228
- const i = r.getView(s), { width: a, height: y } = r, C = a / y;
229
- e instanceof $ ? F.copy(e) : F.set(...e);
230
- const E = i.camera.getWorldPosition(me).distanceTo(F);
231
- if (i.camera instanceof H)
248
+ const H = new W(), de = new W();
249
+ function Te(r, e, s = "default") {
250
+ const i = r.getView(s), { width: a, height: y } = r, M = a / y;
251
+ e instanceof W ? H.copy(e) : H.set(...e);
252
+ const E = i.camera.getWorldPosition(de).distanceTo(H);
253
+ if (i.camera instanceof N)
232
254
  return {
233
255
  width: a / i.camera.zoom,
234
256
  height: y / i.camera.zoom,
235
257
  factor: 1,
236
258
  distance: E,
237
- aspect: C
259
+ aspect: M
238
260
  };
239
261
  {
240
- const I = i.camera.fov * Math.PI / 180, v = 2 * Math.tan(I / 2) * E, L = v * (a / y);
241
- return { width: L, height: v, factor: a / L, distance: E, aspect: C };
262
+ const O = i.camera.fov * Math.PI / 180, L = 2 * Math.tan(O / 2) * E, k = L * (a / y);
263
+ return { width: k, height: L, factor: a / k, distance: E, aspect: M };
242
264
  }
243
265
  }
244
- function Ve(r, e) {
266
+ function Me(r, e) {
245
267
  r.traverse((s) => {
246
- s instanceof N && s.material && (Array.isArray(s.material) ? s.material : [s.material]).forEach(e);
268
+ s instanceof $ && s.material && (Array.isArray(s.material) ? s.material : [s.material]).forEach(e);
247
269
  });
248
270
  }
249
- function Ce(r, e) {
271
+ function Se(r, e) {
250
272
  r.traverse((s) => {
251
- s instanceof N && e(s);
273
+ s instanceof $ && e(s);
252
274
  });
253
275
  }
254
276
  export {
255
- we as En3,
256
- Q as En3View,
257
- Re as coverTexture,
258
- le as dispose,
259
- ze as getCurrentViewport,
260
- Ve as traverseMaterials,
261
- Ce as traverseMeshes
277
+ Ve as En3,
278
+ X as En3View,
279
+ Ce as coverTexture,
280
+ fe as dispose,
281
+ Te as getCurrentViewport,
282
+ Me as traverseMaterials,
283
+ Se as traverseMeshes
262
284
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aptechka",
3
- "version": "0.76.3",
3
+ "version": "0.76.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/denisavitski/aptechka.git"