aptechka 0.76.3 → 0.76.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.
@@ -28,6 +28,8 @@ 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;
31
33
  get sizeElement(): HTMLElement;
32
34
  get isClipped(): boolean;
33
35
  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 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 v,S,c,R,g,o,x,w,y;class F{constructor(e,r,s){n(this,v);n(this,S);n(this,c);n(this,R);n(this,g);n(this,o);n(this,x);n(this,w);n(this,y);h(this,v,e),h(this,S,r),h(this,c,(s==null?void 0:s.cameraType)==="orthographic"?new d.OrthographicCamera:new d.PerspectiveCamera),h(this,R,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,x,(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,w,J.getElement(s==null?void 0:s.sizeElement)||document.documentElement),this.beforeRenderCallback=s==null?void 0:s.beforeRender,h(this,y,new Z.LayoutBox(t(this,w))),t(this,y).onResize(()=>{this.resize()})}get name(){return t(this,S)}get camera(){return t(this,c)}get scene(){return t(this,R)}get box(){return t(this,y)}get cameraDistance(){return t(this,o)}set cameraDistance(e){h(this,o,e),this.resize()}set fov(e){h(this,x,e),this.resize()}get fov(){return t(this,x)}get sizeElement(){return t(this,w)}get isClipped(){return t(this,w)!==t(this,v).containerElement}resize(){const{width:e,height:r}=t(this,y);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,x)==="auto"?2*Math.atan(r/2/t(this,o))*(180/Math.PI):t(this,c).userData.controlled?t(this,c).fov:t(this,x)):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,R).clear(),Q(t(this,R)),t(this,v).destroyView(this.name),t(this,y).destroy()}attachToHTMLElement(e,r,s){const a=new Z.LayoutBox(e,B(I({},s),{containerElement:t(this,w),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)}}v=new WeakMap,S=new WeakMap,c=new WeakMap,R=new WeakMap,g=new WeakMap,o=new WeakMap,x=new WeakMap,w=new WeakMap,y=new WeakMap;var k,u,l,m,z,V,C,D,M,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,z,0);n(this,V,0);n(this,C,0);n(this,D,2);n(this,M,!1);n(this,f,null);n(this,P,e=>{e instanceof CustomEvent||(h(this,z,t(this,u).clientWidth),h(this,V,t(this,u).clientHeight),h(this,C,Math.min(t(this,D),devicePixelRatio||1)),t(this,l).setPixelRatio(t(this,C)),t(this,l).setSize(t(this,z),t(this,V)),t(this,f)&&(t(this,f).setPixelRatio(t(this,C)),t(this,f).setSize(t(this,z),t(this,V))))});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,z)}get height(){return t(this,V)}get pixelRatio(){return t(this,C)}get composer(){return t(this,f)}setup(e){if(t(this,M))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=`
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,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,M,!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,M)&&(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,M,!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,z=new WeakMap,V=new WeakMap,C=new WeakMap,D=new WeakMap,M=new WeakMap,f=new WeakMap,P=new WeakMap,A=new WeakMap;function ie(i,e,r){const s=e.x,a=e.y,E=r||i.image.width/i.image.height;let T=0,b=0,q=i.offset.x,L=i.offset.y,O=i.rotation,X=i.center.x,Y=i.center.y;s/a>E?(T=1,b=a/s*E):(b=1,T=s/a/E),i.matrix.setUvTransform(q,L,T,b,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:E}=i,T=a/E;e instanceof d.Vector3?_.copy(e):_.set(...e);const b=s.camera.getWorldPosition(ae).distanceTo(_);if(s.camera instanceof d.OrthographicCamera)return{width:a/s.camera.zoom,height:E/s.camera.zoom,factor:1,distance:b,aspect:T};{const q=s.camera.fov*Math.PI/180,L=2*Math.tan(q/2)*b,O=L*(a/E);return{width:O,height:L,factor:a/O,distance:b,aspect:T}}}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;
package/lib/en3/index.js CHANGED
@@ -14,8 +14,8 @@ var _ = (r, e, s) => e in r ? p(r, e, { enumerable: !0, configurable: !0, writab
14
14
  return r;
15
15
  }, B = (r, e) => ee(r, te(e));
16
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";
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), a = (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 he, WebGLRenderer as ae, Vector3 as $ } from "three";
19
19
  import { RESIZE_ORDER as ne, TICK_ORDER as ce } from "../order/index.js";
20
20
  import { windowResizer as Z } from "../window-resizer/index.js";
21
21
  import { ticker as q } from "../ticker/index.js";
@@ -27,8 +27,8 @@ function le(r) {
27
27
  const e = (s) => {
28
28
  s.dispose();
29
29
  for (const i of Object.keys(s)) {
30
- const a = s[i];
31
- a && typeof a == "object" && "minFilter" in a && a.dispose();
30
+ const h = s[i];
31
+ h && typeof h == "object" && "minFilter" in h && h.dispose();
32
32
  }
33
33
  };
34
34
  r.traverse((s) => {
@@ -40,92 +40,98 @@ function le(r) {
40
40
  }
41
41
  });
42
42
  }
43
- var T, M, c, b, o, u, S, g, x;
43
+ var M, S, c, w, o, u, g, x, y;
44
44
  class Q {
45
45
  constructor(e, s, i) {
46
- n(this, T);
47
46
  n(this, M);
47
+ n(this, S);
48
48
  n(this, c);
49
- n(this, b);
49
+ n(this, w);
50
50
  n(this, o);
51
51
  n(this, u);
52
- n(this, S);
53
52
  n(this, g);
54
53
  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(() => {
54
+ n(this, y);
55
+ a(this, M, e), a(this, S, s), a(this, c, (i == null ? void 0 : i.cameraType) === "orthographic" ? new H() : new U()), a(this, w, new re()), a(this, o, []), a(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, a(this, g, (i == null ? void 0 : i.cameraFov) || "auto"), t(this, c).position.z = t(this, u), t(this, c).name = `Cameras.${t(this, S)}`, a(this, x, X(i == null ? void 0 : i.sizeElement) || document.documentElement), this.beforeRenderCallback = i == null ? void 0 : i.beforeRender, a(this, y, new J(t(this, x))), t(this, y).onResize(() => {
56
56
  this.resize();
57
57
  });
58
58
  }
59
59
  get name() {
60
- return t(this, M);
60
+ return t(this, S);
61
61
  }
62
62
  get camera() {
63
63
  return t(this, c);
64
64
  }
65
65
  get scene() {
66
- return t(this, b);
66
+ return t(this, w);
67
67
  }
68
68
  get box() {
69
- return t(this, x);
69
+ return t(this, y);
70
70
  }
71
71
  get cameraDistance() {
72
72
  return t(this, u);
73
73
  }
74
74
  set cameraDistance(e) {
75
- h(this, u, e), this.resize();
75
+ a(this, u, e), this.resize();
76
76
  }
77
- get sizeElement() {
77
+ set fov(e) {
78
+ a(this, g, e), this.resize();
79
+ }
80
+ get fov() {
78
81
  return t(this, g);
79
82
  }
83
+ get sizeElement() {
84
+ return t(this, x);
85
+ }
80
86
  get isClipped() {
81
- return t(this, g) !== t(this, T).containerElement;
87
+ return t(this, x) !== t(this, M).containerElement;
82
88
  }
83
89
  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();
90
+ const { width: e, height: s } = t(this, y);
91
+ 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, g) === "auto" ? 2 * Math.atan(s / 2 / t(this, u)) * (180 / Math.PI) : t(this, c).userData.controlled ? t(this, c).fov : t(this, g)) : 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();
86
92
  }
87
93
  destroy() {
88
94
  t(this, o).forEach((e) => {
89
95
  e.userData.box.destroy();
90
- }), t(this, b).clear(), le(t(this, b)), t(this, T).destroyView(this.name), t(this, x).destroy();
96
+ }), t(this, w).clear(), le(t(this, w)), t(this, M).destroyView(this.name), t(this, y).destroy();
91
97
  }
92
98
  attachToHTMLElement(e, s, i) {
93
- const a = new J(e, B(O({}, i), {
94
- containerElement: t(this, g),
99
+ const h = new J(e, B(O({}, i), {
100
+ containerElement: t(this, x),
95
101
  cartesian: !0,
96
102
  scrollStep: !this.isClipped
97
103
  }));
98
- return a.bindObject(s), s.userData.box = a, t(this, o).push(s), s;
104
+ return h.bindObject(s), s.userData.box = h, t(this, o).push(s), s;
99
105
  }
100
106
  detachFromHTMLElement(e) {
101
- h(this, o, t(this, o).filter((s) => s === e ? (e.userData.box.destroy(), !1) : !0));
107
+ a(this, o, t(this, o).filter((s) => s === e ? (e.userData.box.destroy(), !1) : !0));
102
108
  }
103
109
  add(...e) {
104
- const s = e[0], i = e[1], a = e[2];
105
- return i && this.attachToHTMLElement(i, s, a), this.scene.add(s), s;
110
+ const s = e[0], i = e[1], h = e[2];
111
+ return i && this.attachToHTMLElement(i, s, h), this.scene.add(s), s;
106
112
  }
107
113
  remove(e, s) {
108
114
  this.scene.remove(e), s && this.detachFromHTMLElement(e);
109
115
  }
110
116
  }
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;
117
+ M = new WeakMap(), S = new WeakMap(), c = new WeakMap(), w = new WeakMap(), o = new WeakMap(), u = new WeakMap(), g = new WeakMap(), x = new WeakMap(), y = new WeakMap();
118
+ var k, f, l, m, R, z, V, D, C, d, v, P;
113
119
  class we {
114
120
  constructor() {
115
- n(this, k, `https://unpkg.com/three@0.${ae}.x`);
121
+ n(this, k, `https://unpkg.com/three@0.${he}.x`);
116
122
  n(this, f, null);
117
123
  n(this, l, null);
118
124
  n(this, m, /* @__PURE__ */ new Map());
119
- n(this, w, 0);
120
125
  n(this, R, 0);
121
126
  n(this, z, 0);
127
+ n(this, V, 0);
122
128
  n(this, D, 2);
123
- n(this, V, !1);
129
+ n(this, C, !1);
124
130
  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))));
131
+ n(this, v, (e) => {
132
+ e instanceof CustomEvent || (a(this, R, t(this, f).clientWidth), a(this, z, t(this, f).clientHeight), a(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, d) && (t(this, d).setPixelRatio(t(this, V)), t(this, d).setSize(t(this, R), t(this, z))));
127
133
  });
128
- n(this, A, () => {
134
+ n(this, P, () => {
129
135
  t(this, l).setRenderTarget(null), t(this, m).forEach((e) => {
130
136
  this.render(e);
131
137
  });
@@ -153,21 +159,21 @@ class we {
153
159
  return this.getView("default").scene;
154
160
  }
155
161
  get width() {
156
- return t(this, w);
162
+ return t(this, R);
157
163
  }
158
164
  get height() {
159
- return t(this, R);
165
+ return t(this, z);
160
166
  }
161
167
  get pixelRatio() {
162
- return t(this, z);
168
+ return t(this, V);
163
169
  }
164
170
  get composer() {
165
171
  return t(this, d);
166
172
  }
167
173
  setup(e) {
168
- if (t(this, V))
174
+ if (t(this, C))
169
175
  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 = `
176
+ a(this, f, X(e == null ? void 0 : e.containerElement) || document.body), a(this, D, (e == null ? void 0 : e.maxPixelRatio) || 2), a(this, l, new ae(e == null ? void 0 : e.webGLRendererParameters)), t(this, l).domElement.style.cssText = `
171
177
  position: ${(e == null ? void 0 : e.position) || "fixed"};
172
178
  left: 0;
173
179
  top: 0;
@@ -179,22 +185,22 @@ class we {
179
185
  new Q(this, "default", O({
180
186
  sizeElement: t(this, f)
181
187
  }, e == null ? void 0 : e.view))
182
- ), e != null && e.composer && (h(this, d, new e.composer(t(this, l))), this.render = () => {
188
+ ), e != null && e.composer && (a(this, d, new e.composer(t(this, l))), this.render = () => {
183
189
  t(this, d).render();
184
- }), h(this, V, !0), Z.subscribe(t(this, P), ne.CANVAS), q.subscribe(t(this, A), {
190
+ }), a(this, C, !0), Z.subscribe(t(this, v), ne.CANVAS), q.subscribe(t(this, P), {
185
191
  order: ce.CANVAS,
186
192
  culling: t(this, f)
187
193
  });
188
194
  }
189
195
  destroy() {
190
196
  var e;
191
- t(this, V) && (Z.unsubscribe(t(this, P)), q.unsubscribe(t(this, A)), t(this, m).forEach((s) => {
197
+ t(this, C) && (Z.unsubscribe(t(this, v)), q.unsubscribe(t(this, P)), t(this, m).forEach((s) => {
192
198
  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));
199
+ }), t(this, m).clear(), t(this, l).dispose(), t(this, l).domElement.remove(), a(this, l, null), (e = t(this, d)) == null || e.dispose(), a(this, d, null), a(this, C, !1));
194
200
  }
195
201
  createView(e, s) {
196
- const i = t(this, m).size, a = new Q(this, e, s);
197
- return t(this, m).set(e, a), i === 1 && t(this, l).setScissorTest(!0), a;
202
+ const i = t(this, m).size, h = new Q(this, e, s);
203
+ return t(this, m).set(e, h), i === 1 && t(this, l).setScissorTest(!0), h;
198
204
  }
199
205
  getView(e) {
200
206
  return t(this, m).get(e);
@@ -206,10 +212,10 @@ class we {
206
212
  render(e) {
207
213
  var s;
208
214
  if (t(this, m).size > 1 || this.view.isClipped) {
209
- const i = 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;
210
- t(this, l).setScissor(i, a, e.box.width, e.box.height), t(this, l).setViewport(
215
+ const i = 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;
216
+ t(this, l).setScissor(i, h, e.box.width, e.box.height), t(this, l).setViewport(
211
217
  i,
212
- a,
218
+ h,
213
219
  e.box.width,
214
220
  e.box.height
215
221
  );
@@ -217,28 +223,28 @@ class we {
217
223
  (s = e.beforeRenderCallback) == null || s.call(e), t(this, l).render(e.scene, e.camera);
218
224
  }
219
225
  }
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();
226
+ k = new WeakMap(), f = new WeakMap(), l = new WeakMap(), m = new WeakMap(), R = new WeakMap(), z = new WeakMap(), V = new WeakMap(), D = new WeakMap(), C = new WeakMap(), d = new WeakMap(), v = new WeakMap(), P = new WeakMap();
221
227
  function Re(r, e, s) {
222
- 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);
228
+ const i = e.x, h = e.y, E = s || r.image.width / r.image.height;
229
+ let T = 0, b = 0, I = r.offset.x, A = r.offset.y, L = r.rotation, Y = r.center.x, j = r.center.y;
230
+ i / h > E ? (T = 1, b = h / i * E) : (b = 1, T = i / h / E), r.matrix.setUvTransform(I, A, T, b, L, Y, j);
225
231
  }
226
232
  const F = new $(), me = new $();
227
233
  function ze(r, e, s = "default") {
228
- const i = r.getView(s), { width: a, height: y } = r, C = a / y;
234
+ const i = r.getView(s), { width: h, height: E } = r, T = h / E;
229
235
  e instanceof $ ? F.copy(e) : F.set(...e);
230
- const E = i.camera.getWorldPosition(me).distanceTo(F);
236
+ const b = i.camera.getWorldPosition(me).distanceTo(F);
231
237
  if (i.camera instanceof H)
232
238
  return {
233
- width: a / i.camera.zoom,
234
- height: y / i.camera.zoom,
239
+ width: h / i.camera.zoom,
240
+ height: E / i.camera.zoom,
235
241
  factor: 1,
236
- distance: E,
237
- aspect: C
242
+ distance: b,
243
+ aspect: T
238
244
  };
239
245
  {
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 };
246
+ const I = i.camera.fov * Math.PI / 180, A = 2 * Math.tan(I / 2) * b, L = A * (h / E);
247
+ return { width: L, height: A, factor: h / L, distance: b, aspect: T };
242
248
  }
243
249
  }
244
250
  function Ve(r, e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aptechka",
3
- "version": "0.76.3",
3
+ "version": "0.76.4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/denisavitski/aptechka.git"