aptechka 0.64.2 → 0.64.3
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 +1 -1
- package/lib/en3/index.js +4 -3
- package/package.json +1 -1
package/lib/en3/index.cjs
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
width: 100%;
|
|
6
6
|
height: 100%;
|
|
7
7
|
z-index: ${(e==null?void 0:e.zIndex)||0};
|
|
8
|
-
`,(t(this,b).shadowRoot||t(this,b)).append(t(this,l).domElement),t(this,g).set("default",new X("default",k({sizeElement:t(this,b)},e==null?void 0:e.view))),a(this,j,new ye),e!=null&&e.composer&&(a(this,x,new e.composer(t(this,l))),this.render=()=>{t(this,x).render()}),a(this,S,!0),re.windowResizer.subscribe(t(this,Y),ie.RESIZE_ORDER.CANVAS),se.ticker.subscribe(t(this,G),{order:ie.TICK_ORDER.CANVAS})}destroy(){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,g).forEach(
|
|
8
|
+
`,(t(this,b).shadowRoot||t(this,b)).append(t(this,l).domElement),t(this,g).set("default",new X("default",k({sizeElement:t(this,b)},e==null?void 0:e.view))),a(this,j,new ye),e!=null&&e.composer&&(a(this,x,new e.composer(t(this,l))),this.render=()=>{t(this,x).render()}),a(this,S,!0),re.windowResizer.subscribe(t(this,Y),ie.RESIZE_ORDER.CANVAS),se.ticker.subscribe(t(this,G),{order:ie.TICK_ORDER.CANVAS})}destroy(){var e;if(!t(this,S)){console.warn("[en3.setup]: You are trying to destory en3 but it has not been initialized.");return}re.windowResizer.unsubscribe(t(this,Y)),se.ticker.unsubscribe(t(this,G)),t(this,j).destroy(),t(this,g).forEach(i=>{i.destroy()}),t(this,l).dispose(),t(this,l).domElement.remove(),a(this,l,null),(e=t(this,x))==null||e.dispose(),a(this,x,null),a(this,S,!1)}createView(e,i){const n=t(this,g).size,h=new X(e,i);return t(this,g).set(e,h),n===1&&t(this,l).setScissorTest(!0),h}getView(e){return t(this,g).get(e)}destroyView(e){const i=t(this,g).get(e);i&&(t(this,g).delete(e),i.destroy(),t(this,g).size<=1&&t(this,l).setScissorTest(!1))}render(e){var i;if(t(this,g).size>1||this.view.isClipped){const n=e.box.left+e.box.CSSTranslation.x+e.box.scrollValue.x,h=d.height-e.box.height-e.box.top+e.box.CSSTranslation.y+e.box.scrollValue.y*-1;t(this,l).setScissor(n,h,e.box.width,e.box.height),t(this,l).setViewport(n,h,e.box.width,e.box.height)}(i=e.beforeRenderCallback)==null||i.call(e),t(this,l).render(e.scene,e.camera)}}U=new WeakMap,b=new WeakMap,l=new WeakMap,j=new WeakMap,g=new WeakMap,M=new WeakMap,T=new WeakMap,L=new WeakMap,W=new WeakMap,S=new WeakMap,x=new WeakMap,Y=new WeakMap,G=new WeakMap;const d=new Ee;function be(r,e,i){const n=e.x,h=e.y,V=i||r.image.width/r.image.height;let y=0,p=0,c=r.offset.x,f=r.offset.y,ce=r.rotation,oe=r.center.x,le=r.center.y;n/h>V?(y=1,p=h/n*V):(p=1,y=n/h/V),r.matrix.setUvTransform(c,f,y,p,ce,oe,le)}const K=new u.Vector3,we=new u.Vector3;function pe(r,e="default"){const i=d.getView(e),{width:n,height:h}=d,V=n/h;r instanceof u.Vector3?K.copy(r):K.set(...r);const y=i.camera.getWorldPosition(we).distanceTo(K);if(i.camera instanceof u.OrthographicCamera)return{width:n/i.camera.zoom,height:h/i.camera.zoom,factor:1,distance:y,aspect:V};{const p=i.camera.fov*Math.PI/180,c=2*Math.tan(p/2)*y,f=c*(n/h);return{width:f,height:c,factor:n/f,distance:y,aspect:V}}}function ve(r,e){r.traverse(i=>{i instanceof u.Mesh&&i.material&&(Array.isArray(i.material)?i.material:[i.material]).forEach(e)})}function De(r,e){r.traverse(i=>{i instanceof u.Mesh&&e(i)})}exports.En3View=X;exports.coverTexture=be;exports.dispose=he;exports.en3=d;exports.getCurrentViewport=pe;exports.traverseMaterials=ve;exports.traverseMeshes=De;
|
package/lib/en3/index.js
CHANGED
|
@@ -294,15 +294,16 @@ class Le {
|
|
|
294
294
|
}), h(this, M, !0), re.subscribe(t(this, B), De.CANVAS), he.subscribe(t(this, G), { order: Re.CANVAS });
|
|
295
295
|
}
|
|
296
296
|
destroy() {
|
|
297
|
+
var e;
|
|
297
298
|
if (!t(this, M)) {
|
|
298
299
|
console.warn(
|
|
299
300
|
"[en3.setup]: You are trying to destory en3 but it has not been initialized."
|
|
300
301
|
);
|
|
301
302
|
return;
|
|
302
303
|
}
|
|
303
|
-
re.unsubscribe(t(this, B)), he.unsubscribe(t(this, G)), t(this, O).destroy(), t(this, f).forEach((
|
|
304
|
-
|
|
305
|
-
}), t(this, l).dispose(), t(this, l).domElement.remove(), h(this, l, null), t(this, g).dispose(), h(this, g, null), h(this, M, !1);
|
|
304
|
+
re.unsubscribe(t(this, B)), he.unsubscribe(t(this, G)), t(this, O).destroy(), t(this, f).forEach((i) => {
|
|
305
|
+
i.destroy();
|
|
306
|
+
}), t(this, l).dispose(), t(this, l).domElement.remove(), h(this, l, null), (e = t(this, g)) == null || e.dispose(), h(this, g, null), h(this, M, !1);
|
|
306
307
|
}
|
|
307
308
|
createView(e, i) {
|
|
308
309
|
const a = t(this, f).size, n = new ne(e, i);
|