shop-components 0.0.25 → 0.0.26
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/dist/assets/Color-RQJUDNI5-leAiB7jg.js +1 -0
- package/dist/assets/Configure-OUhXg2g0.js +173 -0
- package/dist/assets/DRACOLoader-FOpiHRUS.js +2 -0
- package/dist/assets/DocsRenderer-K4EAMTCU-wTc0yUaa.js +7 -0
- package/dist/assets/Header-Yyx952jD.css +1 -0
- package/dist/assets/Header.stories-8tnkOwSt.js +31 -0
- package/dist/assets/Page-fZ7a-HXz.css +1 -0
- package/dist/assets/Page.stories-53Crpe03.js +61 -0
- package/dist/assets/RGBELoader-re-MEsjP.js +5 -0
- package/dist/assets/SFL-CDD14-9UY62fbR.glb +0 -0
- package/dist/assets/WithTooltip-Y7J54OF7-e8Yh5ASp.js +1 -0
- package/dist/assets/_commonjsHelpers-4gQjN7DL.js +1 -0
- package/dist/assets/accessibility-Fv4dmnDm.png +0 -0
- package/dist/assets/addon-library-VlAgJsjc.png +0 -0
- package/dist/assets/bg-circle-d8WfpvaX.png +0 -0
- package/dist/assets/context-tKiKnkuP.png +0 -0
- package/dist/assets/docs-Pvr7BWzI.png +0 -0
- package/dist/assets/entry-preview-TptA_luc.js +8 -0
- package/dist/assets/entry-preview-docs-AhrJ3R4Z.js +2 -0
- package/dist/assets/figma-plugin-h9oRC4jr.png +0 -0
- package/dist/assets/formatter-B5HCVTEV-DKi3GmSv.js +58 -0
- package/dist/assets/generateMeshBVH.worker-NFSCTTDt.js +5 -0
- package/dist/assets/iframe-tlQuLR4E.js +7 -0
- package/dist/assets/img-radar-kufDNNXQ.png +0 -0
- package/dist/assets/img-radar2-1cPZO_cj.png +0 -0
- package/dist/assets/index-CXFn8OGe.js +513 -0
- package/dist/assets/index-C_uo8BdM.js +1 -0
- package/dist/assets/index-PPLHz8o0.js +6 -0
- package/dist/assets/index-jFdhmKfM.js +3 -0
- package/dist/assets/index-jtEywAqJ.js +1 -0
- package/dist/assets/index-ogXoivrg.js +1 -0
- package/dist/assets/index.stories-TVZrSYZv.js +20 -0
- package/dist/assets/index.stories-Uq0Yg-kp.js +896 -0
- package/dist/assets/index.stories-VJP6Jo4U.js +22 -0
- package/dist/assets/index.stories-VoNcNCFd.js +27 -0
- package/dist/assets/index.stories-YIFSciWI.js +1174 -0
- package/dist/assets/index.stories-iMKoZNyH.js +46 -0
- package/dist/assets/lightroom_14b-MJkJLVlP.hdr +0 -0
- package/dist/assets/lightroom_14b_512-e_XJNpR6.js +3981 -0
- package/dist/assets/lightroom_14b_512-nMVn659Q.hdr +0 -0
- package/dist/assets/lit-element-P_wTzRvl.js +19 -0
- package/dist/assets/parallelMeshBVH.worker-TP6qJGKX.js +5 -0
- package/dist/assets/preview-1q4RDNOi.js +1 -0
- package/dist/assets/preview-6iG64ELu.js +20 -0
- package/dist/assets/preview-7nNmfNVr.js +7 -0
- package/dist/assets/preview-9bpQVOkQ.js +1 -0
- package/dist/assets/preview-FnnPJHgu.js +1 -0
- package/dist/assets/preview-VI2eoWmp.js +1 -0
- package/dist/assets/preview-bEa2SesL.js +7 -0
- package/dist/assets/preview-u8M_OEO2.js +396 -0
- package/dist/assets/preview-zZA4w0lH.js +1 -0
- package/dist/assets/property-EQZXZ3dt.js +5 -0
- package/dist/assets/query-7eORIRsG.js +13 -0
- package/dist/assets/roller-8Vy8W3X_.glb +0 -0
- package/dist/assets/roller-hopper-Heae_wy5.glb +0 -0
- package/dist/assets/share-xgPlHEHy.png +0 -0
- package/dist/assets/styling-ZOs40c1G.png +0 -0
- package/dist/assets/syntaxhighlighter-JOJW2KGS-uBo08tOF.js +1 -0
- package/dist/assets/testing-HG80fZfa.png +0 -0
- package/dist/assets/theming--liSzaFj.png +0 -0
- package/dist/assets/three.module-9MfFqitO.js +3825 -0
- package/dist/assets/tiny-invariant-VyoA2Os1.js +1 -0
- package/dist/assets/worker-h5IcTUxB.js +1 -0
- package/dist/device-viewer/amr.d.ts +75 -0
- package/dist/device-viewer/assembly.d.ts +11 -0
- package/dist/device-viewer/dimension/index.d.ts +31 -0
- package/dist/device-viewer/dimension/line3.d.ts +21 -0
- package/dist/device-viewer/dimension/size-box.d.ts +39 -0
- package/dist/device-viewer/group-roller.d.ts +20 -0
- package/dist/device-viewer/index.d.ts +12 -0
- package/dist/device-viewer/mechanism/mechanism.d.ts +29 -0
- package/dist/device-viewer/outerline.d.ts +16 -0
- package/dist/device-viewer/roller.d.ts +31 -0
- package/dist/device-viewer/row.d.ts +18 -0
- package/dist/device-viewer/scene.d.ts +14 -28
- package/dist/device-viewer/slot.d.ts +10 -2
- package/dist/device-viewer/text2.d.ts +4 -0
- package/dist/device-viewer/text3.d.ts +4 -0
- package/dist/device-viewer/utils/index.d.ts +26 -1
- package/dist/favicon.svg +7 -0
- package/dist/iframe.html +495 -0
- package/dist/index.html +155 -0
- package/dist/index.json +1 -0
- package/dist/package.json +60 -0
- package/dist/project.json +1 -0
- package/dist/sb-addons/essentials-actions-3/manager-bundle.js +3 -0
- package/dist/sb-addons/essentials-actions-3/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/essentials-backgrounds-4/manager-bundle.js +12 -0
- package/dist/sb-addons/essentials-backgrounds-4/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/essentials-controls-2/manager-bundle.js +60 -0
- package/dist/sb-addons/essentials-controls-2/manager-bundle.js.LEGAL.txt +18 -0
- package/dist/sb-addons/essentials-measure-7/manager-bundle.js +3 -0
- package/dist/sb-addons/essentials-measure-7/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/essentials-outline-8/manager-bundle.js +3 -0
- package/dist/sb-addons/essentials-outline-8/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/essentials-toolbars-6/manager-bundle.js +3 -0
- package/dist/sb-addons/essentials-toolbars-6/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/essentials-viewport-5/manager-bundle.js +3 -0
- package/dist/sb-addons/essentials-viewport-5/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/links-1/manager-bundle.js +3 -0
- package/dist/sb-addons/links-1/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +3 -0
- package/dist/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-common-assets/fonts.css +31 -0
- package/dist/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
- package/dist/sb-common-assets/nunito-sans-bold.woff2 +0 -0
- package/dist/sb-common-assets/nunito-sans-italic.woff2 +0 -0
- package/dist/sb-common-assets/nunito-sans-regular.woff2 +0 -0
- package/dist/sb-manager/WithTooltip-Y7J54OF7-3AIPQNGM.js +1 -0
- package/dist/sb-manager/chunk-I53COLQ6.js +183 -0
- package/dist/sb-manager/chunk-L35575BZ.js +234 -0
- package/dist/sb-manager/chunk-TZAR34JC.js +6 -0
- package/dist/sb-manager/chunk-UOBNU442.js +347 -0
- package/dist/sb-manager/chunk-VMGB76WP.js +9 -0
- package/dist/sb-manager/chunk-XP3HGWTR.js +1 -0
- package/dist/sb-manager/formatter-B5HCVTEV-7DCBOGO6.js +58 -0
- package/dist/sb-manager/globals-module-info.js +1 -0
- package/dist/sb-manager/globals-runtime.js +1 -0
- package/dist/sb-manager/globals.js +1 -0
- package/dist/sb-manager/index.js +1 -0
- package/dist/sb-manager/runtime.js +1 -0
- package/dist/sb-manager/syntaxhighlighter-JOJW2KGS-7BF26SBB.js +1 -0
- package/dist/sb-preview/globals.js +1 -0
- package/dist/sb-preview/runtime.js +128 -0
- package/dist/stories/cropper/index.d.ts +18 -0
- package/dist/stories/cropper/index.js +118 -0
- package/dist/stories/cropper/index.js.map +1 -0
- package/dist/stories/cropper/index.stories.d.ts +11 -0
- package/dist/stories/cropper/index.stories.js +14 -0
- package/dist/stories/cropper/index.stories.js.map +1 -0
- package/dist/stories/device-viewer/amr.d.ts +75 -0
- package/dist/stories/device-viewer/amr.js +554 -0
- package/dist/stories/device-viewer/amr.js.map +1 -0
- package/dist/stories/device-viewer/assembly.d.ts +11 -0
- package/dist/stories/device-viewer/assembly.js +47 -0
- package/dist/stories/device-viewer/assembly.js.map +1 -0
- package/dist/stories/device-viewer/asserts/fonts/type.json +1281 -0
- package/dist/stories/device-viewer/dimension/index.d.ts +31 -0
- package/dist/stories/device-viewer/dimension/index.js +131 -0
- package/dist/stories/device-viewer/dimension/index.js.map +1 -0
- package/dist/stories/device-viewer/dimension/line3.d.ts +21 -0
- package/dist/stories/device-viewer/dimension/line3.js +98 -0
- package/dist/stories/device-viewer/dimension/line3.js.map +1 -0
- package/dist/stories/device-viewer/dimension/size-box.d.ts +39 -0
- package/dist/stories/device-viewer/dimension/size-box.js +176 -0
- package/dist/stories/device-viewer/dimension/size-box.js.map +1 -0
- package/dist/stories/device-viewer/group-roller.d.ts +20 -0
- package/dist/stories/device-viewer/group-roller.js +65 -0
- package/dist/stories/device-viewer/group-roller.js.map +1 -0
- package/dist/stories/device-viewer/index.d.ts +47 -0
- package/dist/stories/device-viewer/index.js +530 -0
- package/dist/stories/device-viewer/index.js.map +1 -0
- package/dist/stories/device-viewer/index.stories.d.ts +27 -0
- package/dist/stories/device-viewer/index.stories.js +37 -0
- package/dist/stories/device-viewer/index.stories.js.map +1 -0
- package/dist/stories/device-viewer/lines.d.ts +36 -0
- package/dist/stories/device-viewer/lines.js +171 -0
- package/dist/stories/device-viewer/lines.js.map +1 -0
- package/dist/stories/device-viewer/main.d.ts +1 -0
- package/dist/stories/device-viewer/main.js +2 -0
- package/dist/stories/device-viewer/main.js.map +1 -0
- package/dist/stories/device-viewer/mechanism/mechanism.d.ts +29 -0
- package/dist/stories/device-viewer/mechanism/mechanism.js +164 -0
- package/dist/stories/device-viewer/mechanism/mechanism.js.map +1 -0
- package/dist/stories/device-viewer/outerline.d.ts +16 -0
- package/dist/stories/device-viewer/outerline.js +63 -0
- package/dist/stories/device-viewer/outerline.js.map +1 -0
- package/dist/stories/device-viewer/roller.d.ts +31 -0
- package/dist/stories/device-viewer/roller.js +121 -0
- package/dist/stories/device-viewer/roller.js.map +1 -0
- package/dist/stories/device-viewer/row.d.ts +18 -0
- package/dist/stories/device-viewer/row.js +58 -0
- package/dist/stories/device-viewer/row.js.map +1 -0
- package/dist/stories/device-viewer/scene.d.ts +101 -0
- package/dist/stories/device-viewer/scene.js +535 -0
- package/dist/stories/device-viewer/scene.js.map +1 -0
- package/dist/stories/device-viewer/slot/slot-item.d.ts +20 -0
- package/dist/stories/device-viewer/slot/slot-item.js +82 -0
- package/dist/stories/device-viewer/slot/slot-item.js.map +1 -0
- package/dist/stories/device-viewer/slot.d.ts +71 -0
- package/dist/stories/device-viewer/slot.js +272 -0
- package/dist/stories/device-viewer/slot.js.map +1 -0
- package/dist/stories/device-viewer/sound.d.ts +5 -0
- package/dist/stories/device-viewer/sound.js +13 -0
- package/dist/stories/device-viewer/sound.js.map +1 -0
- package/dist/stories/device-viewer/text2.d.ts +4 -0
- package/dist/stories/device-viewer/text2.js +12 -0
- package/dist/stories/device-viewer/text2.js.map +1 -0
- package/dist/stories/device-viewer/text3.d.ts +4 -0
- package/dist/stories/device-viewer/text3.js +14 -0
- package/dist/stories/device-viewer/text3.js.map +1 -0
- package/dist/stories/device-viewer/utils/index.d.ts +36 -0
- package/dist/stories/device-viewer/utils/index.js +166 -0
- package/dist/stories/device-viewer/utils/index.js.map +1 -0
- package/dist/stories/device-viewer/worker/generate-mesh-bvh-worker.d.ts +8 -0
- package/dist/stories/device-viewer/worker/generate-mesh-bvh-worker.js +88 -0
- package/dist/stories/device-viewer/worker/generate-mesh-bvh-worker.js.map +1 -0
- package/dist/stories/device-viewer/worker/generateAsync.worker.d.ts +1 -0
- package/dist/stories/device-viewer/worker/generateAsync.worker.js +57 -0
- package/dist/stories/device-viewer/worker/generateAsync.worker.js.map +1 -0
- package/dist/stories/device-viewer/worker/path-tracing-scene-worker.d.ts +16 -0
- package/dist/stories/device-viewer/worker/path-tracing-scene-worker.js +29 -0
- package/dist/stories/device-viewer/worker/path-tracing-scene-worker.js.map +1 -0
- package/dist/stories/main/index.d.ts +1 -0
- package/dist/stories/main/index.js +2 -0
- package/dist/stories/main/index.js.map +1 -0
- package/dist/stories/main.d.ts +4 -0
- package/dist/stories/main.js +5 -0
- package/dist/stories/main.js.map +1 -0
- package/dist/stories/plugin.d.ts +5 -0
- package/dist/stories/plugin.js +6 -0
- package/dist/stories/plugin.js.map +1 -0
- package/dist/stories/plugins/change-slot/index.d.ts +0 -0
- package/dist/stories/plugins/change-slot/index.js +2 -0
- package/dist/stories/plugins/change-slot/index.js.map +1 -0
- package/dist/stories/sglb/index.d.ts +27 -0
- package/dist/stories/sglb/index.js +151 -0
- package/dist/stories/sglb/index.js.map +1 -0
- package/dist/stories/smap-viewer/index.d.ts +14 -0
- package/dist/stories/smap-viewer/index.js +59 -0
- package/dist/stories/smap-viewer/index.js.map +1 -0
- package/dist/stories/smap-viewer/index.stories.d.ts +22 -0
- package/dist/stories/smap-viewer/index.stories.js +27 -0
- package/dist/stories/smap-viewer/index.stories.js.map +1 -0
- package/dist/stories/step-viewer/index.d.ts +17 -0
- package/dist/stories/step-viewer/index.js +109 -0
- package/dist/stories/step-viewer/index.js.map +1 -0
- package/dist/stories/step-viewer/index.stories.d.ts +20 -0
- package/dist/stories/step-viewer/index.stories.js +24 -0
- package/dist/stories/step-viewer/index.stories.js.map +1 -0
- package/dist/stories/test/index.d.ts +25 -0
- package/dist/stories/test/index.js +99 -0
- package/dist/stories/test/index.js.map +1 -0
- package/dist/stories/test/index.stories.d.ts +14 -0
- package/dist/stories/test/index.stories.js +16 -0
- package/dist/stories/test/index.stories.js.map +1 -0
- package/dist/stories/test/scene.d.ts +20 -0
- package/dist/stories/test/scene.js +86 -0
- package/dist/stories/test/scene.js.map +1 -0
- package/dist/stories/utils/index.d.ts +4 -0
- package/dist/stories/utils/index.js +28 -0
- package/dist/stories/utils/index.js.map +1 -0
- package/dist/test/index.d.ts +25 -0
- package/dist/test/index.stories.d.ts +14 -0
- package/dist/test/scene.d.ts +20 -0
- package/package.json +9 -6
- package/dist/shop-components.mjs +0 -55938
- package/dist/shop-components.umd.js +0 -9232
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import{s as Q,x as K,i as J}from"./lit-element-P_wTzRvl.js";import{e as $,t as tt}from"./query-7eORIRsG.js";import{n as it}from"./property-EQZXZ3dt.js";import{i as x,R as st,V as v,j as et,k as at,Q as ot,G as T,l as d,m as W,n as rt,o as nt,p as R,B as A,q as D,r as N,f as ht,W as ct,P as mt,A as lt,s as G,h as _t,E as ut,b as L,M as X,t as pt,u as dt}from"./three.module-9MfFqitO.js";import{R as ft}from"./RGBELoader-re-MEsjP.js";import{e as j,T as vt,D as gt}from"./DRACOLoader-FOpiHRUS.js";const n={IDLE:Symbol(),ROTATE:Symbol(),PAN:Symbol(),SCALE:Symbol(),FOV:Symbol(),FOCUS:Symbol(),ZROTATE:Symbol(),TOUCH_MULTI:Symbol(),ANIMATION_FOCUS:Symbol(),ANIMATION_ROTATE:Symbol()},_={NONE:Symbol(),ONE_FINGER:Symbol(),ONE_FINGER_SWITCHED:Symbol(),TWO_FINGER:Symbol(),MULT_FINGER:Symbol(),CURSOR:Symbol()},m={x:0,y:0},P={camera:new x,gizmos:new x},u={type:"change"},w={type:"start"},S={type:"end"},xt=new st,f=new v,U=new x,Z=new x,E=new v;class Mt extends et{constructor(t,i,s=null){super(),this.camera=null,this.domElement=i,this.scene=s,this.target=new v,this._currentTarget=new v,this.radiusFactor=.67,this.mouseActions=[],this._mouseOp=null,this._v2_1=new at,this._v3_1=new v,this._v3_2=new v,this._m4_1=new x,this._m4_2=new x,this._quat=new ot,this._translationMatrix=new x,this._rotationMatrix=new x,this._scaleMatrix=new x,this._rotationAxis=new v,this._cameraMatrixState=new x,this._cameraProjectionState=new x,this._fovState=1,this._upState=new v,this._zoomState=1,this._nearPos=0,this._farPos=0,this._gizmoMatrixState=new x,this._up0=new v,this._zoom0=1,this._fov0=0,this._initialNear=0,this._nearPos0=0,this._initialFar=0,this._farPos0=0,this._cameraMatrixState0=new x,this._gizmoMatrixState0=new x,this._button=-1,this._touchStart=[],this._touchCurrent=[],this._input=_.NONE,this._switchSensibility=32,this._startFingerDistance=0,this._currentFingerDistance=0,this._startFingerRotation=0,this._currentFingerRotation=0,this._devPxRatio=0,this._downValid=!0,this._nclicks=0,this._downEvents=[],this._downStart=0,this._clickStart=0,this._maxDownTime=250,this._maxInterval=300,this._posThreshold=24,this._movementThreshold=24,this._currentCursorPosition=new v,this._startCursorPosition=new v,this._grid=null,this._gridPosition=new v,this._gizmos=new T,this._curvePts=128,this._timeStart=-1,this._animationId=-1,this.focusAnimationTime=500,this._timePrev=0,this._timeCurrent=0,this._anglePrev=0,this._angleCurrent=0,this._cursorPosPrev=new v,this._cursorPosCurr=new v,this._wPrev=0,this._wCurr=0,this.adjustNearFar=!1,this.scaleFactor=1.1,this.dampingFactor=25,this.wMax=20,this.enableAnimations=!0,this.enableGrid=!1,this.cursorZoom=!1,this.minFov=5,this.maxFov=90,this.rotateSpeed=1,this.enabled=!0,this.enablePan=!0,this.enableRotate=!0,this.enableZoom=!0,this.enableGizmos=!0,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this._tbRadius=1,this._state=n.IDLE,this.setCamera(t),this.scene!=null&&this.scene.add(this._gizmos),this.domElement.style.touchAction="none",this._devPxRatio=window.devicePixelRatio,this.initializeMouseActions(),this._onContextMenu=Pt.bind(this),this._onWheel=zt.bind(this),this._onPointerUp=bt.bind(this),this._onPointerMove=wt.bind(this),this._onPointerDown=Et.bind(this),this._onPointerCancel=St.bind(this),this._onWindowResize=yt.bind(this),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onWheel),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerCancel),window.addEventListener("resize",this._onWindowResize)}onSinglePanStart(t,i){if(this.enabled)switch(this.dispatchEvent(w),this.setCenter(t.clientX,t.clientY),i){case"PAN":if(!this.enablePan)return;this._animationId!=-1&&(cancelAnimationFrame(this._animationId),this._animationId=-1,this._timeStart=-1,this.activateGizmos(!1),this.dispatchEvent(u)),this.updateTbState(n.PAN,!0),this._startCursorPosition.copy(this.unprojectOnTbPlane(this.camera,m.x,m.y,this.domElement)),this.enableGrid&&(this.drawGrid(),this.dispatchEvent(u));break;case"ROTATE":if(!this.enableRotate)return;this._animationId!=-1&&(cancelAnimationFrame(this._animationId),this._animationId=-1,this._timeStart=-1),this.updateTbState(n.ROTATE,!0),this._startCursorPosition.copy(this.unprojectOnTbSurface(this.camera,m.x,m.y,this.domElement,this._tbRadius)),this.activateGizmos(!0),this.enableAnimations&&(this._timePrev=this._timeCurrent=performance.now(),this._angleCurrent=this._anglePrev=0,this._cursorPosPrev.copy(this._startCursorPosition),this._cursorPosCurr.copy(this._cursorPosPrev),this._wCurr=0,this._wPrev=this._wCurr),this.dispatchEvent(u);break;case"FOV":if(!this.camera.isPerspectiveCamera||!this.enableZoom)return;this._animationId!=-1&&(cancelAnimationFrame(this._animationId),this._animationId=-1,this._timeStart=-1,this.activateGizmos(!1),this.dispatchEvent(u)),this.updateTbState(n.FOV,!0),this._startCursorPosition.setY(this.getCursorNDC(m.x,m.y,this.domElement).y*.5),this._currentCursorPosition.copy(this._startCursorPosition);break;case"ZOOM":if(!this.enableZoom)return;this._animationId!=-1&&(cancelAnimationFrame(this._animationId),this._animationId=-1,this._timeStart=-1,this.activateGizmos(!1),this.dispatchEvent(u)),this.updateTbState(n.SCALE,!0),this._startCursorPosition.setY(this.getCursorNDC(m.x,m.y,this.domElement).y*.5),this._currentCursorPosition.copy(this._startCursorPosition);break}}onSinglePanMove(t,i){if(this.enabled){const s=i!=this._state;switch(this.setCenter(t.clientX,t.clientY),i){case n.PAN:this.enablePan&&(s?(this.dispatchEvent(S),this.dispatchEvent(w),this.updateTbState(i,!0),this._startCursorPosition.copy(this.unprojectOnTbPlane(this.camera,m.x,m.y,this.domElement)),this.enableGrid&&this.drawGrid(),this.activateGizmos(!1)):(this._currentCursorPosition.copy(this.unprojectOnTbPlane(this.camera,m.x,m.y,this.domElement)),this.applyTransformMatrix(this.pan(this._startCursorPosition,this._currentCursorPosition))));break;case n.ROTATE:if(this.enableRotate)if(s)this.dispatchEvent(S),this.dispatchEvent(w),this.updateTbState(i,!0),this._startCursorPosition.copy(this.unprojectOnTbSurface(this.camera,m.x,m.y,this.domElement,this._tbRadius)),this.enableGrid&&this.disposeGrid(),this.activateGizmos(!0);else{this._currentCursorPosition.copy(this.unprojectOnTbSurface(this.camera,m.x,m.y,this.domElement,this._tbRadius));const e=this._startCursorPosition.distanceTo(this._currentCursorPosition),a=this._startCursorPosition.angleTo(this._currentCursorPosition),o=Math.max(e/this._tbRadius,a)*this.rotateSpeed;this.applyTransformMatrix(this.rotate(this.calculateRotationAxis(this._startCursorPosition,this._currentCursorPosition),o)),this.enableAnimations&&(this._timePrev=this._timeCurrent,this._timeCurrent=performance.now(),this._anglePrev=this._angleCurrent,this._angleCurrent=o,this._cursorPosPrev.copy(this._cursorPosCurr),this._cursorPosCurr.copy(this._currentCursorPosition),this._wPrev=this._wCurr,this._wCurr=this.calculateAngularSpeed(this._anglePrev,this._angleCurrent,this._timePrev,this._timeCurrent))}break;case n.SCALE:if(this.enableZoom)if(s)this.dispatchEvent(S),this.dispatchEvent(w),this.updateTbState(i,!0),this._startCursorPosition.setY(this.getCursorNDC(m.x,m.y,this.domElement).y*.5),this._currentCursorPosition.copy(this._startCursorPosition),this.enableGrid&&this.disposeGrid(),this.activateGizmos(!1);else{this._currentCursorPosition.setY(this.getCursorNDC(m.x,m.y,this.domElement).y*.5);const a=this._currentCursorPosition.y-this._startCursorPosition.y;let o=1;a<0?o=1/Math.pow(this.scaleFactor,-a*8):a>0&&(o=Math.pow(this.scaleFactor,a*8)),this._v3_1.setFromMatrixPosition(this._gizmoMatrixState),this.applyTransformMatrix(this.scale(o,this._v3_1))}break;case n.FOV:if(this.enableZoom&&this.camera.isPerspectiveCamera)if(s)this.dispatchEvent(S),this.dispatchEvent(w),this.updateTbState(i,!0),this._startCursorPosition.setY(this.getCursorNDC(m.x,m.y,this.domElement).y*.5),this._currentCursorPosition.copy(this._startCursorPosition),this.enableGrid&&this.disposeGrid(),this.activateGizmos(!1);else{this._currentCursorPosition.setY(this.getCursorNDC(m.x,m.y,this.domElement).y*.5);const a=this._currentCursorPosition.y-this._startCursorPosition.y;let o=1;a<0?o=1/Math.pow(this.scaleFactor,-a*8):a>0&&(o=Math.pow(this.scaleFactor,a*8)),this._v3_1.setFromMatrixPosition(this._cameraMatrixState);const h=this._v3_1.distanceTo(this._gizmos.position);let c=h/o;c=d.clamp(c,this.minDistance,this.maxDistance);const l=h*Math.tan(d.DEG2RAD*this._fovState*.5);let p=d.RAD2DEG*(Math.atan(l/c)*2);p=d.clamp(p,this.minFov,this.maxFov);const g=l/Math.tan(d.DEG2RAD*(p/2));o=h/g,this._v3_2.setFromMatrixPosition(this._gizmoMatrixState),this.setFov(p),this.applyTransformMatrix(this.scale(o,this._v3_2,!1)),f.copy(this._gizmos.position).sub(this.camera.position).normalize().multiplyScalar(g/h),this._m4_1.makeTranslation(f.x,f.y,f.z)}break}this.dispatchEvent(u)}}onSinglePanEnd(){if(this._state==n.ROTATE){if(!this.enableRotate)return;if(this.enableAnimations)if(performance.now()-this._timeCurrent<120){const i=Math.abs((this._wPrev+this._wCurr)/2),s=this;this._animationId=window.requestAnimationFrame(function(e){s.updateTbState(n.ANIMATION_ROTATE,!0);const a=s.calculateRotationAxis(s._cursorPosPrev,s._cursorPosCurr);s.onRotationAnim(e,a,Math.min(i,s.wMax))})}else this.updateTbState(n.IDLE,!1),this.activateGizmos(!1),this.dispatchEvent(u);else this.updateTbState(n.IDLE,!1),this.activateGizmos(!1),this.dispatchEvent(u)}else(this._state==n.PAN||this._state==n.IDLE)&&(this.updateTbState(n.IDLE,!1),this.enableGrid&&this.disposeGrid(),this.activateGizmos(!1),this.dispatchEvent(u));this.dispatchEvent(S)}onDoubleTap(t){if(this.enabled&&this.enablePan&&this.scene!=null){this.dispatchEvent(w),this.setCenter(t.clientX,t.clientY);const i=this.unprojectOnObj(this.getCursorNDC(m.x,m.y,this.domElement),this.camera);if(i!=null&&this.enableAnimations){const s=this;this._animationId!=-1&&window.cancelAnimationFrame(this._animationId),this._timeStart=-1,this._animationId=window.requestAnimationFrame(function(e){s.updateTbState(n.ANIMATION_FOCUS,!0),s.onFocusAnim(e,i,s._cameraMatrixState,s._gizmoMatrixState)})}else i!=null&&!this.enableAnimations&&(this.updateTbState(n.FOCUS,!0),this.focus(i,this.scaleFactor),this.updateTbState(n.IDLE,!1),this.dispatchEvent(u))}this.dispatchEvent(S)}onDoublePanStart(){this.enabled&&this.enablePan&&(this.dispatchEvent(w),this.updateTbState(n.PAN,!0),this.setCenter((this._touchCurrent[0].clientX+this._touchCurrent[1].clientX)/2,(this._touchCurrent[0].clientY+this._touchCurrent[1].clientY)/2),this._startCursorPosition.copy(this.unprojectOnTbPlane(this.camera,m.x,m.y,this.domElement,!0)),this._currentCursorPosition.copy(this._startCursorPosition),this.activateGizmos(!1))}onDoublePanMove(){this.enabled&&this.enablePan&&(this.setCenter((this._touchCurrent[0].clientX+this._touchCurrent[1].clientX)/2,(this._touchCurrent[0].clientY+this._touchCurrent[1].clientY)/2),this._state!=n.PAN&&(this.updateTbState(n.PAN,!0),this._startCursorPosition.copy(this._currentCursorPosition)),this._currentCursorPosition.copy(this.unprojectOnTbPlane(this.camera,m.x,m.y,this.domElement,!0)),this.applyTransformMatrix(this.pan(this._startCursorPosition,this._currentCursorPosition,!0)),this.dispatchEvent(u))}onDoublePanEnd(){this.updateTbState(n.IDLE,!1),this.dispatchEvent(S)}onRotateStart(){this.enabled&&this.enableRotate&&(this.dispatchEvent(w),this.updateTbState(n.ZROTATE,!0),this._startFingerRotation=this.getAngle(this._touchCurrent[1],this._touchCurrent[0])+this.getAngle(this._touchStart[1],this._touchStart[0]),this._currentFingerRotation=this._startFingerRotation,this.camera.getWorldDirection(this._rotationAxis),!this.enablePan&&!this.enableZoom&&this.activateGizmos(!0))}onRotateMove(){if(this.enabled&&this.enableRotate){this.setCenter((this._touchCurrent[0].clientX+this._touchCurrent[1].clientX)/2,(this._touchCurrent[0].clientY+this._touchCurrent[1].clientY)/2);let t;this._state!=n.ZROTATE&&(this.updateTbState(n.ZROTATE,!0),this._startFingerRotation=this._currentFingerRotation),this._currentFingerRotation=this.getAngle(this._touchCurrent[1],this._touchCurrent[0])+this.getAngle(this._touchStart[1],this._touchStart[0]),this.enablePan?(this._v3_2.setFromMatrixPosition(this._gizmoMatrixState),t=this.unprojectOnTbPlane(this.camera,m.x,m.y,this.domElement).applyQuaternion(this.camera.quaternion).multiplyScalar(1/this.camera.zoom).add(this._v3_2)):t=new v().setFromMatrixPosition(this._gizmoMatrixState);const i=d.DEG2RAD*(this._startFingerRotation-this._currentFingerRotation);this.applyTransformMatrix(this.zRotate(t,i)),this.dispatchEvent(u)}}onRotateEnd(){this.updateTbState(n.IDLE,!1),this.activateGizmos(!1),this.dispatchEvent(S)}onPinchStart(){this.enabled&&this.enableZoom&&(this.dispatchEvent(w),this.updateTbState(n.SCALE,!0),this._startFingerDistance=this.calculatePointersDistance(this._touchCurrent[0],this._touchCurrent[1]),this._currentFingerDistance=this._startFingerDistance,this.activateGizmos(!1))}onPinchMove(){if(this.enabled&&this.enableZoom){this.setCenter((this._touchCurrent[0].clientX+this._touchCurrent[1].clientX)/2,(this._touchCurrent[0].clientY+this._touchCurrent[1].clientY)/2);const t=12;this._state!=n.SCALE&&(this._startFingerDistance=this._currentFingerDistance,this.updateTbState(n.SCALE,!0)),this._currentFingerDistance=Math.max(this.calculatePointersDistance(this._touchCurrent[0],this._touchCurrent[1]),t*this._devPxRatio);const i=this._currentFingerDistance/this._startFingerDistance;let s;this.enablePan?this.camera.isOrthographicCamera?s=this.unprojectOnTbPlane(this.camera,m.x,m.y,this.domElement).applyQuaternion(this.camera.quaternion).multiplyScalar(1/this.camera.zoom).add(this._gizmos.position):this.camera.isPerspectiveCamera&&(s=this.unprojectOnTbPlane(this.camera,m.x,m.y,this.domElement).applyQuaternion(this.camera.quaternion).add(this._gizmos.position)):s=this._gizmos.position,this.applyTransformMatrix(this.scale(i,s)),this.dispatchEvent(u)}}onPinchEnd(){this.updateTbState(n.IDLE,!1),this.dispatchEvent(S)}onTriplePanStart(){if(this.enabled&&this.enableZoom){this.dispatchEvent(w),this.updateTbState(n.SCALE,!0);let t=0,i=0;const s=this._touchCurrent.length;for(let e=0;e<s;e++)t+=this._touchCurrent[e].clientX,i+=this._touchCurrent[e].clientY;this.setCenter(t/s,i/s),this._startCursorPosition.setY(this.getCursorNDC(m.x,m.y,this.domElement).y*.5),this._currentCursorPosition.copy(this._startCursorPosition)}}onTriplePanMove(){if(this.enabled&&this.enableZoom){let t=0,i=0;const s=this._touchCurrent.length;for(let M=0;M<s;M++)t+=this._touchCurrent[M].clientX,i+=this._touchCurrent[M].clientY;this.setCenter(t/s,i/s);const e=8;this._currentCursorPosition.setY(this.getCursorNDC(m.x,m.y,this.domElement).y*.5);const a=this._currentCursorPosition.y-this._startCursorPosition.y;let o=1;a<0?o=1/Math.pow(this.scaleFactor,-a*e):a>0&&(o=Math.pow(this.scaleFactor,a*e)),this._v3_1.setFromMatrixPosition(this._cameraMatrixState);const h=this._v3_1.distanceTo(this._gizmos.position);let c=h/o;c=d.clamp(c,this.minDistance,this.maxDistance);const l=h*Math.tan(d.DEG2RAD*this._fovState*.5);let p=d.RAD2DEG*(Math.atan(l/c)*2);p=d.clamp(p,this.minFov,this.maxFov);const g=l/Math.tan(d.DEG2RAD*(p/2));o=h/g,this._v3_2.setFromMatrixPosition(this._gizmoMatrixState),this.setFov(p),this.applyTransformMatrix(this.scale(o,this._v3_2,!1)),f.copy(this._gizmos.position).sub(this.camera.position).normalize().multiplyScalar(g/h),this._m4_1.makeTranslation(f.x,f.y,f.z),this.dispatchEvent(u)}}onTriplePanEnd(){this.updateTbState(n.IDLE,!1),this.dispatchEvent(S)}setCenter(t,i){m.x=t,m.y=i}initializeMouseActions(){this.setMouseAction("PAN",0,"CTRL"),this.setMouseAction("PAN",2),this.setMouseAction("ROTATE",0),this.setMouseAction("ZOOM","WHEEL"),this.setMouseAction("ZOOM",1),this.setMouseAction("FOV","WHEEL","SHIFT"),this.setMouseAction("FOV",1,"SHIFT")}compareMouseAction(t,i){return t.operation==i.operation?t.mouse==i.mouse&&t.key==i.key:!1}setMouseAction(t,i,s=null){const e=["PAN","ROTATE","ZOOM","FOV"],a=[0,1,2,"WHEEL"],o=["CTRL","SHIFT",null];let h;if(!e.includes(t)||!a.includes(i)||!o.includes(s)||i=="WHEEL"&&t!="ZOOM"&&t!="FOV")return!1;switch(t){case"PAN":h=n.PAN;break;case"ROTATE":h=n.ROTATE;break;case"ZOOM":h=n.SCALE;break;case"FOV":h=n.FOV;break}const c={operation:t,mouse:i,key:s,state:h};for(let l=0;l<this.mouseActions.length;l++)if(this.mouseActions[l].mouse==c.mouse&&this.mouseActions[l].key==c.key)return this.mouseActions.splice(l,1,c),!0;return this.mouseActions.push(c),!0}unsetMouseAction(t,i=null){for(let s=0;s<this.mouseActions.length;s++)if(this.mouseActions[s].mouse==t&&this.mouseActions[s].key==i)return this.mouseActions.splice(s,1),!0;return!1}getOpFromAction(t,i){let s;for(let e=0;e<this.mouseActions.length;e++)if(s=this.mouseActions[e],s.mouse==t&&s.key==i)return s.operation;if(i!=null){for(let e=0;e<this.mouseActions.length;e++)if(s=this.mouseActions[e],s.mouse==t&&s.key==null)return s.operation}return null}getOpStateFromAction(t,i){let s;for(let e=0;e<this.mouseActions.length;e++)if(s=this.mouseActions[e],s.mouse==t&&s.key==i)return s.state;if(i!=null){for(let e=0;e<this.mouseActions.length;e++)if(s=this.mouseActions[e],s.mouse==t&&s.key==null)return s.state}return null}getAngle(t,i){return Math.atan2(i.clientY-t.clientY,i.clientX-t.clientX)*180/Math.PI}updateTouchEvent(t){for(let i=0;i<this._touchCurrent.length;i++)if(this._touchCurrent[i].pointerId==t.pointerId){this._touchCurrent.splice(i,1,t);break}}applyTransformMatrix(t){if(t.camera!=null&&(this._m4_1.copy(this._cameraMatrixState).premultiply(t.camera),this._m4_1.decompose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.updateMatrix(),(this._state==n.ROTATE||this._state==n.ZROTATE||this._state==n.ANIMATION_ROTATE)&&this.camera.up.copy(this._upState).applyQuaternion(this.camera.quaternion)),t.gizmos!=null&&(this._m4_1.copy(this._gizmoMatrixState).premultiply(t.gizmos),this._m4_1.decompose(this._gizmos.position,this._gizmos.quaternion,this._gizmos.scale),this._gizmos.updateMatrix()),this._state==n.SCALE||this._state==n.FOCUS||this._state==n.ANIMATION_FOCUS)if(this._tbRadius=this.calculateTbRadius(this.camera),this.adjustNearFar){const i=this.camera.position.distanceTo(this._gizmos.position),s=new W;s.setFromObject(this._gizmos);const e=new rt;s.getBoundingSphere(e);const a=Math.max(this._nearPos0,e.radius+e.center.length()),o=i-this._initialNear,h=Math.min(a,o);this.camera.near=i-h;const c=Math.min(this._farPos0,-e.radius+e.center.length()),l=i-this._initialFar,p=Math.min(c,l);this.camera.far=i-p,this.camera.updateProjectionMatrix()}else{let i=!1;this.camera.near!=this._initialNear&&(this.camera.near=this._initialNear,i=!0),this.camera.far!=this._initialFar&&(this.camera.far=this._initialFar,i=!0),i&&this.camera.updateProjectionMatrix()}}calculateAngularSpeed(t,i,s,e){const a=i-t,o=(e-s)/1e3;return o==0?0:a/o}calculatePointersDistance(t,i){return Math.sqrt(Math.pow(i.clientX-t.clientX,2)+Math.pow(i.clientY-t.clientY,2))}calculateRotationAxis(t,i){return this._rotationMatrix.extractRotation(this._cameraMatrixState),this._quat.setFromRotationMatrix(this._rotationMatrix),this._rotationAxis.crossVectors(t,i).applyQuaternion(this._quat),this._rotationAxis.normalize().clone()}calculateTbRadius(t){const i=t.position.distanceTo(this._gizmos.position);if(t.type=="PerspectiveCamera"){const s=d.DEG2RAD*t.fov*.5,e=Math.atan(t.aspect*Math.tan(s));return Math.tan(Math.min(s,e))*i*this.radiusFactor}else if(t.type=="OrthographicCamera")return Math.min(t.top,t.right)*this.radiusFactor}focus(t,i,s=1){f.copy(t).sub(this._gizmos.position).multiplyScalar(s),this._translationMatrix.makeTranslation(f.x,f.y,f.z),U.copy(this._gizmoMatrixState),this._gizmoMatrixState.premultiply(this._translationMatrix),this._gizmoMatrixState.decompose(this._gizmos.position,this._gizmos.quaternion,this._gizmos.scale),Z.copy(this._cameraMatrixState),this._cameraMatrixState.premultiply(this._translationMatrix),this._cameraMatrixState.decompose(this.camera.position,this.camera.quaternion,this.camera.scale),this.enableZoom&&this.applyTransformMatrix(this.scale(i,this._gizmos.position)),this._gizmoMatrixState.copy(U),this._cameraMatrixState.copy(Z)}drawGrid(){if(this.scene!=null){let s,e,a,o;if(this.camera.isOrthographicCamera){const h=this.camera.right-this.camera.left,c=this.camera.bottom-this.camera.top;a=Math.max(h,c),o=a/20,s=a/this.camera.zoom*3,e=s/o*this.camera.zoom}else if(this.camera.isPerspectiveCamera){const h=this.camera.position.distanceTo(this._gizmos.position),c=d.DEG2RAD*this.camera.fov*.5,l=Math.atan(this.camera.aspect*Math.tan(c));a=Math.tan(Math.max(c,l))*h*2,o=a/20,s=a*3,e=s/o}this._grid==null&&(this._grid=new nt(s,e,8947848,8947848),this._grid.position.copy(this._gizmos.position),this._gridPosition.copy(this._grid.position),this._grid.quaternion.copy(this.camera.quaternion),this._grid.rotateX(Math.PI*.5),this.scene.add(this._grid))}}dispose(){this._animationId!=-1&&window.cancelAnimationFrame(this._animationId),this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointercancel",this._onPointerCancel),this.domElement.removeEventListener("wheel",this._onWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),window.removeEventListener("pointermove",this._onPointerMove),window.removeEventListener("pointerup",this._onPointerUp),window.removeEventListener("resize",this._onWindowResize),this.scene!==null&&this.scene.remove(this._gizmos),this.disposeGrid()}disposeGrid(){this._grid!=null&&this.scene!=null&&(this.scene.remove(this._grid),this._grid=null)}easeOutCubic(t){return 1-Math.pow(1-t,3)}activateGizmos(t){const i=this._gizmos.children[0],s=this._gizmos.children[1],e=this._gizmos.children[2];t?(i.material.setValues({opacity:1}),s.material.setValues({opacity:1}),e.material.setValues({opacity:1})):(i.material.setValues({opacity:.6}),s.material.setValues({opacity:.6}),e.material.setValues({opacity:.6}))}getCursorNDC(t,i,s){const e=s.getBoundingClientRect();return this._v2_1.setX((t-e.left)/e.width*2-1),this._v2_1.setY((e.bottom-i)/e.height*2-1),this._v2_1.clone()}getCursorPosition(t,i,s){return this._v2_1.copy(this.getCursorNDC(t,i,s)),this._v2_1.x*=(this.camera.right-this.camera.left)*.5,this._v2_1.y*=(this.camera.top-this.camera.bottom)*.5,this._v2_1.clone()}setCamera(t){t.lookAt(this.target),t.updateMatrix(),t.type=="PerspectiveCamera"&&(this._fov0=t.fov,this._fovState=t.fov),this._cameraMatrixState0.copy(t.matrix),this._cameraMatrixState.copy(this._cameraMatrixState0),this._cameraProjectionState.copy(t.projectionMatrix),this._zoom0=t.zoom,this._zoomState=this._zoom0,this._initialNear=t.near,this._nearPos0=t.position.distanceTo(this.target)-t.near,this._nearPos=this._initialNear,this._initialFar=t.far,this._farPos0=t.position.distanceTo(this.target)-t.far,this._farPos=this._initialFar,this._up0.copy(t.up),this._upState.copy(t.up),this.camera=t,this.camera.updateProjectionMatrix(),this._tbRadius=this.calculateTbRadius(t),this.makeGizmos(this.target,this._tbRadius)}setGizmosVisible(t){this._gizmos.visible=t,this.dispatchEvent(u)}setTbRadius(t){this.radiusFactor=t,this._tbRadius=this.calculateTbRadius(this.camera);const s=new R(0,0,this._tbRadius,this._tbRadius).getPoints(this._curvePts),e=new A().setFromPoints(s);for(const a in this._gizmos.children)this._gizmos.children[a].geometry=e;this.dispatchEvent(u)}makeGizmos(t,i){const e=new R(0,0,i,i).getPoints(this._curvePts),a=new A().setFromPoints(e),o=new D({color:16744576,fog:!1,transparent:!0,opacity:.6}),h=new D({color:8454016,fog:!1,transparent:!0,opacity:.6}),c=new D({color:8421631,fog:!1,transparent:!0,opacity:.6}),l=new N(a,o),p=new N(a,h),g=new N(a,c),M=Math.PI*.5;if(l.rotation.x=M,p.rotation.y=M,this._gizmoMatrixState0.identity().setPosition(t),this._gizmoMatrixState.copy(this._gizmoMatrixState0),this.camera.zoom!==1){const y=1/this.camera.zoom;this._scaleMatrix.makeScale(y,y,y),this._translationMatrix.makeTranslation(-t.x,-t.y,-t.z),this._gizmoMatrixState.premultiply(this._translationMatrix).premultiply(this._scaleMatrix),this._translationMatrix.makeTranslation(t.x,t.y,t.z),this._gizmoMatrixState.premultiply(this._translationMatrix)}this._gizmoMatrixState.decompose(this._gizmos.position,this._gizmos.quaternion,this._gizmos.scale),this._gizmos.traverse(function(y){y.isLine&&(y.geometry.dispose(),y.material.dispose())}),this._gizmos.clear(),this._gizmos.add(l),this._gizmos.add(p),this._gizmos.add(g)}onFocusAnim(t,i,s,e){if(this._timeStart==-1&&(this._timeStart=t),this._state==n.ANIMATION_FOCUS){const o=(t-this._timeStart)/this.focusAnimationTime;if(this._gizmoMatrixState.copy(e),o>=1)this._gizmoMatrixState.decompose(this._gizmos.position,this._gizmos.quaternion,this._gizmos.scale),this.focus(i,this.scaleFactor),this._timeStart=-1,this.updateTbState(n.IDLE,!1),this.activateGizmos(!1),this.dispatchEvent(u);else{const h=this.easeOutCubic(o),c=1-h+this.scaleFactor*h;this._gizmoMatrixState.decompose(this._gizmos.position,this._gizmos.quaternion,this._gizmos.scale),this.focus(i,c,h),this.dispatchEvent(u);const l=this;this._animationId=window.requestAnimationFrame(function(p){l.onFocusAnim(p,i,s,e.clone())})}}else this._animationId=-1,this._timeStart=-1}onRotationAnim(t,i,s){if(this._timeStart==-1&&(this._anglePrev=0,this._angleCurrent=0,this._timeStart=t),this._state==n.ANIMATION_ROTATE){const e=(t-this._timeStart)/1e3;if(s+-this.dampingFactor*e>0){this._angleCurrent=.5*-this.dampingFactor*Math.pow(e,2)+s*e+0,this.applyTransformMatrix(this.rotate(i,this._angleCurrent)),this.dispatchEvent(u);const o=this;this._animationId=window.requestAnimationFrame(function(h){o.onRotationAnim(h,i,s)})}else this._animationId=-1,this._timeStart=-1,this.updateTbState(n.IDLE,!1),this.activateGizmos(!1),this.dispatchEvent(u)}else this._animationId=-1,this._timeStart=-1,this._state!=n.ROTATE&&(this.activateGizmos(!1),this.dispatchEvent(u))}pan(t,i,s=!1){const e=t.clone().sub(i);if(this.camera.isOrthographicCamera)e.multiplyScalar(1/this.camera.zoom);else if(this.camera.isPerspectiveCamera&&s){this._v3_1.setFromMatrixPosition(this._cameraMatrixState0),this._v3_2.setFromMatrixPosition(this._gizmoMatrixState0);const a=this._v3_1.distanceTo(this._v3_2)/this.camera.position.distanceTo(this._gizmos.position);e.multiplyScalar(1/a)}return this._v3_1.set(e.x,e.y,0).applyQuaternion(this.camera.quaternion),this._m4_1.makeTranslation(this._v3_1.x,this._v3_1.y,this._v3_1.z),this.setTransformationMatrices(this._m4_1,this._m4_1),P}reset(){this.camera.zoom=this._zoom0,this.camera.isPerspectiveCamera&&(this.camera.fov=this._fov0),this.camera.near=this._nearPos,this.camera.far=this._farPos,this._cameraMatrixState.copy(this._cameraMatrixState0),this._cameraMatrixState.decompose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.up.copy(this._up0),this.camera.updateMatrix(),this.camera.updateProjectionMatrix(),this._gizmoMatrixState.copy(this._gizmoMatrixState0),this._gizmoMatrixState0.decompose(this._gizmos.position,this._gizmos.quaternion,this._gizmos.scale),this._gizmos.updateMatrix(),this._tbRadius=this.calculateTbRadius(this.camera),this.makeGizmos(this._gizmos.position,this._tbRadius),this.camera.lookAt(this._gizmos.position),this.updateTbState(n.IDLE,!1),this.dispatchEvent(u)}rotate(t,i){const s=this._gizmos.position;return this._translationMatrix.makeTranslation(-s.x,-s.y,-s.z),this._rotationMatrix.makeRotationAxis(t,-i),this._m4_1.makeTranslation(s.x,s.y,s.z),this._m4_1.multiply(this._rotationMatrix),this._m4_1.multiply(this._translationMatrix),this.setTransformationMatrices(this._m4_1),P}copyState(){let t;this.camera.isOrthographicCamera?t=JSON.stringify({arcballState:{cameraFar:this.camera.far,cameraMatrix:this.camera.matrix,cameraNear:this.camera.near,cameraUp:this.camera.up,cameraZoom:this.camera.zoom,gizmoMatrix:this._gizmos.matrix}}):this.camera.isPerspectiveCamera&&(t=JSON.stringify({arcballState:{cameraFar:this.camera.far,cameraFov:this.camera.fov,cameraMatrix:this.camera.matrix,cameraNear:this.camera.near,cameraUp:this.camera.up,cameraZoom:this.camera.zoom,gizmoMatrix:this._gizmos.matrix}})),navigator.clipboard.writeText(t)}pasteState(){const t=this;navigator.clipboard.readText().then(function(s){t.setStateFromJSON(s)})}saveState(){this._cameraMatrixState0.copy(this.camera.matrix),this._gizmoMatrixState0.copy(this._gizmos.matrix),this._nearPos=this.camera.near,this._farPos=this.camera.far,this._zoom0=this.camera.zoom,this._up0.copy(this.camera.up),this.camera.isPerspectiveCamera&&(this._fov0=this.camera.fov)}scale(t,i,s=!0){E.copy(i);let e=1/t;if(this.camera.isOrthographicCamera){this.camera.zoom=this._zoomState,this.camera.zoom*=t,this.camera.zoom>this.maxZoom?(this.camera.zoom=this.maxZoom,e=this._zoomState/this.maxZoom):this.camera.zoom<this.minZoom&&(this.camera.zoom=this.minZoom,e=this._zoomState/this.minZoom),this.camera.updateProjectionMatrix(),this._v3_1.setFromMatrixPosition(this._gizmoMatrixState),this._scaleMatrix.makeScale(e,e,e),this._translationMatrix.makeTranslation(-this._v3_1.x,-this._v3_1.y,-this._v3_1.z),this._m4_2.makeTranslation(this._v3_1.x,this._v3_1.y,this._v3_1.z).multiply(this._scaleMatrix),this._m4_2.multiply(this._translationMatrix),E.sub(this._v3_1);const a=E.clone().multiplyScalar(e);return E.sub(a),this._m4_1.makeTranslation(E.x,E.y,E.z),this._m4_2.premultiply(this._m4_1),this.setTransformationMatrices(this._m4_1,this._m4_2),P}else if(this.camera.isPerspectiveCamera){this._v3_1.setFromMatrixPosition(this._cameraMatrixState),this._v3_2.setFromMatrixPosition(this._gizmoMatrixState);let a=this._v3_1.distanceTo(E),o=a-a*e;const h=a-o;if(h<this.minDistance?(e=this.minDistance/a,o=a-a*e):h>this.maxDistance&&(e=this.maxDistance/a,o=a-a*e),f.copy(E).sub(this._v3_1).normalize().multiplyScalar(o),this._m4_1.makeTranslation(f.x,f.y,f.z),s){const c=this._v3_2;a=c.distanceTo(E),o=a-a*e,f.copy(E).sub(this._v3_2).normalize().multiplyScalar(o),this._translationMatrix.makeTranslation(c.x,c.y,c.z),this._scaleMatrix.makeScale(e,e,e),this._m4_2.makeTranslation(f.x,f.y,f.z).multiply(this._translationMatrix),this._m4_2.multiply(this._scaleMatrix),this._translationMatrix.makeTranslation(-c.x,-c.y,-c.z),this._m4_2.multiply(this._translationMatrix),this.setTransformationMatrices(this._m4_1,this._m4_2)}else this.setTransformationMatrices(this._m4_1);return P}}setFov(t){this.camera.isPerspectiveCamera&&(this.camera.fov=d.clamp(t,this.minFov,this.maxFov),this.camera.updateProjectionMatrix())}setTransformationMatrices(t=null,i=null){t!=null?P.camera!=null?P.camera.copy(t):P.camera=t.clone():P.camera=null,i!=null?P.gizmos!=null?P.gizmos.copy(i):P.gizmos=i.clone():P.gizmos=null}zRotate(t,i){return this._rotationMatrix.makeRotationAxis(this._rotationAxis,i),this._translationMatrix.makeTranslation(-t.x,-t.y,-t.z),this._m4_1.makeTranslation(t.x,t.y,t.z),this._m4_1.multiply(this._rotationMatrix),this._m4_1.multiply(this._translationMatrix),this._v3_1.setFromMatrixPosition(this._gizmoMatrixState).sub(t),this._v3_2.copy(this._v3_1).applyAxisAngle(this._rotationAxis,i),this._v3_2.sub(this._v3_1),this._m4_2.makeTranslation(this._v3_2.x,this._v3_2.y,this._v3_2.z),this.setTransformationMatrices(this._m4_1,this._m4_2),P}getRaycaster(){return xt}unprojectOnObj(t,i){const s=this.getRaycaster();s.near=i.near,s.far=i.far,s.setFromCamera(t,i);const e=s.intersectObjects(this.scene.children,!0);for(let a=0;a<e.length;a++)if(e[a].object.uuid!=this._gizmos.uuid&&e[a].face!=null)return e[a].point.clone();return null}unprojectOnTbSurface(t,i,s,e,a){if(t.type=="OrthographicCamera"){this._v2_1.copy(this.getCursorPosition(i,s,e)),this._v3_1.set(this._v2_1.x,this._v2_1.y,0);const o=Math.pow(this._v2_1.x,2),h=Math.pow(this._v2_1.y,2),c=Math.pow(this._tbRadius,2);return o+h<=c*.5?this._v3_1.setZ(Math.sqrt(c-(o+h))):this._v3_1.setZ(c*.5/Math.sqrt(o+h)),this._v3_1}else if(t.type=="PerspectiveCamera"){this._v2_1.copy(this.getCursorNDC(i,s,e)),this._v3_1.set(this._v2_1.x,this._v2_1.y,-1),this._v3_1.applyMatrix4(t.projectionMatrixInverse);const o=this._v3_1.clone().normalize(),h=t.position.distanceTo(this._gizmos.position),c=Math.pow(a,2),l=this._v3_1.z,p=Math.sqrt(Math.pow(this._v3_1.x,2)+Math.pow(this._v3_1.y,2));if(p==0)return o.set(this._v3_1.x,this._v3_1.y,a),o;const g=l/p,M=h;let y=Math.pow(g,2)+1,z=2*g*M,O=Math.pow(M,2)-c,C=Math.pow(z,2)-4*y*O;if(C>=0&&(this._v2_1.setX((-z-Math.sqrt(C))/(2*y)),this._v2_1.setY(g*this._v2_1.x+M),d.RAD2DEG*this._v2_1.angle()>=45)){const B=Math.sqrt(Math.pow(this._v2_1.x,2)+Math.pow(h-this._v2_1.y,2));return o.multiplyScalar(B),o.z+=h,o}y=g,z=M,O=-c*.5,C=Math.pow(z,2)-4*y*O,this._v2_1.setX((-z-Math.sqrt(C))/(2*y)),this._v2_1.setY(g*this._v2_1.x+M);const H=Math.sqrt(Math.pow(this._v2_1.x,2)+Math.pow(h-this._v2_1.y,2));return o.multiplyScalar(H),o.z+=h,o}}unprojectOnTbPlane(t,i,s,e,a=!1){if(t.type=="OrthographicCamera")return this._v2_1.copy(this.getCursorPosition(i,s,e)),this._v3_1.set(this._v2_1.x,this._v2_1.y,0),this._v3_1.clone();if(t.type=="PerspectiveCamera"){this._v2_1.copy(this.getCursorNDC(i,s,e)),this._v3_1.set(this._v2_1.x,this._v2_1.y,-1),this._v3_1.applyMatrix4(t.projectionMatrixInverse);const o=this._v3_1.clone().normalize(),h=this._v3_1.z,c=Math.sqrt(Math.pow(this._v3_1.x,2)+Math.pow(this._v3_1.y,2));let l;if(a?l=this._v3_1.setFromMatrixPosition(this._cameraMatrixState0).distanceTo(this._v3_2.setFromMatrixPosition(this._gizmoMatrixState0)):l=t.position.distanceTo(this._gizmos.position),c==0)return o.set(0,0,0),o;const p=h/c,g=l,M=-g/p,y=Math.sqrt(Math.pow(g,2)+Math.pow(M,2));return o.multiplyScalar(y),o.z=0,o}}updateMatrixState(){this._cameraMatrixState.copy(this.camera.matrix),this._gizmoMatrixState.copy(this._gizmos.matrix),this.camera.isOrthographicCamera?(this._cameraProjectionState.copy(this.camera.projectionMatrix),this.camera.updateProjectionMatrix(),this._zoomState=this.camera.zoom):this.camera.isPerspectiveCamera&&(this._fovState=this.camera.fov)}updateTbState(t,i){this._state=t,i&&this.updateMatrixState()}update(){if(this.target.equals(this._currentTarget)===!1&&(this._gizmos.position.copy(this.target),this._tbRadius=this.calculateTbRadius(this.camera),this.makeGizmos(this.target,this._tbRadius),this._currentTarget.copy(this.target)),this.camera.isOrthographicCamera){if(this.camera.zoom>this.maxZoom||this.camera.zoom<this.minZoom){const i=d.clamp(this.camera.zoom,this.minZoom,this.maxZoom);this.applyTransformMatrix(this.scale(i/this.camera.zoom,this._gizmos.position,!0))}}else if(this.camera.isPerspectiveCamera){const i=this.camera.position.distanceTo(this._gizmos.position);if(i>this.maxDistance+1e-6||i<this.minDistance-1e-6){const e=d.clamp(i,this.minDistance,this.maxDistance);this.applyTransformMatrix(this.scale(e/i,this._gizmos.position)),this.updateMatrixState()}(this.camera.fov<this.minFov||this.camera.fov>this.maxFov)&&(this.camera.fov=d.clamp(this.camera.fov,this.minFov,this.maxFov),this.camera.updateProjectionMatrix());const s=this._tbRadius;if(this._tbRadius=this.calculateTbRadius(this.camera),s<this._tbRadius-1e-6||s>this._tbRadius+1e-6){const e=(this._gizmos.scale.x+this._gizmos.scale.y+this._gizmos.scale.z)/3,a=this._tbRadius/e,h=new R(0,0,a,a).getPoints(this._curvePts),c=new A().setFromPoints(h);for(const l in this._gizmos.children)this._gizmos.children[l].geometry=c}}this.camera.lookAt(this._gizmos.position)}setStateFromJSON(t){const i=JSON.parse(t);if(i.arcballState!=null){this._cameraMatrixState.fromArray(i.arcballState.cameraMatrix.elements),this._cameraMatrixState.decompose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.up.copy(i.arcballState.cameraUp),this.camera.near=i.arcballState.cameraNear,this.camera.far=i.arcballState.cameraFar,this.camera.zoom=i.arcballState.cameraZoom,this.camera.isPerspectiveCamera&&(this.camera.fov=i.arcballState.cameraFov),this._gizmoMatrixState.fromArray(i.arcballState.gizmoMatrix.elements),this._gizmoMatrixState.decompose(this._gizmos.position,this._gizmos.quaternion,this._gizmos.scale),this.camera.updateMatrix(),this.camera.updateProjectionMatrix(),this._gizmos.updateMatrix(),this._tbRadius=this.calculateTbRadius(this.camera);const s=new x().copy(this._gizmoMatrixState0);this.makeGizmos(this._gizmos.position,this._tbRadius),this._gizmoMatrixState0.copy(s),this.camera.lookAt(this._gizmos.position),this.updateTbState(n.IDLE,!1),this.dispatchEvent(u)}}}function yt(){const r=(this._gizmos.scale.x+this._gizmos.scale.y+this._gizmos.scale.z)/3;this._tbRadius=this.calculateTbRadius(this.camera);const t=this._tbRadius/r,s=new R(0,0,t,t).getPoints(this._curvePts),e=new A().setFromPoints(s);for(const a in this._gizmos.children)this._gizmos.children[a].geometry=e;this.dispatchEvent(u)}function Pt(r){if(this.enabled){for(let t=0;t<this.mouseActions.length;t++)if(this.mouseActions[t].mouse==2){r.preventDefault();break}}}function St(){this._touchStart.splice(0,this._touchStart.length),this._touchCurrent.splice(0,this._touchCurrent.length),this._input=_.NONE}function Et(r){if(r.button==0&&r.isPrimary?(this._downValid=!0,this._downEvents.push(r),this._downStart=performance.now()):this._downValid=!1,r.pointerType=="touch"&&this._input!=_.CURSOR)switch(this._touchStart.push(r),this._touchCurrent.push(r),this._input){case _.NONE:this._input=_.ONE_FINGER,this.onSinglePanStart(r,"ROTATE"),window.addEventListener("pointermove",this._onPointerMove),window.addEventListener("pointerup",this._onPointerUp);break;case _.ONE_FINGER:case _.ONE_FINGER_SWITCHED:this._input=_.TWO_FINGER,this.onRotateStart(),this.onPinchStart(),this.onDoublePanStart();break;case _.TWO_FINGER:this._input=_.MULT_FINGER,this.onTriplePanStart(r);break}else if(r.pointerType!="touch"&&this._input==_.NONE){let t=null;r.ctrlKey||r.metaKey?t="CTRL":r.shiftKey&&(t="SHIFT"),this._mouseOp=this.getOpFromAction(r.button,t),this._mouseOp!=null&&(window.addEventListener("pointermove",this._onPointerMove),window.addEventListener("pointerup",this._onPointerUp),this._input=_.CURSOR,this._button=r.button,this.onSinglePanStart(r,this._mouseOp))}}function wt(r){if(r.pointerType=="touch"&&this._input!=_.CURSOR)switch(this._input){case _.ONE_FINGER:this.updateTouchEvent(r),this.onSinglePanMove(r,n.ROTATE);break;case _.ONE_FINGER_SWITCHED:if(this.calculatePointersDistance(this._touchCurrent[0],r)*this._devPxRatio>=this._switchSensibility){this._input=_.ONE_FINGER,this.updateTouchEvent(r),this.onSinglePanStart(r,"ROTATE");break}break;case _.TWO_FINGER:this.updateTouchEvent(r),this.onRotateMove(),this.onPinchMove(),this.onDoublePanMove();break;case _.MULT_FINGER:this.updateTouchEvent(r),this.onTriplePanMove(r);break}else if(r.pointerType!="touch"&&this._input==_.CURSOR){let t=null;r.ctrlKey||r.metaKey?t="CTRL":r.shiftKey&&(t="SHIFT");const i=this.getOpStateFromAction(this._button,t);i!=null&&this.onSinglePanMove(r,i)}this._downValid&&this.calculatePointersDistance(this._downEvents[this._downEvents.length-1],r)*this._devPxRatio>this._movementThreshold&&(this._downValid=!1)}function bt(r){if(r.pointerType=="touch"&&this._input!=_.CURSOR){const t=this._touchCurrent.length;for(let i=0;i<t;i++)if(this._touchCurrent[i].pointerId==r.pointerId){this._touchCurrent.splice(i,1),this._touchStart.splice(i,1);break}switch(this._input){case _.ONE_FINGER:case _.ONE_FINGER_SWITCHED:window.removeEventListener("pointermove",this._onPointerMove),window.removeEventListener("pointerup",this._onPointerUp),this._input=_.NONE,this.onSinglePanEnd();break;case _.TWO_FINGER:this.onDoublePanEnd(r),this.onPinchEnd(r),this.onRotateEnd(r),this._input=_.ONE_FINGER_SWITCHED;break;case _.MULT_FINGER:this._touchCurrent.length==0&&(window.removeEventListener("pointermove",this._onPointerMove),window.removeEventListener("pointerup",this._onPointerUp),this._input=_.NONE,this.onTriplePanEnd());break}}else r.pointerType!="touch"&&this._input==_.CURSOR&&(window.removeEventListener("pointermove",this._onPointerMove),window.removeEventListener("pointerup",this._onPointerUp),this._input=_.NONE,this.onSinglePanEnd(),this._button=-1);if(r.isPrimary)if(this._downValid)if(r.timeStamp-this._downEvents[this._downEvents.length-1].timeStamp<=this._maxDownTime)if(this._nclicks==0)this._nclicks=1,this._clickStart=performance.now();else{const i=r.timeStamp-this._clickStart,s=this.calculatePointersDistance(this._downEvents[1],this._downEvents[0])*this._devPxRatio;i<=this._maxInterval&&s<=this._posThreshold?(this._nclicks=0,this._downEvents.splice(0,this._downEvents.length),this.onDoubleTap(r)):(this._nclicks=1,this._downEvents.shift(),this._clickStart=performance.now())}else this._downValid=!1,this._nclicks=0,this._downEvents.splice(0,this._downEvents.length);else this._nclicks=0,this._downEvents.splice(0,this._downEvents.length)}function zt(r){if(this.enabled&&this.enableZoom){let t=null;r.ctrlKey||r.metaKey?t="CTRL":r.shiftKey&&(t="SHIFT");const i=this.getOpFromAction("WHEEL",t);if(i!=null){r.preventDefault(),this.dispatchEvent(w);const s=125;let e=r.deltaY/s,a=1;switch(e>0?a=1/this.scaleFactor:e<0&&(a=this.scaleFactor),i){case"ZOOM":if(this.updateTbState(n.SCALE,!0),e>0?a=1/Math.pow(this.scaleFactor,e):e<0&&(a=Math.pow(this.scaleFactor,-e)),this.cursorZoom&&this.enablePan){let o;this.camera.isOrthographicCamera?o=this.unprojectOnTbPlane(this.camera,r.clientX,r.clientY,this.domElement).applyQuaternion(this.camera.quaternion).multiplyScalar(1/this.camera.zoom).add(this._gizmos.position):this.camera.isPerspectiveCamera&&(o=this.unprojectOnTbPlane(this.camera,r.clientX,r.clientY,this.domElement).applyQuaternion(this.camera.quaternion).add(this._gizmos.position)),this.applyTransformMatrix(this.scale(a,o))}else this.applyTransformMatrix(this.scale(a,this._gizmos.position));this._grid!=null&&(this.disposeGrid(),this.drawGrid()),this.updateTbState(n.IDLE,!1),this.dispatchEvent(u),this.dispatchEvent(S);break;case"FOV":if(this.camera.isPerspectiveCamera){this.updateTbState(n.FOV,!0),r.deltaX!=0&&(e=r.deltaX/s,a=1,e>0?a=1/Math.pow(this.scaleFactor,e):e<0&&(a=Math.pow(this.scaleFactor,-e))),this._v3_1.setFromMatrixPosition(this._cameraMatrixState);const o=this._v3_1.distanceTo(this._gizmos.position);let h=o/a;h=d.clamp(h,this.minDistance,this.maxDistance);const c=o*Math.tan(d.DEG2RAD*this.camera.fov*.5);let l=d.RAD2DEG*(Math.atan(c/h)*2);l>this.maxFov?l=this.maxFov:l<this.minFov&&(l=this.minFov);const p=c/Math.tan(d.DEG2RAD*(l/2));a=o/p,this.setFov(l),this.applyTransformMatrix(this.scale(a,this._gizmos.position,!1))}this._grid!=null&&(this.disposeGrid(),this.drawGrid()),this.updateTbState(n.IDLE,!1),this.dispatchEvent(u),this.dispatchEvent(S);break}}}}const Tt=new URL(""+new URL("lightroom_14b-MJkJLVlP.hdr",import.meta.url).href,import.meta.url).href;class Ct{constructor(){this.scene=new ht,this.renderer=new ct({antialias:!0,alpha:!0,powerPreference:"high-performance",preserveDrawingBuffer:!0}),this.camera=new mt(60,window.innerWidth/window.innerHeight,.1,1e4),this._container=new T,this.ticker=()=>{j.update(),this.renderer.clear(),this.renderer.render(this.scene,this.camera),requestAnimationFrame(this.ticker),this.controls.update()},this.resize=()=>{const i=this.renderer.domElement.parentElement;if(!i)return;const s=i.clientWidth,e=i.clientHeight;this.camera.aspect=s/e,this.camera.updateProjectionMatrix(),this.renderer.setSize(s,e)},this.controls=new Mt(this.camera,this.renderer.domElement),this.controls.enablePan=!1,this.renderer.setPixelRatio(window.devicePixelRatio||2),this.renderer.autoClear=!1,this.renderer.toneMapping=lt,this.renderer.toneMappingExposure=1.4,G.tonemapping_pars_fragment=G.tonemapping_pars_fragment.replace("vec3 CustomToneMapping( vec3 color ) { return color; }",`
|
|
2
|
+
float startCompression = 0.8;
|
|
3
|
+
float desaturation = 0.5;
|
|
4
|
+
vec3 CustomToneMapping( vec3 color ) {
|
|
5
|
+
color *= toneMappingExposure;
|
|
6
|
+
|
|
7
|
+
float d = 1. - startCompression;
|
|
8
|
+
|
|
9
|
+
float peak = max(color.r, max(color.g, color.b));
|
|
10
|
+
if (peak < startCompression) return color;
|
|
11
|
+
|
|
12
|
+
float newPeak = 1. - d * d / (peak + d - startCompression);
|
|
13
|
+
float invPeak = 1. / peak;
|
|
14
|
+
|
|
15
|
+
float extraBrightness = dot(color * (1. - startCompression * invPeak), vec3(1, 1, 1));
|
|
16
|
+
|
|
17
|
+
color *= newPeak * invPeak;
|
|
18
|
+
float g = 1. - 3. / (desaturation * extraBrightness + 3.);
|
|
19
|
+
return mix(color, vec3(1, 1, 1), g);
|
|
20
|
+
}`),this.camera.position.set(0,0,3),this.camera.lookAt(new v),new ft(new _t).load(Tt,i=>{i.mapping=ut,i.minFilter=L,i.magFilter=L,i.needsUpdate=!0,this.scene.environment=i},()=>{},()=>{}),this.scene.add(this._container),this.ticker()}fit(){var e;const t=new W;t.setFromObject(this._container);const i=new v;t.getCenter(i);const s=new v(0,0,1);this._fitAnimation=new vt(this.camera.position).to(s,600).easing(j.Easing.Quintic.InOut).onStart(()=>{this.controls.enabled=!1}).onUpdate(({},a)=>{this.controls.update()}).onComplete(()=>{this.camera.lookAt(0,0,0),this.controls.target.set(0,0,0),this.controls.enabled=!0}).start(),!i.equals(new v)&&((e=this._container.children[0])==null||e.position.copy(i.multiplyScalar(-1)))}appendTo(t){t.append(this.renderer.domElement),this.resize(),this._resizeObserver=new ResizeObserver(this.resize),this._resizeObserver.observe(t)}destroy(){var i,s;(i=this._fitAnimation)==null||i.stop();const t=this.renderer.domElement.parentElement;t&&((s=this._resizeObserver)==null||s.unobserve(t),this.controls.dispose(),this.renderer.dispose(),this.scene.traverse(e=>{e instanceof X&&(e.geometry.dispose(),Array.isArray(e.material)?e.material.forEach(a=>a.dispose()):e.material&&e.material.dispose()),e.removeFromParent()}))}add(t){this._container.add(t)}}function Ft(r){return new Worker(""+new URL("worker-h5IcTUxB.js",import.meta.url).href,{name:r==null?void 0:r.name})}const Rt=new URL("./draco/",import.meta.url).href,I=new gt;I.setDecoderPath(Rt+"/");I.setDecoderConfig({type:"wasm"});const At=r=>new x().set(...Array.from({length:12},(t,i)=>r[Math.floor(i/4)+i%4*3]),0,0,0,1);class Ot{constructor(){this.group=new T,this.group.scale.set(1,1,1)}async _addMesh(t,i){let s;if(t.face)try{s=await this._loadGeo(t.face,t.color),s.name=t.name,s.visible=!t.hidden,i.add(s)}catch(e){console.log(e);return}else s=new T;t.transform&&(s.matrixAutoUpdate=!0,s.applyMatrix4(At(t.transform))),t.children&&t.children.forEach(e=>{this._addMesh(e,s)}),i.add(s)}async load(t){return this._worker=new Ft,this._worker.postMessage(t),new Promise((i,s)=>{this._worker.addEventListener("message",e=>{const a=e.data,o=new T;o.name=a.name,this._addMesh(a,o),this.group.add(o),o.scale.set(.001,.001,.001),i(o)})})}_loadGeo(t,i){return new Promise((s,e)=>{const a=new Blob([t],{type:"application/octet-stream"}),o=URL.createObjectURL(a);I.load(o,h=>{const c=new pt({color:i||16711935,metalness:.4,roughness:.2,side:dt}),l=new X(h,c);s(l),URL.revokeObjectURL(o)},void 0,function(h){e(h)})})}}var Dt=Object.defineProperty,Nt=Object.getOwnPropertyDescriptor,k=(r,t,i,s)=>{for(var e=s>1?void 0:s?Nt(t,i):t,a=r.length-1,o;a>=0;a--)(o=r[a])&&(e=(s?o(t,i,e):o(e))||e);return s&&e&&Dt(t,i,e),e};let b=class extends Q{constructor(){super(),this.scene=new Ct,this._loader=new Ot,this.e3dx="",this.fit=()=>{this.scene.fit()}}firstUpdated(r){super.firstUpdated(r),this.container&&(this.scene.appendTo(this.container),this.e3dx&&this._loader.load(this.e3dx).then(t=>{this.scene.add(t),setTimeout(()=>{this.scene.fit()},100)}))}render(){return K`
|
|
21
|
+
<div class="container">
|
|
22
|
+
<div class="actions">
|
|
23
|
+
<button @click=${this.fit}>聚焦</button>
|
|
24
|
+
</div>
|
|
25
|
+
</div>`}};b.styles=J`
|
|
26
|
+
:host {
|
|
27
|
+
display: block;
|
|
28
|
+
width: 100%;
|
|
29
|
+
height: 100%;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
canvas {
|
|
33
|
+
width: 100%;
|
|
34
|
+
height: 100%;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.actions {
|
|
38
|
+
position: absolute;
|
|
39
|
+
left: 0;
|
|
40
|
+
top: 0;
|
|
41
|
+
}
|
|
42
|
+
`;k([$(".container")],b.prototype,"container",2);k([it()],b.prototype,"e3dx",2);b=k([tt("model-viewer")],b);const qt={title:"Shop/ModelViewer",tags:["autodocs"],render:r=>{const t=new b;return t.e3dx=r.e3dx,t},argTypes:{e3dx:{control:"text",description:"test"}}},F={args:{e3dx:"http://localhost:5001/test2.e3dx"}};var q,V,Y;F.parameters={...F.parameters,docs:{...(q=F.parameters)==null?void 0:q.docs,source:{originalSource:`{
|
|
43
|
+
args: {
|
|
44
|
+
e3dx: 'http://localhost:5001/test2.e3dx'
|
|
45
|
+
}
|
|
46
|
+
}`,...(Y=(V=F.parameters)==null?void 0:V.docs)==null?void 0:Y.source}}};const Vt=["Primary"];export{F as Primary,Vt as __namedExportsOrder,qt as default};
|
|
Binary file
|