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.
- package/lib/en3/En3View.d.ts +2 -0
- package/lib/en3/index.cjs +2 -2
- package/lib/en3/index.js +64 -58
- package/package.json +1 -1
package/lib/en3/En3View.d.ts
CHANGED
|
@@ -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
|
|
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,
|
|
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),
|
|
18
|
-
import { Mesh as N, OrthographicCamera as H, PerspectiveCamera as U, Scene as re, REVISION as
|
|
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
|
|
31
|
-
|
|
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
|
|
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,
|
|
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
|
-
|
|
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,
|
|
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,
|
|
66
|
+
return t(this, w);
|
|
67
67
|
}
|
|
68
68
|
get box() {
|
|
69
|
-
return t(this,
|
|
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
|
-
|
|
75
|
+
a(this, u, e), this.resize();
|
|
76
76
|
}
|
|
77
|
-
|
|
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,
|
|
87
|
+
return t(this, x) !== t(this, M).containerElement;
|
|
82
88
|
}
|
|
83
89
|
resize() {
|
|
84
|
-
const { width: e, height: s } = t(this,
|
|
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,
|
|
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,
|
|
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
|
|
94
|
-
containerElement: t(this,
|
|
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
|
|
104
|
+
return h.bindObject(s), s.userData.box = h, t(this, o).push(s), s;
|
|
99
105
|
}
|
|
100
106
|
detachFromHTMLElement(e) {
|
|
101
|
-
|
|
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],
|
|
105
|
-
return i && this.attachToHTMLElement(i, 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
|
-
|
|
112
|
-
var k, f, l, m,
|
|
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.${
|
|
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,
|
|
129
|
+
n(this, C, !1);
|
|
124
130
|
n(this, d, null);
|
|
125
|
-
n(this,
|
|
126
|
-
e instanceof CustomEvent || (
|
|
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,
|
|
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,
|
|
162
|
+
return t(this, R);
|
|
157
163
|
}
|
|
158
164
|
get height() {
|
|
159
|
-
return t(this,
|
|
165
|
+
return t(this, z);
|
|
160
166
|
}
|
|
161
167
|
get pixelRatio() {
|
|
162
|
-
return t(this,
|
|
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,
|
|
174
|
+
if (t(this, C))
|
|
169
175
|
return;
|
|
170
|
-
|
|
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 && (
|
|
188
|
+
), e != null && e.composer && (a(this, d, new e.composer(t(this, l))), this.render = () => {
|
|
183
189
|
t(this, d).render();
|
|
184
|
-
}),
|
|
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,
|
|
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(),
|
|
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,
|
|
197
|
-
return t(this, m).set(e,
|
|
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,
|
|
210
|
-
t(this, l).setScissor(i,
|
|
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
|
-
|
|
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(),
|
|
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,
|
|
223
|
-
let
|
|
224
|
-
i /
|
|
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:
|
|
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
|
|
236
|
+
const b = i.camera.getWorldPosition(me).distanceTo(F);
|
|
231
237
|
if (i.camera instanceof H)
|
|
232
238
|
return {
|
|
233
|
-
width:
|
|
234
|
-
height:
|
|
239
|
+
width: h / i.camera.zoom,
|
|
240
|
+
height: E / i.camera.zoom,
|
|
235
241
|
factor: 1,
|
|
236
|
-
distance:
|
|
237
|
-
aspect:
|
|
242
|
+
distance: b,
|
|
243
|
+
aspect: T
|
|
238
244
|
};
|
|
239
245
|
{
|
|
240
|
-
const I = i.camera.fov * Math.PI / 180,
|
|
241
|
-
return { width: L, height:
|
|
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) {
|