aptechka 0.86.0 → 0.86.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/en3/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
- "use strict";var __defProp=Object.defineProperty,__defProps=Object.defineProperties;var __getOwnPropDescs=Object.getOwnPropertyDescriptors;var __getOwnPropSymbols=Object.getOwnPropertySymbols;var __hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable;var __typeError=msg=>{throw TypeError(msg)};var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,__spreadValues=(a,b)=>{for(var prop in b||(b={}))__hasOwnProp.call(b,prop)&&__defNormalProp(a,prop,b[prop]);if(__getOwnPropSymbols)for(var prop of __getOwnPropSymbols(b))__propIsEnum.call(b,prop)&&__defNormalProp(a,prop,b[prop]);return a},__spreadProps=(a,b)=>__defProps(a,__getOwnPropDescs(b)),__name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __accessCheck=(obj,member,msg)=>member.has(obj)||__typeError("Cannot "+msg);var __privateGet=(obj,member,getter)=>(__accessCheck(obj,member,"read from private field"),getter?getter.call(obj):member.get(obj)),__privateAdd=(obj,member,value)=>member.has(obj)?__typeError("Cannot add the same private member more than once"):member instanceof WeakSet?member.add(obj):member.set(obj,value),__privateSet=(obj,member,value,setter)=>(__accessCheck(obj,member,"write to private field"),setter?setter.call(obj,value):member.set(obj,value),value);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const order_index=require("../order/index.cjs"),intersector_index=require("../index-DZ44osDT.cjs"),dom=require("../dom-B40i6NXw.cjs");require("construct-style-sheets-polyfill");const windowResizer_index=require("../window-resizer/index.cjs"),three=require("three"),layoutBox_index=require("../layout-box/index.cjs"),_function=require("../function-H4b_gTg6.cjs");var _layoutBox,_planes,_tickListener;const _En3Clip=class _En3Clip{constructor(material,elementOrSelector){__privateAdd(this,_layoutBox,null);__privateAdd(this,_planes,[]);__privateAdd(this,_tickListener,__name(()=>{const scrollValueX=__privateGet(this,_layoutBox).position.x-__privateGet(this,_layoutBox).left,scrollValueY=__privateGet(this,_layoutBox).position.y-__privateGet(this,_layoutBox).top;__privateGet(this,_planes)[0].constant=__privateGet(this,_layoutBox).scale.y/2+scrollValueY*-1,__privateGet(this,_planes)[1].constant=__privateGet(this,_layoutBox).scale.y/2+scrollValueY,__privateGet(this,_planes)[2].constant=__privateGet(this,_layoutBox).scale.x/2+scrollValueX,__privateGet(this,_planes)[3].constant=__privateGet(this,_layoutBox).scale.x/2+scrollValueX*-1},"#tickListener"));__privateSet(this,_layoutBox,new layoutBox_index.LayoutBox(elementOrSelector,{cartesian:!1})),__privateSet(this,_planes,[new three.Plane(new three.Vector3(0,-1,0)),new three.Plane(new three.Vector3(0,1,0)),new three.Plane(new three.Vector3(-1,0,0)),new three.Plane(new three.Vector3(1,0,0))]),material.clippingPlanes=__privateGet(this,_planes),intersector_index.ticker.subscribe(__privateGet(this,_tickListener),{order:order_index.TICK_ORDER.LAYOUT_BOX})}get planes(){return __privateGet(this,_planes)}get layoutBox(){return __privateGet(this,_layoutBox)}destroy(){intersector_index.ticker.unsubscribe(__privateGet(this,_tickListener)),__privateGet(this,_layoutBox).destroy()}};_layoutBox=new WeakMap,_planes=new WeakMap,_tickListener=new WeakMap,__name(_En3Clip,"En3Clip");let En3Clip=_En3Clip;function dispose(object3d){const cleanMaterial=__name(material=>{material.dispose();for(const key of Object.keys(material)){const value=material[key];value&&typeof value=="object"&&"minFilter"in value&&value.dispose()}},"cleanMaterial");object3d.traverse(object=>{if(object instanceof three.Mesh){if(object.geometry.dispose(),!Array.isArray(object.material)&&object.material.isMaterial)cleanMaterial(object.material);else if(Array.isArray(object.material))for(const material of object.material)cleanMaterial(material)}})}__name(dispose,"dispose");var _en3,_name,_camera,_scene,_attachedObjects,_cameraDistance,_cameraFov,_sizeElement,_box,_debouncedResize;const _En3View=class _En3View{constructor(en3,name,options){__privateAdd(this,_en3);__privateAdd(this,_name);__privateAdd(this,_camera);__privateAdd(this,_scene);__privateAdd(this,_attachedObjects);__privateAdd(this,_cameraDistance);__privateAdd(this,_cameraFov);__privateAdd(this,_sizeElement);__privateAdd(this,_box);__privateAdd(this,_debouncedResize,_function.debounce(()=>{this.resize()},0));__privateSet(this,_en3,en3),__privateSet(this,_name,name),__privateSet(this,_camera,(options==null?void 0:options.cameraType)==="orthographic"?new three.OrthographicCamera:new three.PerspectiveCamera),__privateSet(this,_scene,new three.Scene),__privateSet(this,_attachedObjects,[]),__privateSet(this,_cameraDistance,(options==null?void 0:options.cameraDistance)||1e3),__privateGet(this,_camera).near=(options==null?void 0:options.cameraNear)||1,__privateGet(this,_camera).far=(options==null?void 0:options.cameraFar)||11e3,__privateSet(this,_cameraFov,(options==null?void 0:options.cameraFov)||"auto"),__privateGet(this,_camera).position.z=__privateGet(this,_cameraDistance),__privateGet(this,_camera).name=`Cameras.${__privateGet(this,_name)}`,__privateSet(this,_sizeElement,dom.getElement(options==null?void 0:options.sizeElement)||document.documentElement),this.beforeRenderCallback=options==null?void 0:options.beforeRender,__privateSet(this,_box,new layoutBox_index.LayoutBox(__privateGet(this,_sizeElement))),__privateGet(this,_box).onResize(()=>{this.resize()})}get name(){return __privateGet(this,_name)}get camera(){return __privateGet(this,_camera)}get scene(){return __privateGet(this,_scene)}get box(){return __privateGet(this,_box)}get cameraDistance(){return __privateGet(this,_cameraDistance)}set cameraDistance(value){__privateSet(this,_cameraDistance,value),__privateGet(this,_debouncedResize).call(this)}set fov(value){__privateSet(this,_cameraFov,value),__privateGet(this,_debouncedResize).call(this)}get fov(){return __privateGet(this,_cameraFov)}set near(value){__privateGet(this,_camera).near=value,__privateGet(this,_debouncedResize).call(this)}get near(){return __privateGet(this,_camera).near}set far(value){__privateGet(this,_camera).far=value,__privateGet(this,_debouncedResize).call(this)}get far(){return __privateGet(this,_camera).far}get sizeElement(){return __privateGet(this,_sizeElement)}get isClipped(){return __privateGet(this,_sizeElement)!==__privateGet(this,_en3).containerElement}resize(){const{width,height}=__privateGet(this,_box);__privateGet(this,_camera).userData.controlled||(__privateGet(this,_camera).position.z=__privateGet(this,_cameraDistance)),__privateGet(this,_camera)instanceof three.PerspectiveCamera?(__privateGet(this,_camera).aspect=width/height,__privateGet(this,_camera).fov=__privateGet(this,_cameraFov)==="auto"?2*Math.atan(height/2/__privateGet(this,_cameraDistance))*(180/Math.PI):__privateGet(this,_camera).userData.controlled?__privateGet(this,_camera).fov:__privateGet(this,_cameraFov)):__privateGet(this,_camera)instanceof three.OrthographicCamera&&(__privateGet(this,_camera).left=width/-2,__privateGet(this,_camera).right=width/2,__privateGet(this,_camera).top=height/2,__privateGet(this,_camera).bottom=height/-2),__privateGet(this,_camera).updateProjectionMatrix()}destroy(){__privateGet(this,_attachedObjects).forEach(object=>{object.userData.box.destroy()}),__privateGet(this,_scene).clear(),dispose(__privateGet(this,_scene)),__privateGet(this,_en3).destroyView(this.name),__privateGet(this,_box).destroy()}attachToHTMLElement(element,object,options){const box=new layoutBox_index.LayoutBox(element,__spreadProps(__spreadValues({},options),{containerElement:__privateGet(this,_sizeElement),cartesian:!0,scrollStep:!this.isClipped}));if(box.bindObject(object),object.userData.box=box,options!=null&&options.clip&&"material"in object){const clip=new En3Clip(object.material,element);object.userData.clip=clip}return __privateGet(this,_attachedObjects).push(object),object}detachFromHTMLElement(object){__privateSet(this,_attachedObjects,__privateGet(this,_attachedObjects).filter(o=>{if(o===object){const{box,clip}=object.userData;return box.destroy(),clip==null||clip.destroy(),!1}return!0}))}add(...args){const object=args[0],element=args[1],options=args[2];return element&&this.attachToHTMLElement(element,object,options),this.scene.add(object),object}remove(object,detach){this.scene.remove(object),detach&&this.detachFromHTMLElement(object)}};_en3=new WeakMap,_name=new WeakMap,_camera=new WeakMap,_scene=new WeakMap,_attachedObjects=new WeakMap,_cameraDistance=new WeakMap,_cameraFov=new WeakMap,_sizeElement=new WeakMap,_box=new WeakMap,_debouncedResize=new WeakMap,__name(_En3View,"En3View");let En3View=_En3View;var _CDNVersion,_containerElement,_webglRenderer,_views,_width,_height,_pixelRatio,_maxPixelRatio,_isCreated,_composer,_resizeListener,_tickListener2;const _En3=class _En3{constructor(){__privateAdd(this,_CDNVersion,`https://unpkg.com/three@0.${three.REVISION}.x`);__privateAdd(this,_containerElement,null);__privateAdd(this,_webglRenderer,null);__privateAdd(this,_views,new Map);__privateAdd(this,_width,0);__privateAdd(this,_height,0);__privateAdd(this,_pixelRatio,0);__privateAdd(this,_maxPixelRatio,2);__privateAdd(this,_isCreated,!1);__privateAdd(this,_composer,null);__privateAdd(this,_resizeListener,__name(e=>{e instanceof CustomEvent||(__privateSet(this,_width,__privateGet(this,_containerElement).clientWidth),__privateSet(this,_height,__privateGet(this,_containerElement).clientHeight),__privateSet(this,_pixelRatio,Math.min(__privateGet(this,_maxPixelRatio),devicePixelRatio||1)),__privateGet(this,_webglRenderer).setPixelRatio(__privateGet(this,_pixelRatio)),__privateGet(this,_webglRenderer).setSize(__privateGet(this,_width),__privateGet(this,_height)),__privateGet(this,_composer)&&(__privateGet(this,_composer).setPixelRatio(__privateGet(this,_pixelRatio)),__privateGet(this,_composer).setSize(__privateGet(this,_width),__privateGet(this,_height))))},"#resizeListener"));__privateAdd(this,_tickListener2,__name(()=>{__privateGet(this,_webglRenderer).setRenderTarget(null),__privateGet(this,_views).forEach(view=>{this.render(view)})},"#tickListener"))}get CDNVersion(){return __privateGet(this,_CDNVersion)}get containerElement(){return __privateGet(this,_containerElement)}get webglRenderer(){return __privateGet(this,_webglRenderer)}get views(){return __privateGet(this,_views)}get view(){return this.getView("default")}get camera(){return this.getView("default").camera}get scene(){return this.getView("default").scene}get width(){return __privateGet(this,_width)}get height(){return __privateGet(this,_height)}get pixelRatio(){return __privateGet(this,_pixelRatio)}get composer(){return __privateGet(this,_composer)}setup(options){if(__privateGet(this,_isCreated))return;__privateSet(this,_containerElement,dom.getElement(options==null?void 0:options.containerElement)||document.body),__privateSet(this,_maxPixelRatio,(options==null?void 0:options.maxPixelRatio)||2),__privateSet(this,_webglRenderer,new three.WebGLRenderer(options==null?void 0:options.webGLRendererParameters)),__privateGet(this,_webglRenderer).domElement.style.cssText=`
1
+ "use strict";var __defProp=Object.defineProperty,__defProps=Object.defineProperties;var __getOwnPropDescs=Object.getOwnPropertyDescriptors;var __getOwnPropSymbols=Object.getOwnPropertySymbols;var __hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable;var __typeError=msg=>{throw TypeError(msg)};var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,__spreadValues=(a,b)=>{for(var prop in b||(b={}))__hasOwnProp.call(b,prop)&&__defNormalProp(a,prop,b[prop]);if(__getOwnPropSymbols)for(var prop of __getOwnPropSymbols(b))__propIsEnum.call(b,prop)&&__defNormalProp(a,prop,b[prop]);return a},__spreadProps=(a,b)=>__defProps(a,__getOwnPropDescs(b)),__name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __accessCheck=(obj,member,msg)=>member.has(obj)||__typeError("Cannot "+msg);var __privateGet=(obj,member,getter)=>(__accessCheck(obj,member,"read from private field"),getter?getter.call(obj):member.get(obj)),__privateAdd=(obj,member,value)=>member.has(obj)?__typeError("Cannot add the same private member more than once"):member instanceof WeakSet?member.add(obj):member.set(obj,value),__privateSet=(obj,member,value,setter)=>(__accessCheck(obj,member,"write to private field"),setter?setter.call(obj,value):member.set(obj,value),value);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const order_index=require("../order/index.cjs"),intersector_index=require("../index-DZ44osDT.cjs"),dom=require("../dom-B40i6NXw.cjs");require("construct-style-sheets-polyfill");const windowResizer_index=require("../window-resizer/index.cjs"),three=require("three"),layoutBox_index=require("../layout-box/index.cjs"),_function=require("../function-H4b_gTg6.cjs");var _layoutBox,_planes,_tickListener;const _En3Clip=class _En3Clip{constructor(material,elementOrSelector){__privateAdd(this,_layoutBox,null);__privateAdd(this,_planes,[]);__privateAdd(this,_tickListener,__name(()=>{const scrollValueX=__privateGet(this,_layoutBox).position.x,scrollValueY=__privateGet(this,_layoutBox).position.y;__privateGet(this,_planes)[0].constant=-scrollValueY+__privateGet(this,_layoutBox).scale.y/2,__privateGet(this,_planes)[1].constant=scrollValueY+__privateGet(this,_layoutBox).scale.y/2,__privateGet(this,_planes)[2].constant=scrollValueX+__privateGet(this,_layoutBox).scale.x/2,__privateGet(this,_planes)[3].constant=-scrollValueX+__privateGet(this,_layoutBox).scale.x/2},"#tickListener"));__privateSet(this,_layoutBox,new layoutBox_index.LayoutBox(elementOrSelector,{cartesian:!0})),__privateSet(this,_planes,[new three.Plane(new three.Vector3(0,1,0)),new three.Plane(new three.Vector3(0,-1,0)),new three.Plane(new three.Vector3(-1,0,0)),new three.Plane(new three.Vector3(1,0,0))]),material.clippingPlanes=__privateGet(this,_planes),intersector_index.ticker.subscribe(__privateGet(this,_tickListener),{order:order_index.TICK_ORDER.LAYOUT_BOX})}get planes(){return __privateGet(this,_planes)}get layoutBox(){return __privateGet(this,_layoutBox)}destroy(){intersector_index.ticker.unsubscribe(__privateGet(this,_tickListener)),__privateGet(this,_layoutBox).destroy()}};_layoutBox=new WeakMap,_planes=new WeakMap,_tickListener=new WeakMap,__name(_En3Clip,"En3Clip");let En3Clip=_En3Clip;function dispose(object3d){const cleanMaterial=__name(material=>{material.dispose();for(const key of Object.keys(material)){const value=material[key];value&&typeof value=="object"&&"minFilter"in value&&value.dispose()}},"cleanMaterial");object3d.traverse(object=>{if(object instanceof three.Mesh){if(object.geometry.dispose(),!Array.isArray(object.material)&&object.material.isMaterial)cleanMaterial(object.material);else if(Array.isArray(object.material))for(const material of object.material)cleanMaterial(material)}})}__name(dispose,"dispose");var _en3,_name,_camera,_scene,_attachedObjects,_cameraDistance,_cameraFov,_sizeElement,_box,_debouncedResize;const _En3View=class _En3View{constructor(en3,name,options){__privateAdd(this,_en3);__privateAdd(this,_name);__privateAdd(this,_camera);__privateAdd(this,_scene);__privateAdd(this,_attachedObjects);__privateAdd(this,_cameraDistance);__privateAdd(this,_cameraFov);__privateAdd(this,_sizeElement);__privateAdd(this,_box);__privateAdd(this,_debouncedResize,_function.debounce(()=>{this.resize()},0));__privateSet(this,_en3,en3),__privateSet(this,_name,name),__privateSet(this,_camera,(options==null?void 0:options.cameraType)==="orthographic"?new three.OrthographicCamera:new three.PerspectiveCamera),__privateSet(this,_scene,new three.Scene),__privateSet(this,_attachedObjects,[]),__privateSet(this,_cameraDistance,(options==null?void 0:options.cameraDistance)||1e3),__privateGet(this,_camera).near=(options==null?void 0:options.cameraNear)||1,__privateGet(this,_camera).far=(options==null?void 0:options.cameraFar)||11e3,__privateSet(this,_cameraFov,(options==null?void 0:options.cameraFov)||"auto"),__privateGet(this,_camera).position.z=__privateGet(this,_cameraDistance),__privateGet(this,_camera).name=`Cameras.${__privateGet(this,_name)}`,__privateSet(this,_sizeElement,dom.getElement(options==null?void 0:options.sizeElement)||document.documentElement),this.beforeRenderCallback=options==null?void 0:options.beforeRender,__privateSet(this,_box,new layoutBox_index.LayoutBox(__privateGet(this,_sizeElement))),__privateGet(this,_box).onResize(()=>{this.resize()})}get name(){return __privateGet(this,_name)}get camera(){return __privateGet(this,_camera)}get scene(){return __privateGet(this,_scene)}get box(){return __privateGet(this,_box)}get cameraDistance(){return __privateGet(this,_cameraDistance)}set cameraDistance(value){__privateSet(this,_cameraDistance,value),__privateGet(this,_debouncedResize).call(this)}set fov(value){__privateSet(this,_cameraFov,value),__privateGet(this,_debouncedResize).call(this)}get fov(){return __privateGet(this,_cameraFov)}set near(value){__privateGet(this,_camera).near=value,__privateGet(this,_debouncedResize).call(this)}get near(){return __privateGet(this,_camera).near}set far(value){__privateGet(this,_camera).far=value,__privateGet(this,_debouncedResize).call(this)}get far(){return __privateGet(this,_camera).far}get sizeElement(){return __privateGet(this,_sizeElement)}get isClipped(){return __privateGet(this,_sizeElement)!==__privateGet(this,_en3).containerElement}resize(){const{width,height}=__privateGet(this,_box);__privateGet(this,_camera).userData.controlled||(__privateGet(this,_camera).position.z=__privateGet(this,_cameraDistance)),__privateGet(this,_camera)instanceof three.PerspectiveCamera?(__privateGet(this,_camera).aspect=width/height,__privateGet(this,_camera).fov=__privateGet(this,_cameraFov)==="auto"?2*Math.atan(height/2/__privateGet(this,_cameraDistance))*(180/Math.PI):__privateGet(this,_camera).userData.controlled?__privateGet(this,_camera).fov:__privateGet(this,_cameraFov)):__privateGet(this,_camera)instanceof three.OrthographicCamera&&(__privateGet(this,_camera).left=width/-2,__privateGet(this,_camera).right=width/2,__privateGet(this,_camera).top=height/2,__privateGet(this,_camera).bottom=height/-2),__privateGet(this,_camera).updateProjectionMatrix()}destroy(){__privateGet(this,_attachedObjects).forEach(object=>{object.userData.box.destroy()}),__privateGet(this,_scene).clear(),dispose(__privateGet(this,_scene)),__privateGet(this,_en3).destroyView(this.name),__privateGet(this,_box).destroy()}attachToHTMLElement(element,object,options){const box=new layoutBox_index.LayoutBox(element,__spreadProps(__spreadValues({},options),{containerElement:__privateGet(this,_sizeElement),cartesian:!0,scrollStep:!this.isClipped}));if(box.bindObject(object),object.userData.box=box,options!=null&&options.clip&&"material"in object){const clip=new En3Clip(object.material,element);object.userData.clip=clip}return __privateGet(this,_attachedObjects).push(object),object}detachFromHTMLElement(object){__privateSet(this,_attachedObjects,__privateGet(this,_attachedObjects).filter(o=>{if(o===object){const{box,clip}=object.userData;return box.destroy(),clip==null||clip.destroy(),!1}return!0}))}add(...args){const object=args[0],element=args[1],options=args[2];return element&&this.attachToHTMLElement(element,object,options),this.scene.add(object),object}remove(object,detach){this.scene.remove(object),detach&&this.detachFromHTMLElement(object)}};_en3=new WeakMap,_name=new WeakMap,_camera=new WeakMap,_scene=new WeakMap,_attachedObjects=new WeakMap,_cameraDistance=new WeakMap,_cameraFov=new WeakMap,_sizeElement=new WeakMap,_box=new WeakMap,_debouncedResize=new WeakMap,__name(_En3View,"En3View");let En3View=_En3View;var _CDNVersion,_containerElement,_webglRenderer,_views,_width,_height,_pixelRatio,_maxPixelRatio,_isCreated,_composer,_resizeListener,_tickListener2;const _En3=class _En3{constructor(){__privateAdd(this,_CDNVersion,`https://unpkg.com/three@0.${three.REVISION}.x`);__privateAdd(this,_containerElement,null);__privateAdd(this,_webglRenderer,null);__privateAdd(this,_views,new Map);__privateAdd(this,_width,0);__privateAdd(this,_height,0);__privateAdd(this,_pixelRatio,0);__privateAdd(this,_maxPixelRatio,2);__privateAdd(this,_isCreated,!1);__privateAdd(this,_composer,null);__privateAdd(this,_resizeListener,__name(e=>{e instanceof CustomEvent||(__privateSet(this,_width,__privateGet(this,_containerElement).clientWidth),__privateSet(this,_height,__privateGet(this,_containerElement).clientHeight),__privateSet(this,_pixelRatio,Math.min(__privateGet(this,_maxPixelRatio),devicePixelRatio||1)),__privateGet(this,_webglRenderer).setPixelRatio(__privateGet(this,_pixelRatio)),__privateGet(this,_webglRenderer).setSize(__privateGet(this,_width),__privateGet(this,_height)),__privateGet(this,_composer)&&(__privateGet(this,_composer).setPixelRatio(__privateGet(this,_pixelRatio)),__privateGet(this,_composer).setSize(__privateGet(this,_width),__privateGet(this,_height))))},"#resizeListener"));__privateAdd(this,_tickListener2,__name(()=>{__privateGet(this,_webglRenderer).setRenderTarget(null),__privateGet(this,_views).forEach(view=>{this.render(view)})},"#tickListener"))}get CDNVersion(){return __privateGet(this,_CDNVersion)}get containerElement(){return __privateGet(this,_containerElement)}get webglRenderer(){return __privateGet(this,_webglRenderer)}get views(){return __privateGet(this,_views)}get view(){return this.getView("default")}get camera(){return this.getView("default").camera}get scene(){return this.getView("default").scene}get width(){return __privateGet(this,_width)}get height(){return __privateGet(this,_height)}get pixelRatio(){return __privateGet(this,_pixelRatio)}get composer(){return __privateGet(this,_composer)}setup(options){if(__privateGet(this,_isCreated))return;__privateSet(this,_containerElement,dom.getElement(options==null?void 0:options.containerElement)||document.body),__privateSet(this,_maxPixelRatio,(options==null?void 0:options.maxPixelRatio)||2),__privateSet(this,_webglRenderer,new three.WebGLRenderer(options==null?void 0:options.webGLRendererParameters)),__privateGet(this,_webglRenderer).domElement.style.cssText=`
2
2
  position: ${(options==null?void 0:options.position)||"fixed"};
3
3
  left: 0;
4
4
  top: 0;
5
5
  width: 100%;
6
6
  height: 100%;
7
7
  z-index: ${(options==null?void 0:options.zIndex)||0};
8
- `,(__privateGet(this,_containerElement).shadowRoot||__privateGet(this,_containerElement)).append(__privateGet(this,_webglRenderer).domElement),__privateGet(this,_views).set("default",new En3View(this,"default",__spreadValues({sizeElement:__privateGet(this,_containerElement)},options==null?void 0:options.view))),options!=null&&options.composer&&(__privateSet(this,_composer,new options.composer(__privateGet(this,_webglRenderer))),this.render=()=>{__privateGet(this,_composer).render()}),__privateSet(this,_isCreated,!0),windowResizer_index.windowResizer.subscribe(__privateGet(this,_resizeListener),order_index.RESIZE_ORDER.CANVAS),intersector_index.ticker.subscribe(__privateGet(this,_tickListener2),{order:order_index.TICK_ORDER.CANVAS,culling:__privateGet(this,_containerElement)})}destroy(){var _a;__privateGet(this,_isCreated)&&(windowResizer_index.windowResizer.unsubscribe(__privateGet(this,_resizeListener)),intersector_index.ticker.unsubscribe(__privateGet(this,_tickListener2)),__privateGet(this,_views).forEach(view=>{view.destroy()}),__privateGet(this,_views).clear(),__privateGet(this,_webglRenderer).dispose(),__privateGet(this,_webglRenderer).domElement.remove(),__privateSet(this,_webglRenderer,null),(_a=__privateGet(this,_composer))==null||_a.dispose(),__privateSet(this,_composer,null),__privateSet(this,_isCreated,!1))}createView(viewName,viewOptions){const size=__privateGet(this,_views).size,view=new En3View(this,viewName,viewOptions);return __privateGet(this,_views).set(viewName,view),size===1&&__privateGet(this,_webglRenderer).setScissorTest(!0),view}getView(viewName){return __privateGet(this,_views).get(viewName)}destroyView(viewName){const view=__privateGet(this,_views).get(viewName);view&&(__privateGet(this,_views).delete(viewName),view.destroy(),__privateGet(this,_views).size<=1&&__privateGet(this,_webglRenderer).setScissorTest(!1))}render(view){var _a;if(__privateGet(this,_views).size>1||this.view.isClipped){const left=view.box.left+view.box.CSSTranslation.x+view.box.scrollValue.x,top=this.height-view.box.height-view.box.top+view.box.CSSTranslation.y+view.box.scrollValue.y*-1;__privateGet(this,_webglRenderer).setScissor(left,top,view.box.width,view.box.height),__privateGet(this,_webglRenderer).setViewport(left,top,view.box.width,view.box.height)}(_a=view.beforeRenderCallback)==null||_a.call(view),__privateGet(this,_webglRenderer).render(view.scene,view.camera)}};_CDNVersion=new WeakMap,_containerElement=new WeakMap,_webglRenderer=new WeakMap,_views=new WeakMap,_width=new WeakMap,_height=new WeakMap,_pixelRatio=new WeakMap,_maxPixelRatio=new WeakMap,_isCreated=new WeakMap,_composer=new WeakMap,_resizeListener=new WeakMap,_tickListener2=new WeakMap,__name(_En3,"En3");let En3=_En3;function coverTexture(texture,planeSize,aspect){const width=planeSize.x,height=planeSize.y,_aspect=aspect||texture.image.width/texture.image.height;let sx=0,sy=0,tx=texture.offset.x,ty=texture.offset.y,r=texture.rotation,cx=texture.center.x,cy=texture.center.y;width/height>_aspect?(sx=1,sy=height/width*_aspect):(sy=1,sx=width/height/_aspect),texture.matrix.setUvTransform(tx,ty,sx,sy,r,cx,cy)}__name(coverTexture,"coverTexture");const tempTarget=new three.Vector3,position=new three.Vector3;function getCurrentViewport(en3,target,viewName="default"){const view=en3.getView(viewName),{width,height}=en3,aspect=width/height;target instanceof three.Vector3?tempTarget.copy(target):tempTarget.set(...target);const distance=view.camera.getWorldPosition(position).distanceTo(tempTarget);if(view.camera instanceof three.OrthographicCamera)return{width:width/view.camera.zoom,height:height/view.camera.zoom,factor:1,distance,aspect};{const fov=view.camera.fov*Math.PI/180,h=2*Math.tan(fov/2)*distance,w=h*(width/height);return{width:w,height:h,factor:width/w,distance,aspect}}}__name(getCurrentViewport,"getCurrentViewport");function traverseMaterials(object,callback){object.traverse(node=>{node instanceof three.Mesh&&node.material&&(Array.isArray(node.material)?node.material:[node.material]).forEach(callback)})}__name(traverseMaterials,"traverseMaterials");function traverseMeshes(object,callback){object.traverse(node=>{node instanceof three.Mesh&&callback(node)})}__name(traverseMeshes,"traverseMeshes");exports.En3=En3;exports.En3Clip=En3Clip;exports.En3View=En3View;exports.coverTexture=coverTexture;exports.dispose=dispose;exports.getCurrentViewport=getCurrentViewport;exports.traverseMaterials=traverseMaterials;exports.traverseMeshes=traverseMeshes;
8
+ `,(__privateGet(this,_containerElement).shadowRoot||__privateGet(this,_containerElement)).append(__privateGet(this,_webglRenderer).domElement),__privateGet(this,_views).set("default",new En3View(this,"default",__spreadValues({sizeElement:__privateGet(this,_containerElement)},options==null?void 0:options.view))),options!=null&&options.composer&&(__privateSet(this,_composer,new options.composer(__privateGet(this,_webglRenderer))),this.render=()=>{__privateGet(this,_composer).render()}),__privateSet(this,_isCreated,!0),windowResizer_index.windowResizer.subscribe(__privateGet(this,_resizeListener),order_index.RESIZE_ORDER.CANVAS),intersector_index.ticker.subscribe(__privateGet(this,_tickListener2),{order:order_index.TICK_ORDER.CANVAS,culling:__privateGet(this,_containerElement)})}destroy(){var _a;__privateGet(this,_isCreated)&&(windowResizer_index.windowResizer.unsubscribe(__privateGet(this,_resizeListener)),intersector_index.ticker.unsubscribe(__privateGet(this,_tickListener2)),__privateGet(this,_views).forEach(view=>{view.destroy()}),__privateGet(this,_views).clear(),__privateGet(this,_webglRenderer).dispose(),__privateGet(this,_webglRenderer).domElement.remove(),__privateSet(this,_webglRenderer,null),(_a=__privateGet(this,_composer))==null||_a.dispose(),__privateSet(this,_composer,null),__privateSet(this,_isCreated,!1))}createView(viewName,viewOptions){const size=__privateGet(this,_views).size,view=new En3View(this,viewName,viewOptions);return __privateGet(this,_views).set(viewName,view),size===1&&__privateGet(this,_webglRenderer).setScissorTest(!0),view}getView(viewName){return __privateGet(this,_views).get(viewName)}destroyView(viewName){const view=__privateGet(this,_views).get(viewName);view&&(__privateGet(this,_views).delete(viewName),view.destroy(),__privateGet(this,_views).size<=1&&__privateGet(this,_webglRenderer).setScissorTest(!1))}render(view){var _a;if(__privateGet(this,_views).size>1||this.view.isClipped){const left=view.box.left+view.box.CSSTranslation.x+view.box.scrollValue.x,top=this.height-view.box.height-view.box.top+view.box.CSSTranslation.y+view.box.scrollValue.y*-1;__privateGet(this,_webglRenderer).setScissor(left,top,view.box.width,view.box.height),__privateGet(this,_webglRenderer).setViewport(left,top,view.box.width,view.box.height)}(_a=view.beforeRenderCallback)==null||_a.call(view),__privateGet(this,_webglRenderer).render(view.scene,view.camera)}};_CDNVersion=new WeakMap,_containerElement=new WeakMap,_webglRenderer=new WeakMap,_views=new WeakMap,_width=new WeakMap,_height=new WeakMap,_pixelRatio=new WeakMap,_maxPixelRatio=new WeakMap,_isCreated=new WeakMap,_composer=new WeakMap,_resizeListener=new WeakMap,_tickListener2=new WeakMap,__name(_En3,"En3");let En3=_En3;const _En3ClipHelpers=class _En3ClipHelpers extends three.Group{constructor(clip,size=500){super(),this.add(new three.PlaneHelper(clip.planes[0],size,16711680)),this.add(new three.PlaneHelper(clip.planes[1],size,16711680)),this.add(new three.PlaneHelper(clip.planes[2],size,16711680)),this.add(new three.PlaneHelper(clip.planes[3],size,16711680))}};__name(_En3ClipHelpers,"En3ClipHelpers");let En3ClipHelpers=_En3ClipHelpers;function coverTexture(texture,planeSize,aspect){const width=planeSize.x,height=planeSize.y,_aspect=aspect||texture.image.width/texture.image.height;let sx=0,sy=0,tx=texture.offset.x,ty=texture.offset.y,r=texture.rotation,cx=texture.center.x,cy=texture.center.y;width/height>_aspect?(sx=1,sy=height/width*_aspect):(sy=1,sx=width/height/_aspect),texture.matrix.setUvTransform(tx,ty,sx,sy,r,cx,cy)}__name(coverTexture,"coverTexture");const tempTarget=new three.Vector3,position=new three.Vector3;function getCurrentViewport(en3,target,viewName="default"){const view=en3.getView(viewName),{width,height}=en3,aspect=width/height;target instanceof three.Vector3?tempTarget.copy(target):tempTarget.set(...target);const distance=view.camera.getWorldPosition(position).distanceTo(tempTarget);if(view.camera instanceof three.OrthographicCamera)return{width:width/view.camera.zoom,height:height/view.camera.zoom,factor:1,distance,aspect};{const fov=view.camera.fov*Math.PI/180,h=2*Math.tan(fov/2)*distance,w=h*(width/height);return{width:w,height:h,factor:width/w,distance,aspect}}}__name(getCurrentViewport,"getCurrentViewport");function traverseMaterials(object,callback){object.traverse(node=>{node instanceof three.Mesh&&node.material&&(Array.isArray(node.material)?node.material:[node.material]).forEach(callback)})}__name(traverseMaterials,"traverseMaterials");function traverseMeshes(object,callback){object.traverse(node=>{node instanceof three.Mesh&&callback(node)})}__name(traverseMeshes,"traverseMeshes");exports.En3=En3;exports.En3Clip=En3Clip;exports.En3ClipHelpers=En3ClipHelpers;exports.En3View=En3View;exports.coverTexture=coverTexture;exports.dispose=dispose;exports.getCurrentViewport=getCurrentViewport;exports.traverseMaterials=traverseMaterials;exports.traverseMeshes=traverseMeshes;
@@ -1,6 +1,7 @@
1
1
  export { En3, type En3Options } from './En3';
2
2
  export { En3View, type En3AttachOptions, type En3AttachedObject3D, type En3ViewBeforeRenderCallback, type En3ViewOptions, } from './En3View';
3
3
  export { En3Clip } from './objects/En3Clip';
4
+ export { En3ClipHelpers } from './objects/En3ClipHelpers';
4
5
  export { coverTexture } from './utils/coverTexture';
5
6
  export { dispose } from './utils/dispose';
6
7
  export { getCurrentViewport } from './utils/getCurrentViewport';
package/lib/en3/index.js CHANGED
@@ -20,7 +20,7 @@ import { t as ticker } from "../index-ClTMVKJp.js";
20
20
  import { g as getElement } from "../dom-D8D-_9ty.js";
21
21
  import "construct-style-sheets-polyfill";
22
22
  import { windowResizer } from "../window-resizer/index.js";
23
- import { Plane, Vector3, Mesh, OrthographicCamera, PerspectiveCamera, Scene, REVISION, WebGLRenderer } from "three";
23
+ import { Plane, Vector3, Mesh, OrthographicCamera, PerspectiveCamera, Scene, REVISION, WebGLRenderer, Group, PlaneHelper } from "three";
24
24
  import { LayoutBox } from "../layout-box/index.js";
25
25
  import { d as debounce } from "../function-UmbPrOHm.js";
26
26
  var _layoutBox, _planes, _tickListener;
@@ -29,12 +29,12 @@ const _En3Clip = class _En3Clip {
29
29
  __privateAdd(this, _layoutBox, null);
30
30
  __privateAdd(this, _planes, []);
31
31
  __privateAdd(this, _tickListener, /* @__PURE__ */ __name(() => {
32
- const scrollValueX = __privateGet(this, _layoutBox).position.x - __privateGet(this, _layoutBox).left, scrollValueY = __privateGet(this, _layoutBox).position.y - __privateGet(this, _layoutBox).top;
33
- __privateGet(this, _planes)[0].constant = __privateGet(this, _layoutBox).scale.y / 2 + scrollValueY * -1, __privateGet(this, _planes)[1].constant = __privateGet(this, _layoutBox).scale.y / 2 + scrollValueY, __privateGet(this, _planes)[2].constant = __privateGet(this, _layoutBox).scale.x / 2 + scrollValueX, __privateGet(this, _planes)[3].constant = __privateGet(this, _layoutBox).scale.x / 2 + scrollValueX * -1;
32
+ const scrollValueX = __privateGet(this, _layoutBox).position.x, scrollValueY = __privateGet(this, _layoutBox).position.y;
33
+ __privateGet(this, _planes)[0].constant = -scrollValueY + __privateGet(this, _layoutBox).scale.y / 2, __privateGet(this, _planes)[1].constant = scrollValueY + __privateGet(this, _layoutBox).scale.y / 2, __privateGet(this, _planes)[2].constant = scrollValueX + __privateGet(this, _layoutBox).scale.x / 2, __privateGet(this, _planes)[3].constant = -scrollValueX + __privateGet(this, _layoutBox).scale.x / 2;
34
34
  }, "#tickListener"));
35
- __privateSet(this, _layoutBox, new LayoutBox(elementOrSelector, { cartesian: !1 })), __privateSet(this, _planes, [
36
- new Plane(new Vector3(0, -1, 0)),
35
+ __privateSet(this, _layoutBox, new LayoutBox(elementOrSelector, { cartesian: !0 })), __privateSet(this, _planes, [
37
36
  new Plane(new Vector3(0, 1, 0)),
37
+ new Plane(new Vector3(0, -1, 0)),
38
38
  new Plane(new Vector3(-1, 0, 0)),
39
39
  new Plane(new Vector3(1, 0, 0))
40
40
  ]), material.clippingPlanes = __privateGet(this, _planes), ticker.subscribe(__privateGet(this, _tickListener), { order: TICK_ORDER.LAYOUT_BOX });
@@ -280,6 +280,13 @@ const _En3 = class _En3 {
280
280
  };
281
281
  _CDNVersion = new WeakMap(), _containerElement = new WeakMap(), _webglRenderer = new WeakMap(), _views = new WeakMap(), _width = new WeakMap(), _height = new WeakMap(), _pixelRatio = new WeakMap(), _maxPixelRatio = new WeakMap(), _isCreated = new WeakMap(), _composer = new WeakMap(), _resizeListener = new WeakMap(), _tickListener2 = new WeakMap(), __name(_En3, "En3");
282
282
  let En3 = _En3;
283
+ const _En3ClipHelpers = class _En3ClipHelpers extends Group {
284
+ constructor(clip, size = 500) {
285
+ super(), this.add(new PlaneHelper(clip.planes[0], size, 16711680)), this.add(new PlaneHelper(clip.planes[1], size, 16711680)), this.add(new PlaneHelper(clip.planes[2], size, 16711680)), this.add(new PlaneHelper(clip.planes[3], size, 16711680));
286
+ }
287
+ };
288
+ __name(_En3ClipHelpers, "En3ClipHelpers");
289
+ let En3ClipHelpers = _En3ClipHelpers;
283
290
  function coverTexture(texture, planeSize, aspect) {
284
291
  const width = planeSize.x, height = planeSize.y, _aspect = aspect || texture.image.width / texture.image.height;
285
292
  let sx = 0, sy = 0, tx = texture.offset.x, ty = texture.offset.y, r = texture.rotation, cx = texture.center.x, cy = texture.center.y;
@@ -320,6 +327,7 @@ __name(traverseMeshes, "traverseMeshes");
320
327
  export {
321
328
  En3,
322
329
  En3Clip,
330
+ En3ClipHelpers,
323
331
  En3View,
324
332
  coverTexture,
325
333
  dispose,
@@ -0,0 +1,5 @@
1
+ import { Group } from 'three';
2
+ import { En3Clip } from './En3Clip';
3
+ export declare class En3ClipHelpers extends Group {
4
+ constructor(clip: En3Clip, size?: number);
5
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aptechka",
3
- "version": "0.86.0",
3
+ "version": "0.86.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/denisavitski/aptechka.git"